Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
-Dfile.encoding=UTF-8
2 changes: 2 additions & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.rat-excludes
**/src/test/resources/test_command.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
*/
package org.apache.flume.channel.file;

import static org.apache.flume.channel.file.TestUtils.*;
import static org.apache.flume.channel.file.TestUtils.compareInputAndOut;
import static org.apache.flume.channel.file.TestUtils.consumeChannel;
import static org.apache.flume.channel.file.TestUtils.fillChannel;
import static org.apache.flume.channel.file.TestUtils.getAllLogs;

import com.google.common.collect.Maps;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import static org.apache.flume.channel.file.TestUtils.putWithoutCommit;
import static org.apache.flume.channel.file.TestUtils.takeEvents;
import static org.apache.flume.channel.file.TestUtils.takeWithoutCommit;
import static org.fest.reflect.core.Reflection.*;
import static org.fest.reflect.core.Reflection.field;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ private void commitPutsToPrimary() {
channelCounter.addToEventPutSuccessCount(putList.size());
}

// `queueLock` must not be held on blocking operations,
// and an approximate channel size is enough for the counter.
@SuppressWarnings("GuardedBy")
@Override
protected void doRollback() {
logger.debug("Rollback() of " + (takeCalled ? " Take Tx" : (putCalled ? " Put Tx" : "Empty Tx")));
Expand Down Expand Up @@ -729,6 +732,8 @@ public void configure(Context context) {
super.configure(context);
}

// the unguarded read of `memQueue` only detects whether the queue needs resizing
@SuppressWarnings("GuardedBy")
private void resizePrimaryQueue(int newMemoryCapacity) throws InterruptedException {
if (memQueue != null && memoryCapacity == newMemoryCapacity) {
return;
Expand Down Expand Up @@ -765,6 +770,8 @@ private void resizePrimaryQueue(int newMemoryCapacity) throws InterruptedExcepti
}
}

// an approximate channel size is enough for the counter
@SuppressWarnings("GuardedBy")
@Override
public synchronized void start() {
super.start();
Expand All @@ -779,6 +786,8 @@ public synchronized void start() {
channelCounter.setChannelSize(totalCount);
}

// an approximate channel size is enough for the counter
@SuppressWarnings("GuardedBy")
@Override
public synchronized void stop() {
if (getLifecycleState() == LifecycleState.STOP) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0

if [ $1 = "my_password_key" ]; then
echo "filtered";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0

echo "Error message from stderr" 1>&2
echo "Error message from stdout"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
package org.apache.flume.conf;

import static org.apache.flume.conf.FlumeConfigurationError.ErrorOrWarning.ERROR;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.util.Arrays;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
package org.apache.flume.conf;

import static org.apache.flume.conf.FlumeConfigurationError.ErrorOrWarning.ERROR;
import static org.apache.flume.conf.FlumeConfigurationErrorType.*;
import static org.apache.flume.conf.FlumeConfigurationErrorType.AGENT_CONFIGURATION_INVALID;
import static org.apache.flume.conf.FlumeConfigurationErrorType.AGENT_NAME_MISSING;
import static org.apache.flume.conf.FlumeConfigurationErrorType.CONFIG_ERROR;
import static org.apache.flume.conf.FlumeConfigurationErrorType.INVALID_PROPERTY;
import static org.apache.flume.conf.FlumeConfigurationErrorType.PROPERTY_NAME_NULL;
import static org.apache.flume.conf.FlumeConfigurationErrorType.PROPERTY_VALUE_NULL;
import static org.junit.Assert.assertEquals;

import java.util.HashMap;
Expand Down
4 changes: 0 additions & 4 deletions flume-ng-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${mvn-antrun-plugin.version}</version>
<executions>
<execution>
<id>generate-version</id>
Expand All @@ -213,7 +212,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${mvn-build-helper-plugin}</version>
<executions>
<execution>
<id>add-source</id>
Expand Down Expand Up @@ -246,7 +244,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${mvn-antrun-plugin.version}</version>
<executions>
<execution>
<id>generate-version</id>
Expand All @@ -269,7 +266,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${mvn-build-helper-plugin}</version>
<executions>
<execution>
<id>add-source</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ protected Event doTake() throws InterruptedException {
return event;
}

// `queueLock` must not be held on blocking operations,
// and an approximate channel size is sufficient for the counter.
@SuppressWarnings("GuardedBy")
@Override
protected void doCommit() throws InterruptedException {
int remainingChange = takeList.size() - putList.size();
Expand Down Expand Up @@ -158,6 +161,9 @@ protected void doCommit() throws InterruptedException {
channelCounter.setChannelSize(queue.size());
}

// `queueLock` must not be held on blocking operations
// and an approximate channel size is sufficient for the counter.
@SuppressWarnings("GuardedBy")
@Override
protected void doRollback() {
int takes = takeList.size();
Expand Down Expand Up @@ -218,6 +224,8 @@ public MemoryChannel() {
* <li>byteCapacityBufferPercentage = type int that defines the percent of buffer between byteCapacity and the estimated event size.
* <li>keep-alive = type int that defines the number of second to wait for a queue permit
*/
// the unguarded null check on `queue` only detects whether the channel was already configured
@SuppressWarnings("GuardedBy")
@Override
public void configure(Context context) {
Integer capacity = null;
Expand Down Expand Up @@ -347,6 +355,8 @@ private void resizeQueue(int capacity) throws InterruptedException {
}
}

// an approximate channel size is sufficient for the counter
@SuppressWarnings("GuardedBy")
@Override
public synchronized void start() {
channelCounter.start();
Expand All @@ -355,6 +365,8 @@ public synchronized void start() {
super.start();
}

// an approximate channel size is sufficient for the counter
@SuppressWarnings("GuardedBy")
@Override
public synchronized void stop() {
channelCounter.setChannelSize(queue.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static String dumpEvent(Event event, int maxBytes) {
}
String result = buffer.toString();
if (result.endsWith(EOL) && buffer.length() > EOL.length()) {
buffer.delete(buffer.length() - EOL.length(), buffer.length()).toString();
buffer.delete(buffer.length() - EOL.length(), buffer.length());
}
}
return "{ headers:" + event.getHeaders() + " body:" + buffer + " }";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
*/
package org.apache.flume.interceptor;

import static org.apache.flume.interceptor.HostInterceptor.Constants.*;
import static org.apache.flume.interceptor.HostInterceptor.Constants.HOST;
import static org.apache.flume.interceptor.HostInterceptor.Constants.HOST_HEADER;
import static org.apache.flume.interceptor.HostInterceptor.Constants.PRESERVE;
import static org.apache.flume.interceptor.HostInterceptor.Constants.PRESERVE_DFLT;
import static org.apache.flume.interceptor.HostInterceptor.Constants.USE_IP;
import static org.apache.flume.interceptor.HostInterceptor.Constants.USE_IP_DFLT;

import java.net.InetAddress;
import java.net.UnknownHostException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
*/
package org.apache.flume.interceptor;

import static org.apache.flume.interceptor.TimestampInterceptor.Constants.*;
import static org.apache.flume.interceptor.TimestampInterceptor.Constants.CONFIG_HEADER_NAME;
import static org.apache.flume.interceptor.TimestampInterceptor.Constants.CONFIG_PRESERVE;
import static org.apache.flume.interceptor.TimestampInterceptor.Constants.DEFAULT_HEADER_NAME;
import static org.apache.flume.interceptor.TimestampInterceptor.Constants.DEFAULT_PRESERVE;

import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
package org.apache.flume;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import com.google.common.collect.ImmutableMap;
import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.flume.exception.ChannelException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

public class TestMemoryChannel {
Expand Down Expand Up @@ -298,6 +299,8 @@ public void testByteCapacityAfterRollback() {
Assert.assertEquals(8, channel.getBytesRemainingValue());
}

@Test
@Ignore("TODO: document why this test is disabled and re-enable it.")
public void testByteCapacityBufferEmptyingAfterTakeCommit() {
Context context = new Context();
Map<String, String> parms = new HashMap<String, String>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public void testConcurrentSinksAndSources() throws InterruptedException {
final CountDownLatch startGate = new CountDownLatch(1);
final CountDownLatch endGate = new CountDownLatch(threadCount);

final Object takeMapLock = new Object();
// start a sink and source for each
for (int i = 0; i < threadCount / 2; i++) {
Thread t = new Thread() {
Expand Down Expand Up @@ -268,7 +269,6 @@ public void run() {
};
// start source
t.start();
final Integer takeMapLock = 0;
t = new Thread() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.apache.flume.source;

import static org.mockito.Mockito.*;
import static org.mockito.Mockito.spy;

import java.util.HashMap;
import org.apache.flume.Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
package org.apache.flume.source;

import static org.mockito.Mockito.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;

import org.apache.flume.Context;
import org.apache.flume.FlumeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
package org.apache.flume.tools;

import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
2 changes: 2 additions & 0 deletions flume-ng-instrumentation/flume-ganglia-monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<name>Flume Ganglia Monitor</name>

<properties>
<!-- This artifact was never released before -->
<bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing>
<!-- TODO fix spotbugs violations -->
<spotbugs.maxAllowedViolations>13</spotbugs.maxAllowedViolations>
<module.name>org.apache.flume.instrumentation.ganglia</module.name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# SPDX-License-Identifier: Apache-2.0
org.apache.flume.instrumentation.ganglia.GangliaServer
2 changes: 2 additions & 0 deletions flume-ng-instrumentation/flume-http-monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<name>Flume HTTP Monitor</name>

<properties>
<!-- This artifact was never released before -->
<bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing>
<!-- TODO fix spotbugs violations -->
<spotbugs.maxAllowedViolations>3</spotbugs.maxAllowedViolations>
<module.name>org.apache.flume.instrumentation.http</module.name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# SPDX-License-Identifier: Apache-2.0
org.apache.flume.instrumentation.http.HTTPMetricsServer
2 changes: 2 additions & 0 deletions flume-ng-instrumentation/flume-prometheus-monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<name>Flume Prometheus Monitor</name>

<properties>
<!-- This artifact was never released before -->
<bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing>
<!-- TODO fix spotbugs/pmd violations -->
<spotbugs.maxAllowedViolations>6</spotbugs.maxAllowedViolations>
<pmd.maxAllowedViolations>1</pmd.maxAllowedViolations>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# SPDX-License-Identifier: Apache-2.0
org.apache.flume.instrumentation.prometheus.PrometheusHTTPMetricsServer
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
*/
package org.apache.flume.node;

import static org.mockito.Mockito.*;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import com.google.common.collect.Lists;
import com.google.common.eventbus.EventBus;
Expand Down
2 changes: 2 additions & 0 deletions flume-ng-sources/flume-http-source/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<name>Flume HTTP Source</name>

<properties>
<!-- This artifact was never released before -->
<bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing>
<!-- TODO fix spotbugs/pmd violations -->
<spotbugs.maxAllowedViolations>10</spotbugs.maxAllowedViolations>
<pmd.maxAllowedViolations>2</pmd.maxAllowedViolations>
Expand Down
Loading
Loading