logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1419697 [15/17] - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/ api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j...
Date Mon, 10 Dec 2012 19:37:03 GMT
Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java Mon Dec 10 19:36:06 2012
@@ -33,7 +33,7 @@ import org.apache.logging.log4j.core.lay
 @Plugin(name = "Flume", type = "Core", elementType = "appender", printObject = true)
 public final class FlumeAppender extends AbstractAppender implements FlumeEventFactory {
 
-    private AbstractFlumeManager manager;
+    private final AbstractFlumeManager manager;
 
     private final String mdcIncludes;
     private final String mdcExcludes;
@@ -51,10 +51,10 @@ public final class FlumeAppender extends
 
     private final FlumeEventFactory factory;
 
-    private FlumeAppender(String name, Filter filter, Layout layout, boolean handleException,
-                          String includes, String excludes, String required, String mdcPrefix,
-                          String eventPrefix, boolean compress, int delay, int retries,
-                          FlumeEventFactory factory, AbstractFlumeManager manager) {
+    private FlumeAppender(final String name, final Filter filter, final Layout layout, final boolean handleException,
+                          final String includes, final String excludes, final String required, final String mdcPrefix,
+                          final String eventPrefix, final boolean compress, final int delay, final int retries,
+                          final FlumeEventFactory factory, final AbstractFlumeManager manager) {
         super(name, filter, layout, handleException);
         this.manager = manager;
         this.mdcIncludes = includes;
@@ -72,9 +72,9 @@ public final class FlumeAppender extends
      * Publish the event.
      * @param event The LogEvent.
      */
-    public void append(LogEvent event) {
+    public void append(final LogEvent event) {
 
-        FlumeEvent flumeEvent = factory.createEvent(event, mdcIncludes, mdcExcludes, mdcRequired, mdcPrefix,
+        final FlumeEvent flumeEvent = factory.createEvent(event, mdcIncludes, mdcExcludes, mdcRequired, mdcPrefix,
             eventPrefix, compressBody);
         flumeEvent.setBody(getLayout().toByteArray(flumeEvent));
         manager.send(flumeEvent, reconnectDelay, retries);
@@ -97,8 +97,8 @@ public final class FlumeAppender extends
      * @param compress If true the body will be compressed.
      * @return A Flume Event.
      */
-    public FlumeEvent createEvent(LogEvent event, String includes, String excludes, String required,
-                      String mdcPrefix, String eventPrefix, boolean compress) {
+    public FlumeEvent createEvent(final LogEvent event, final String includes, final String excludes, final String required,
+                      final String mdcPrefix, final String eventPrefix, final boolean compress) {
         return new FlumeEvent(event, mdcIncludes, mdcExcludes, mdcRequired, mdcPrefix,
             eventPrefix, compressBody);
     }
@@ -124,32 +124,32 @@ public final class FlumeAppender extends
      */
     @PluginFactory
     public static FlumeAppender createAppender(@PluginElement("agents") Agent[] agents,
-                                                   @PluginElement("properties") Property[] properties,
-                                                   @PluginAttr("embedded") String embedded,
-                                                   @PluginAttr("dataDir") String dataDir,
-                                                   @PluginAttr("reconnectionDelay") String delay,
-                                                   @PluginAttr("agentRetries") String agentRetries,
-                                                   @PluginAttr("name") String name,
-                                                   @PluginAttr("suppressExceptions") String suppress,
-                                                   @PluginAttr("mdcExcludes") String excludes,
-                                                   @PluginAttr("mdcIncludes") String includes,
-                                                   @PluginAttr("mdcRequired") String required,
-                                                   @PluginAttr("mdcPrefix") String mdcPrefix,
-                                                   @PluginAttr("eventPrefix") String eventPrefix,
-                                                   @PluginAttr("compress") String compressBody,
-                                                   @PluginAttr("batchSize") String batchSize,
-                                                   @PluginElement("flumeEventFactory") FlumeEventFactory factory,
+                                                   @PluginElement("properties") final Property[] properties,
+                                                   @PluginAttr("embedded") final String embedded,
+                                                   @PluginAttr("dataDir") final String dataDir,
+                                                   @PluginAttr("reconnectionDelay") final String delay,
+                                                   @PluginAttr("agentRetries") final String agentRetries,
+                                                   @PluginAttr("name") final String name,
+                                                   @PluginAttr("suppressExceptions") final String suppress,
+                                                   @PluginAttr("mdcExcludes") final String excludes,
+                                                   @PluginAttr("mdcIncludes") final String includes,
+                                                   @PluginAttr("mdcRequired") final String required,
+                                                   @PluginAttr("mdcPrefix") final String mdcPrefix,
+                                                   @PluginAttr("eventPrefix") final String eventPrefix,
+                                                   @PluginAttr("compress") final String compressBody,
+                                                   @PluginAttr("batchSize") final String batchSize,
+                                                   @PluginElement("flumeEventFactory") final FlumeEventFactory factory,
                                                    @PluginElement("layout") Layout layout,
-                                                   @PluginElement("filters") Filter filter) {
+                                                   @PluginElement("filters") final Filter filter) {
 
-        boolean embed = embedded != null ? Boolean.valueOf(embedded) :
+        final boolean embed = embedded != null ? Boolean.valueOf(embedded) :
             (agents == null || agents.length == 0) && properties != null && properties.length > 0;
-        boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
-        boolean compress = compressBody == null ? true : Boolean.valueOf(compressBody);
+        final boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
+        final boolean compress = compressBody == null ? true : Boolean.valueOf(compressBody);
 
-        int batchCount = batchSize == null ? 1 : Integer.parseInt(batchSize);
-        int reconnectDelay = delay == null ? 0 : Integer.parseInt(delay);
-        int retries = agentRetries == null ? 0 : Integer.parseInt(agentRetries);
+        final int batchCount = batchSize == null ? 1 : Integer.parseInt(batchSize);
+        final int reconnectDelay = delay == null ? 0 : Integer.parseInt(delay);
+        final int retries = agentRetries == null ? 0 : Integer.parseInt(agentRetries);
 
         if (layout == null) {
             layout = RFC5424Layout.createLayout(null, null, null, "True", null, null, null, null, excludes,

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAvroManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAvroManager.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAvroManager.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAvroManager.java Mon Dec 10 19:36:06 2012
@@ -66,7 +66,7 @@ public class FlumeAvroManager extends Ab
      * @param agents An array of Agents.
      * @param batchSize The number of evetns to include in a batch.
      */
-    protected FlumeAvroManager(String name, String shortName, Agent[] agents, int batchSize) {
+    protected FlumeAvroManager(final String name, final String shortName, final Agent[] agents, final int batchSize) {
         super(name);
         this.agents = agents;
         this.batchSize = batchSize;
@@ -79,7 +79,7 @@ public class FlumeAvroManager extends Ab
      * @param batchSize The number of events to include in a batch.
      * @return A FlumeAvroManager.
      */
-    public static FlumeAvroManager getManager(String name, Agent[] agents, int batchSize) {
+    public static FlumeAvroManager getManager(final String name, final Agent[] agents, int batchSize) {
         if (agents == null || agents.length == 0) {
             throw new IllegalArgumentException("At least one agent is required");
         }
@@ -88,9 +88,9 @@ public class FlumeAvroManager extends Ab
             batchSize = 1;
         }
 
-        StringBuilder sb = new StringBuilder("FlumeAvro[");
+        final StringBuilder sb = new StringBuilder("FlumeAvro[");
         boolean first = true;
-        for (Agent agent : agents) {
+        for (final Agent agent : agents) {
             if (!first) {
                 sb.append(",");
             }
@@ -118,22 +118,22 @@ public class FlumeAvroManager extends Ab
     }
 
     @Override
-    public synchronized void send(FlumeEvent event, int delay, int retries)  {
+    public synchronized void send(final FlumeEvent event, int delay, int retries)  {
         if (delay == 0) {
             delay = DEFAULT_RECONNECTION_DELAY;
         }
         if (retries == 0) {
             retries = DEFAULT_RECONNECTS;
         }
-        AvroFlumeEvent avroEvent = new AvroFlumeEvent();
+        final AvroFlumeEvent avroEvent = new AvroFlumeEvent();
         avroEvent.body = ByteBuffer.wrap(event.getBody());
         avroEvent.headers = new HashMap<CharSequence, CharSequence>();
 
-        for (Map.Entry<String, String> entry : event.getHeaders().entrySet()) {
+        for (final Map.Entry<String, String> entry : event.getHeaders().entrySet()) {
           avroEvent.headers.put(entry.getKey(), entry.getValue());
         }
 
-        List<AvroFlumeEvent> batch = batchSize > 1 ? events.addAndGet(avroEvent, batchSize) : null;
+        final List<AvroFlumeEvent> batch = batchSize > 1 ? events.addAndGet(avroEvent, batchSize) : null;
         if (batch == null && batchSize > 1) {
             return;
         }
@@ -144,13 +144,13 @@ public class FlumeAvroManager extends Ab
 
         do {
             try {
-                Status status = (batch == null) ? client.append(avroEvent) : client.appendBatch(batch);
+                final Status status = (batch == null) ? client.append(avroEvent) : client.appendBatch(batch);
                 if (!status.equals(Status.OK)) {
                     throw new AvroRemoteException("RPC communication failed to " + agents[current].getHost() +
                         ":" + agents[current].getPort());
                 }
                 return;
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 if (i == retries - 1) {
                     msg = "Error writing to " + getName() + " at " + agents[current].getHost() + ":" +
                         agents[current].getPort();
@@ -165,16 +165,16 @@ public class FlumeAvroManager extends Ab
             if (index == current) {
                 continue;
             }
-            Agent agent = agents[index];
+            final Agent agent = agents[index];
             i = 0;
             do {
                 try {
                     transceiver = null;
-                    AvroSourceProtocol c = connect(agent.getHost(), agent.getPort());
-                    Status status = (batch == null) ? c.append(avroEvent) : c.appendBatch(batch);
+                    final AvroSourceProtocol c = connect(agent.getHost(), agent.getPort());
+                    final Status status = (batch == null) ? c.append(avroEvent) : c.appendBatch(batch);
                     if (!status.equals(Status.OK)) {
                         if (i == retries - 1) {
-                            String warnMsg = "RPC communication failed to " + getName() + " at " +
+                            final String warnMsg = "RPC communication failed to " + getName() + " at " +
                                 agent.getHost() + ":" + agent.getPort();
                             LOGGER.warn(warnMsg);
                         }
@@ -183,9 +183,9 @@ public class FlumeAvroManager extends Ab
                     client = c;
                     current = i;
                     return;
-                } catch (Exception ex) {
+                } catch (final Exception ex) {
                     if (i == retries - 1) {
-                        String warnMsg = "Error writing to " + getName() + " at " + agent.getHost() + ":" +
+                        final String warnMsg = "Error writing to " + getName() + " at " + agent.getHost() + ":" +
                             agent.getPort();
                         LOGGER.warn(warnMsg, ex);
                         break;
@@ -199,10 +199,10 @@ public class FlumeAvroManager extends Ab
 
     }
 
-    private void sleep(int delay) {
+    private void sleep(final int delay) {
         try {
             Thread.sleep(delay);
-        } catch (InterruptedException ex) {
+        } catch (final InterruptedException ex) {
             Thread.currentThread().interrupt();
         }
     }
@@ -212,10 +212,10 @@ public class FlumeAvroManager extends Ab
      * @param agents The list of agents to choose from
      * @return The FlumeEventAvroServer.
      */
-    private AvroSourceProtocol connect(Agent[] agents) {
+    private AvroSourceProtocol connect(final Agent[] agents) {
         int i = 0;
-        for (Agent agent : agents) {
-            AvroSourceProtocol server = connect(agent.getHost(), agent.getPort());
+        for (final Agent agent : agents) {
+            final AvroSourceProtocol server = connect(agent.getHost(), agent.getPort());
             if (server != null) {
                 current = i;
                 return server;
@@ -225,18 +225,18 @@ public class FlumeAvroManager extends Ab
         throw new AppenderRuntimeException("Unable to connect to any agents");
     }
 
-    private AvroSourceProtocol connect(String hostname, int port) {
+    private AvroSourceProtocol connect(final String hostname, final int port) {
         try {
             if (transceiver == null) {
                 transceiver = new NettyTransceiver(new InetSocketAddress(hostname, port));
             }
-        } catch (IOException ioe) {
+        } catch (final IOException ioe) {
             LOGGER.error("Unable to create transceiver", ioe);
             return null;
         }
         try {
             return SpecificRequestor.getClient(AvroSourceProtocol.class, transceiver);
-        } catch (IOException ioe) {
+        } catch (final IOException ioe) {
             LOGGER.error("Unable to create Avro client");
             return null;
         }
@@ -247,7 +247,7 @@ public class FlumeAvroManager extends Ab
         if (transceiver != null) {
             try {
                 transceiver.close();
-            } catch (IOException ioe) {
+            } catch (final IOException ioe) {
                 LOGGER.error("Attempt to clean up Avro transceiver failed", ioe);
             }
         }
@@ -259,10 +259,10 @@ public class FlumeAvroManager extends Ab
      */
     private static class EventList extends ArrayList<AvroFlumeEvent> {
 
-        public synchronized List<AvroFlumeEvent> addAndGet(AvroFlumeEvent event, int batchSize) {
+        public synchronized List<AvroFlumeEvent> addAndGet(final AvroFlumeEvent event, final int batchSize) {
             super.add(event);
             if (this.size() >= batchSize) {
-                List<AvroFlumeEvent> events = new ArrayList<AvroFlumeEvent>();
+                final List<AvroFlumeEvent> events = new ArrayList<AvroFlumeEvent>();
                 events.addAll(this);
                 clear();
                 return events;
@@ -276,9 +276,9 @@ public class FlumeAvroManager extends Ab
      * Factory data.
      */
     private static class FactoryData {
-        private String name;
-        private Agent[] agents;
-        private int batchSize;
+        private final String name;
+        private final Agent[] agents;
+        private final int batchSize;
 
         /**
          * Constructor.
@@ -286,7 +286,7 @@ public class FlumeAvroManager extends Ab
          * @param agents The agents.
          * @param batchSize The number of events to include in a batch.
          */
-        public FactoryData(String name, Agent[] agents, int batchSize) {
+        public FactoryData(final String name, final Agent[] agents, final int batchSize) {
             this.name = name;
             this.agents = agents;
             this.batchSize = batchSize;
@@ -304,11 +304,11 @@ public class FlumeAvroManager extends Ab
          * @param data The data required to create the entity.
          * @return The FlumeAvroManager.
          */
-        public FlumeAvroManager createManager(String name, FactoryData data) {
+        public FlumeAvroManager createManager(final String name, final FactoryData data) {
             try {
 
                 return new FlumeAvroManager(name, data.name, data.agents, data.batchSize);
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 LOGGER.error("Could not create FlumeAvroManager", ex);
             }
             return null;

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeConfigurationBuilder.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeConfigurationBuilder.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeConfigurationBuilder.java Mon Dec 10 19:36:06 2012
@@ -70,16 +70,16 @@ public class FlumeConfigurationBuilder {
     private final SourceFactory sourceFactory = new DefaultSourceFactory();
     private final SinkFactory sinkFactory = new DefaultSinkFactory();
 
-    public NodeConfiguration load(String name, Properties props, NodeConfigurationAware configurationAware) {
-        NodeConfiguration conf = new SimpleNodeConfiguration();
+    public NodeConfiguration load(final String name, final Properties props, final NodeConfigurationAware configurationAware) {
+        final NodeConfiguration conf = new SimpleNodeConfiguration();
         FlumeConfiguration fconfig;
         try {
             fconfig = new FlumeConfiguration(props);
-            List<FlumeConfigurationError> errors = fconfig.getConfigurationErrors();
+            final List<FlumeConfigurationError> errors = fconfig.getConfigurationErrors();
             if (errors.size() > 0) {
                 boolean isError = false;
-                for (FlumeConfigurationError error : errors) {
-                    StringBuilder sb = new StringBuilder();
+                for (final FlumeConfigurationError error : errors) {
+                    final StringBuilder sb = new StringBuilder();
                     sb.append("Component: ").append(error.getComponentName()).append(" ");
                     sb.append("Key: ").append(error.getKey()).append(" ");
                     sb.append(error.getErrorType().name()).append(" - ").append(error.getErrorType().getError());
@@ -97,12 +97,12 @@ public class FlumeConfigurationBuilder {
                     throw new ConfigurationException("Unable to configure Flume due to errors");
                 }
             }
-        } catch (RuntimeException ex) {
+        } catch (final RuntimeException ex) {
             printProps(props);
             throw ex;
         }
 
-        FlumeConfiguration.AgentConfiguration agentConf = fconfig.getConfigurationFor(name);
+        final FlumeConfiguration.AgentConfiguration agentConf = fconfig.getConfigurationFor(name);
 
         if (agentConf != null) {
 
@@ -117,20 +117,20 @@ public class FlumeConfigurationBuilder {
         return conf;
     }
 
-    private void printProps(Properties props) {
-        for (String key : new TreeSet<String>(props.stringPropertyNames())) {
+    private void printProps(final Properties props) {
+        for (final String key : new TreeSet<String>(props.stringPropertyNames())) {
             LOGGER.error(key + "=" + props.getProperty(key));
         }
     }
 
-    protected void loadChannels(FlumeConfiguration.AgentConfiguration agentConf, NodeConfiguration conf) {
+    protected void loadChannels(final FlumeConfiguration.AgentConfiguration agentConf, final NodeConfiguration conf) {
         LOGGER.info("Creating channels");
-        Set<String> channels = agentConf.getChannelSet();
-        Map<String, ComponentConfiguration> compMap = agentConf.getChannelConfigMap();
-        for (String chName : channels) {
-            ComponentConfiguration comp = compMap.get(chName);
+        final Set<String> channels = agentConf.getChannelSet();
+        final Map<String, ComponentConfiguration> compMap = agentConf.getChannelConfigMap();
+        for (final String chName : channels) {
+            final ComponentConfiguration comp = compMap.get(chName);
             if (comp != null) {
-                Channel channel = channelFactory.create(comp.getComponentName(), comp.getType());
+                final Channel channel = channelFactory.create(comp.getComponentName(), comp.getType());
 
                 Configurables.configure(channel, comp);
 
@@ -138,10 +138,10 @@ public class FlumeConfigurationBuilder {
             }
         }
 
-        for (String ch : channels) {
-            Context context = agentConf.getChannelContext().get(ch);
+        for (final String ch : channels) {
+            final Context context = agentConf.getChannelContext().get(ch);
             if (context != null) {
-                Channel channel = channelFactory.create(ch, context.getString(BasicConfigurationConstants.CONFIG_TYPE));
+                final Channel channel = channelFactory.create(ch, context.getString(BasicConfigurationConstants.CONFIG_TYPE));
                 Configurables.configure(channel, context);
                 conf.getChannels().put(ch, channel);
                 LOGGER.info("created channel " + ch);
@@ -149,54 +149,54 @@ public class FlumeConfigurationBuilder {
         }
     }
 
-    protected void loadSources(FlumeConfiguration.AgentConfiguration agentConf, NodeConfiguration conf) {
+    protected void loadSources(final FlumeConfiguration.AgentConfiguration agentConf, final NodeConfiguration conf) {
 
-        Set<String> sources = agentConf.getSourceSet();
-        Map<String, ComponentConfiguration> compMap = agentConf.getSourceConfigMap();
-        for (String sourceName : sources) {
-            ComponentConfiguration comp = compMap.get(sourceName);
+        final Set<String> sources = agentConf.getSourceSet();
+        final Map<String, ComponentConfiguration> compMap = agentConf.getSourceConfigMap();
+        for (final String sourceName : sources) {
+            final ComponentConfiguration comp = compMap.get(sourceName);
             if (comp != null) {
-                SourceConfiguration config = (SourceConfiguration) comp;
+                final SourceConfiguration config = (SourceConfiguration) comp;
 
-                Source source = sourceFactory.create(comp.getComponentName(), comp.getType());
+                final Source source = sourceFactory.create(comp.getComponentName(), comp.getType());
 
                 Configurables.configure(source, config);
-                Set<String> channelNames = config.getChannels();
-                List<Channel> channels = new ArrayList<Channel>();
-                for (String chName : channelNames) {
+                final Set<String> channelNames = config.getChannels();
+                final List<Channel> channels = new ArrayList<Channel>();
+                for (final String chName : channelNames) {
                     channels.add(conf.getChannels().get(chName));
                 }
 
-                ChannelSelectorConfiguration selectorConfig = config.getSelectorConfiguration();
+                final ChannelSelectorConfiguration selectorConfig = config.getSelectorConfiguration();
 
-                ChannelSelector selector = ChannelSelectorFactory.create(channels, selectorConfig);
+                final ChannelSelector selector = ChannelSelectorFactory.create(channels, selectorConfig);
 
-                ChannelProcessor channelProcessor = new ChannelProcessor(selector);
+                final ChannelProcessor channelProcessor = new ChannelProcessor(selector);
                 Configurables.configure(channelProcessor, config);
 
                 source.setChannelProcessor(channelProcessor);
                 conf.getSourceRunners().put(comp.getComponentName(), SourceRunner.forSource(source));
             }
         }
-        Map<String, Context> sourceContexts = agentConf.getSourceContext();
+        final Map<String, Context> sourceContexts = agentConf.getSourceContext();
 
-        for (String src : sources) {
-            Context context = sourceContexts.get(src);
+        for (final String src : sources) {
+            final Context context = sourceContexts.get(src);
             if (context != null){
-                Source source = sourceFactory.create(src, context.getString(BasicConfigurationConstants.CONFIG_TYPE));
-                List<Channel> channels = new ArrayList<Channel>();
+                final Source source = sourceFactory.create(src, context.getString(BasicConfigurationConstants.CONFIG_TYPE));
+                final List<Channel> channels = new ArrayList<Channel>();
                 Configurables.configure(source, context);
-                String[] channelNames = context.getString(BasicConfigurationConstants.CONFIG_CHANNELS).split("\\s+");
-                for (String chName : channelNames) {
+                final String[] channelNames = context.getString(BasicConfigurationConstants.CONFIG_CHANNELS).split("\\s+");
+                for (final String chName : channelNames) {
                     channels.add(conf.getChannels().get(chName));
                 }
 
-                Map<String, String> selectorConfig = context.getSubProperties(
+                final Map<String, String> selectorConfig = context.getSubProperties(
                     BasicConfigurationConstants.CONFIG_SOURCE_CHANNELSELECTOR_PREFIX);
 
-                ChannelSelector selector = ChannelSelectorFactory.create(channels, selectorConfig);
+                final ChannelSelector selector = ChannelSelectorFactory.create(channels, selectorConfig);
 
-                ChannelProcessor channelProcessor = new ChannelProcessor(selector);
+                final ChannelProcessor channelProcessor = new ChannelProcessor(selector);
                 Configurables.configure(channelProcessor, context);
 
                 source.setChannelProcessor(channelProcessor);
@@ -205,15 +205,15 @@ public class FlumeConfigurationBuilder {
         }
     }
 
-    protected void loadSinks(FlumeConfiguration.AgentConfiguration agentConf, NodeConfiguration conf) {
-        Set<String> sinkNames = agentConf.getSinkSet();
-        Map<String, ComponentConfiguration> compMap = agentConf.getSinkConfigMap();
-        Map<String, Sink> sinks = new HashMap<String, Sink>();
-        for (String sinkName : sinkNames) {
-            ComponentConfiguration comp = compMap.get(sinkName);
+    protected void loadSinks(final FlumeConfiguration.AgentConfiguration agentConf, final NodeConfiguration conf) {
+        final Set<String> sinkNames = agentConf.getSinkSet();
+        final Map<String, ComponentConfiguration> compMap = agentConf.getSinkConfigMap();
+        final Map<String, Sink> sinks = new HashMap<String, Sink>();
+        for (final String sinkName : sinkNames) {
+            final ComponentConfiguration comp = compMap.get(sinkName);
             if (comp != null) {
-                SinkConfiguration config = (SinkConfiguration) comp;
-                Sink sink = sinkFactory.create(comp.getComponentName(), comp.getType());
+                final SinkConfiguration config = (SinkConfiguration) comp;
+                final Sink sink = sinkFactory.create(comp.getComponentName(), comp.getType());
 
                 Configurables.configure(sink, config);
 
@@ -222,11 +222,11 @@ public class FlumeConfigurationBuilder {
             }
         }
 
-        Map<String, Context> sinkContexts = agentConf.getSinkContext();
-        for (String sinkName : sinkNames) {
-            Context context = sinkContexts.get(sinkName);
+        final Map<String, Context> sinkContexts = agentConf.getSinkContext();
+        for (final String sinkName : sinkNames) {
+            final Context context = sinkContexts.get(sinkName);
             if (context != null) {
-                Sink sink = sinkFactory.create(sinkName, context.getString(BasicConfigurationConstants.CONFIG_TYPE));
+                final Sink sink = sinkFactory.create(sinkName, context.getString(BasicConfigurationConstants.CONFIG_TYPE));
                 Configurables.configure(sink, context);
 
                 sink.setChannel(conf.getChannels().get(context.getString(BasicConfigurationConstants.CONFIG_CHANNEL)));
@@ -237,21 +237,21 @@ public class FlumeConfigurationBuilder {
         loadSinkGroups(agentConf, sinks, conf);
     }
 
-    protected void loadSinkGroups(FlumeConfiguration.AgentConfiguration agentConf,
-                                  Map<String, Sink> sinks, NodeConfiguration conf) {
-        Set<String> sinkgroupNames = agentConf.getSinkgroupSet();
-        Map<String, ComponentConfiguration> compMap = agentConf.getSinkGroupConfigMap();
-        Map<String, String> usedSinks = new HashMap<String, String>();
-        for (String groupName : sinkgroupNames) {
-            ComponentConfiguration comp = compMap.get(groupName);
+    protected void loadSinkGroups(final FlumeConfiguration.AgentConfiguration agentConf,
+                                  final Map<String, Sink> sinks, final NodeConfiguration conf) {
+        final Set<String> sinkgroupNames = agentConf.getSinkgroupSet();
+        final Map<String, ComponentConfiguration> compMap = agentConf.getSinkGroupConfigMap();
+        final Map<String, String> usedSinks = new HashMap<String, String>();
+        for (final String groupName : sinkgroupNames) {
+            final ComponentConfiguration comp = compMap.get(groupName);
             if (comp != null) {
-                SinkGroupConfiguration groupConf = (SinkGroupConfiguration) comp;
-                List<String> groupSinkList = groupConf.getSinks();
-                List<Sink> groupSinks = new ArrayList<Sink>();
-                for (String sink : groupSinkList) {
-                    Sink s = sinks.remove(sink);
+                final SinkGroupConfiguration groupConf = (SinkGroupConfiguration) comp;
+                final List<String> groupSinkList = groupConf.getSinks();
+                final List<Sink> groupSinks = new ArrayList<Sink>();
+                for (final String sink : groupSinkList) {
+                    final Sink s = sinks.remove(sink);
                     if (s == null) {
-                        String sinkUser = usedSinks.get(sink);
+                        final String sinkUser = usedSinks.get(sink);
                         if (sinkUser != null) {
                             throw new ConfigurationException(String.format(
                                 "Sink %s of group %s already in use by group %s", sink, groupName, sinkUser));
@@ -264,16 +264,16 @@ public class FlumeConfigurationBuilder {
                     groupSinks.add(s);
                     usedSinks.put(sink, groupName);
                 }
-                SinkGroup group = new SinkGroup(groupSinks);
+                final SinkGroup group = new SinkGroup(groupSinks);
                 Configurables.configure(group, groupConf);
                 conf.getSinkRunners().put(comp.getComponentName(), new SinkRunner(group.getProcessor()));
             }
         }
         // add any unasigned sinks to solo collectors
-        for (Map.Entry<String, Sink> entry : sinks.entrySet()) {
+        for (final Map.Entry<String, Sink> entry : sinks.entrySet()) {
             if (!usedSinks.containsValue(entry.getKey())) {
-                SinkProcessor pr = new DefaultSinkProcessor();
-                List<Sink> sinkMap = new ArrayList<Sink>();
+                final SinkProcessor pr = new DefaultSinkProcessor();
+                final List<Sink> sinkMap = new ArrayList<Sink>();
                 sinkMap.add(entry.getValue());
                 pr.setSinks(sinkMap);
                 Configurables.configure(pr, new Context());

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java Mon Dec 10 19:36:06 2012
@@ -54,11 +54,11 @@ public class FlumeEmbeddedManager extend
      * @param name The unique name of this manager.
      * @param node The Flume Node.
      */
-    protected FlumeEmbeddedManager(String name, String shortName, FlumeNode node) {
+    protected FlumeEmbeddedManager(final String name, final String shortName, final FlumeNode node) {
         super(name);
         this.node = node;
         this.shortName = shortName;
-        SourceRunner runner = node.getConfiguration().getSourceRunners().get(SOURCE_NAME);
+        final SourceRunner runner = node.getConfiguration().getSourceRunners().get(SOURCE_NAME);
         if (runner == null || runner.getSource() == null) {
             throw new IllegalStateException("No Source has been created for Appender " + shortName);
         }
@@ -71,8 +71,8 @@ public class FlumeEmbeddedManager extend
      * @param batchSize The number of events to include in a batch.
      * @return A FlumeAvroManager.
      */
-    public static FlumeEmbeddedManager getManager(String name, Agent[] agents, Property[] properties, int batchSize,
-                                                  String dataDir) {
+    public static FlumeEmbeddedManager getManager(final String name, final Agent[] agents, final Property[] properties, int batchSize,
+                                                  final String dataDir) {
 
         if (batchSize <= 0) {
             batchSize = 1;
@@ -84,12 +84,12 @@ public class FlumeEmbeddedManager extend
             throw new IllegalArgumentException("Cannot configure both Agents and Properties.");
         }
 
-        StringBuilder sb = new StringBuilder();
+        final StringBuilder sb = new StringBuilder();
         boolean first = true;
 
         if (agents != null && agents.length > 0) {
             sb.append("FlumeEmbedded[");
-            for (Agent agent : agents) {
+            for (final Agent agent : agents) {
                 if (!first) {
                     sb.append(",");
                 }
@@ -100,26 +100,26 @@ public class FlumeEmbeddedManager extend
         } else {
             String sep = "";
             sb.append(name).append(":");
-            StringBuilder props = new StringBuilder();
-            for (Property prop : properties) {
+            final StringBuilder props = new StringBuilder();
+            for (final Property prop : properties) {
                 props.append(sep);
                 props.append(prop.getName()).append("=").append(prop.getValue());
                 sep = ",";
             }
             try {
-                MessageDigest digest = MessageDigest.getInstance("MD5");
+                final MessageDigest digest = MessageDigest.getInstance("MD5");
                 digest.update(sb.toString().getBytes());
-                byte[] bytes = digest.digest();
-                StringBuilder md5 = new StringBuilder();
-                for (byte b : bytes) {
-                    String hex = Integer.toHexString(0xff & b);
+                final byte[] bytes = digest.digest();
+                final StringBuilder md5 = new StringBuilder();
+                for (final byte b : bytes) {
+                    final String hex = Integer.toHexString(0xff & b);
                     if (hex.length() == 1) {
                         md5.append('0');
                     }
                     md5.append(hex);
                 }
                 sb.append(md5.toString());
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 sb.append(props);
             }
         }
@@ -128,7 +128,7 @@ public class FlumeEmbeddedManager extend
     }
 
     @Override
-    public void send(FlumeEvent event, int delay, int retries) {
+    public void send(final FlumeEvent event, final int delay, final int retries) {
         source.send(event);
     }
 
@@ -141,11 +141,11 @@ public class FlumeEmbeddedManager extend
      * Factory data.
      */
     private static class FactoryData {
-        private Agent[] agents;
-        private Property[] properties;
-        private int batchSize;
-        private String dataDir;
-        private String name;
+        private final Agent[] agents;
+        private final Property[] properties;
+        private final int batchSize;
+        private final String dataDir;
+        private final String name;
 
         /**
          * Constructor.
@@ -155,7 +155,7 @@ public class FlumeEmbeddedManager extend
          * @param batchSize The number of events to include in a batch.
          * @param dataDir The directory where Flume should write to.
          */
-        public FactoryData(String name, Agent[] agents, Property[] properties, int batchSize, String dataDir) {
+        public FactoryData(final String name, final Agent[] agents, final Property[] properties, final int batchSize, final String dataDir) {
             this.name = name;
             this.agents = agents;
             this.batchSize = batchSize;
@@ -176,29 +176,29 @@ public class FlumeEmbeddedManager extend
          * @param data The data required to create the entity.
          * @return The FlumeAvroManager.
          */
-        public FlumeEmbeddedManager createManager(String name, FactoryData data) {
+        public FlumeEmbeddedManager createManager(final String name, final FactoryData data) {
             try {
-                DefaultLogicalNodeManager nodeManager = new DefaultLogicalNodeManager();
-                Properties props = createProperties(data.name, data.agents, data.properties, data.batchSize,
+                final DefaultLogicalNodeManager nodeManager = new DefaultLogicalNodeManager();
+                final Properties props = createProperties(data.name, data.agents, data.properties, data.batchSize,
                     data.dataDir);
-                FlumeConfigurationBuilder builder = new FlumeConfigurationBuilder();
-                NodeConfiguration conf = builder.load(data.name, props, nodeManager);
+                final FlumeConfigurationBuilder builder = new FlumeConfigurationBuilder();
+                final NodeConfiguration conf = builder.load(data.name, props, nodeManager);
 
-                FlumeNode node = new FlumeNode(nodeManager, conf);
+                final FlumeNode node = new FlumeNode(nodeManager, conf);
 
                 node.start();
                 LifecycleController.waitForOneOf(node, LifecycleState.START_OR_ERROR);
 
                 return new FlumeEmbeddedManager(name, data.name, node);
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 LOGGER.error("Could not create FlumeEmbeddedManager", ex);
             }
             return null;
         }
 
-        private Properties createProperties(String name, Agent[] agents, Property[] properties, int batchSize,
+        private Properties createProperties(final String name, final Agent[] agents, final Property[] properties, final int batchSize,
                                             String dataDir) {
-            Properties props = new Properties();
+            final Properties props = new Properties();
 
             if ((agents == null || agents.length == 0) && (properties == null || properties.length == 0)) {
                 LOGGER.error("No Flume configuration provided");
@@ -224,13 +224,13 @@ public class FlumeEmbeddedManager extend
                     props.put(name + ".channels.file.dataDirs", dataDir + "data");
                 }
 
-                StringBuilder sb = new StringBuilder();
+                final StringBuilder sb = new StringBuilder();
                 String leading = "";
                 int priority = agents.length;
                 for (int i=0; i < agents.length; ++i) {
                     sb.append(leading).append("agent").append(i);
                     leading = " ";
-                    String prefix = name + ".sinks.agent" + i;
+                    final String prefix = name + ".sinks.agent" + i;
                     props.put(prefix + ".channel", "file");
                     props.put(prefix + ".type", "avro");
                     props.put(prefix + ".hostname", agents[i].getHost());
@@ -243,7 +243,7 @@ public class FlumeEmbeddedManager extend
                 props.put(name + ".sinkgroups", "group1");
                 props.put(name + ".sinkgroups.group1.sinks", sb.toString());
                 props.put(name + ".sinkgroups.group1.processor.type", "failover");
-                String sourceChannels = "file";
+                final String sourceChannels = "file";
                 props.put(name + ".channels", sourceChannels);
                 props.put(name + ".sources." + FlumeEmbeddedManager.SOURCE_NAME + ".channels", sourceChannels);
             } else {
@@ -253,32 +253,32 @@ public class FlumeEmbeddedManager extend
                 props.put(name + ".sources", FlumeEmbeddedManager.SOURCE_NAME);
                 props.put(name + ".sources." + FlumeEmbeddedManager.SOURCE_NAME + ".type", sourceType);
 
-                for (Property property : properties) {
-                    String key = property.getName();
+                for (final Property property : properties) {
+                    final String key = property.getName();
 
                     if (key == null || key.length() == 0) {
-                        String msg = "A property name must be provided";
+                        final String msg = "A property name must be provided";
                         LOGGER.error(msg);
                         throw new ConfigurationException(msg);
                     }
 
-                    String upperKey = key.toUpperCase(Locale.ENGLISH);
+                    final String upperKey = key.toUpperCase(Locale.ENGLISH);
 
                     if (upperKey.startsWith(name.toUpperCase(Locale.ENGLISH))) {
-                        String msg = "Specification of the agent name is allowed in Flume Appender configuration: " + key;
+                        final String msg = "Specification of the agent name is allowed in Flume Appender configuration: " + key;
                         LOGGER.error(msg);
                         throw new ConfigurationException(msg);
                     }
 
                     if (upperKey.startsWith("SOURCES.")) {
-                        String msg = "Specification of Sources is not allowed in Flume Appender: " + key;
+                        final String msg = "Specification of Sources is not allowed in Flume Appender: " + key;
                         LOGGER.error(msg);
                         throw new ConfigurationException(msg);
                     }
 
-                    String value = property.getValue();
+                    final String value = property.getValue();
                     if (value == null || value.length() == 0) {
-                        String msg = "A value for property " + key + " must be provided";
+                        final String msg = "A value for property " + key + " must be provided";
                         LOGGER.error(msg);
                         throw new ConfigurationException(msg);
                     }
@@ -302,7 +302,7 @@ public class FlumeEmbeddedManager extend
                 props.put(name + ".sources." + FlumeEmbeddedManager.SOURCE_NAME + ".channels", sourceChannels);
 
                 if (sinks == null || sinks.length == 0) {
-                    String msg = "At least one Sink must be specified";
+                    final String msg = "At least one Sink must be specified";
                     LOGGER.error(msg);
                     throw new ConfigurationException(msg);
                 }

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java Mon Dec 10 19:36:06 2012
@@ -70,11 +70,11 @@ public class FlumeEvent extends SimpleEv
      * @param eventPrefix The value to prefix to event keys.
      * @param compress If true the event body should be compressed.
      */
-    public FlumeEvent(LogEvent event, String includes, String excludes, String required,
-                      String mdcPrefix, String eventPrefix, boolean compress) {
+    public FlumeEvent(final LogEvent event, final String includes, final String excludes, final String required,
+                      String mdcPrefix, String eventPrefix, final boolean compress) {
         this.event = event;
         this.compress = compress;
-        Map<String, String> headers = getHeaders();
+        final Map<String, String> headers = getHeaders();
         headers.put(TIMESTAMP, Long.toString(event.getMillis()));
         if (mdcPrefix == null) {
             mdcPrefix = DEFAULT_MDC_PREFIX;
@@ -82,9 +82,9 @@ public class FlumeEvent extends SimpleEv
         if (eventPrefix == null) {
             eventPrefix = DEFAULT_EVENT_PREFIX;
         }
-        Map<String, String> mdc = event.getContextMap();
+        final Map<String, String> mdc = event.getContextMap();
         if (includes != null) {
-            String[] array = includes.split(",");
+            final String[] array = includes.split(",");
             if (array.length > 0) {
                 for (String str : array) {
                     str = str.trim();
@@ -94,13 +94,13 @@ public class FlumeEvent extends SimpleEv
                 }
             }
         } else if (excludes != null) {
-            String[] array = excludes.split(",");
+            final String[] array = excludes.split(",");
             if (array.length > 0) {
-                List<String> list = new ArrayList<String>(array.length);
-                for (String value : array) {
+                final List<String> list = new ArrayList<String>(array.length);
+                for (final String value : array) {
                     list.add(value.trim());
                 }
-                for (Map.Entry<String, String> entry : mdc.entrySet()) {
+                for (final Map.Entry<String, String> entry : mdc.entrySet()) {
                     if (!list.contains(entry.getKey())) {
                         ctx.put(entry.getKey(), entry.getValue());
                     }
@@ -111,7 +111,7 @@ public class FlumeEvent extends SimpleEv
         }
 
         if (required != null) {
-            String[] array = required.split(",");
+            final String[] array = required.split(",");
             if (array.length > 0) {
                 for (String str : array) {
                     str = str.trim();
@@ -121,7 +121,7 @@ public class FlumeEvent extends SimpleEv
                 }
             }
         }
-        Message message = event.getMessage();
+        final Message message = event.getMessage();
         if (message instanceof MapMessage) {
             if (message instanceof StructuredDataMessage) {
                 addStructuredData(eventPrefix, headers, (StructuredDataMessage) message);
@@ -134,28 +134,28 @@ public class FlumeEvent extends SimpleEv
         addGuid(headers);
     }
 
-    protected void addStructuredData(String prefix, Map<String, String> fields, StructuredDataMessage msg) {
+    protected void addStructuredData(final String prefix, final Map<String, String> fields, final StructuredDataMessage msg) {
         fields.put(prefix + EVENT_TYPE, msg.getType());
-        StructuredDataId id = msg.getId();
+        final StructuredDataId id = msg.getId();
         fields.put(prefix + EVENT_ID, id.getName());
     }
 
-    protected void addMapData(String prefix, Map<String, String> fields, MapMessage msg) {
-        Map<String, String> data = msg.getData();
-        for (Map.Entry<String, String> entry : data.entrySet()) {
+    protected void addMapData(final String prefix, final Map<String, String> fields, final MapMessage msg) {
+        final Map<String, String> data = msg.getData();
+        for (final Map.Entry<String, String> entry : data.entrySet()) {
             fields.put(prefix + entry.getKey(), entry.getValue());
         }
     }
 
-    protected void addContextData(String prefix, Map<String, String> fields, Map<String, String> context) {
-        for (Map.Entry<String, String> entry : context.entrySet()) {
+    protected void addContextData(final String prefix, final Map<String, String> fields, final Map<String, String> context) {
+        for (final Map.Entry<String, String> entry : context.entrySet()) {
             if (entry.getKey() != null && entry.getValue() != null) {
                 fields.put(prefix + entry.getKey(), entry.getValue());
             }
         }
     }
 
-    protected void addGuid(Map<String, String> fields) {
+    protected void addGuid(final Map<String, String> fields) {
         fields.put(GUID, UUIDUtil.getTimeBasedUUID().toString());
     }
 
@@ -164,18 +164,18 @@ public class FlumeEvent extends SimpleEv
      * @param body The body to add to the event.
      */
     @Override
-    public void setBody(byte[] body) {
+    public void setBody(final byte[] body) {
         if (body == null || body.length == 0) {
             super.setBody(new byte[0]);
             return;
         }
         if (compress) {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
             try {
-                GZIPOutputStream os = new GZIPOutputStream(baos);
+                final GZIPOutputStream os = new GZIPOutputStream(baos);
                 os.write(body);
                 os.close();
-            } catch (IOException ioe) {
+            } catch (final IOException ioe) {
                 throw new LoggingException("Unable to compress message", ioe);
             }
             super.setBody(baos.toByteArray());

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeNode.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeNode.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeNode.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeNode.java Mon Dec 10 19:36:06 2012
@@ -37,7 +37,7 @@ public class FlumeNode implements Lifecy
     private final LifecycleSupervisor supervisor;
     private final NodeConfiguration conf;
 
-    public FlumeNode(NodeManager manager, NodeConfiguration conf) {
+    public FlumeNode(final NodeManager manager, final NodeConfiguration conf) {
         this.nodeManager = manager;
         this.conf =conf;
         supervisor = new LifecycleSupervisor();

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Log4jEventSource.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Log4jEventSource.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Log4jEventSource.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Log4jEventSource.java Mon Dec 10 19:36:06 2012
@@ -28,7 +28,7 @@ import org.slf4j.Logger;
  */
 public class Log4jEventSource extends AbstractSource implements EventDrivenSource {
 
-    private SourceCounter sourceCounter = new SourceCounter("log4j");
+    private final SourceCounter sourceCounter = new SourceCounter("log4j");
 
     private static final Logger logger = LoggerFactory.getLogger(Log4jEventSource.class);
 
@@ -51,12 +51,12 @@ public class Log4jEventSource extends Ab
     }
 
 
-    public void send(FlumeEvent event) {
+    public void send(final FlumeEvent event) {
         sourceCounter.incrementAppendReceivedCount();
         sourceCounter.incrementEventReceivedCount();
         try {
             getChannelProcessor().processEvent(event);
-        } catch (ChannelException ex) {
+        } catch (final ChannelException ex) {
             logger.warn("Unabled to process event {}" + event, ex);
             throw ex;
         }

Modified: logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeAppenderTest.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeAppenderTest.java Mon Dec 10 19:36:06 2012
@@ -95,16 +95,16 @@ public class FlumeAppenderTest {
         * only hitting the Avro appender.
         */
         removeAppenders(avroLogger);
-        Context context = new Context();
+        final Context context = new Context();
         testPort = String.valueOf(testServerPort);
         context.put("port", testPort);
         context.put("bind", "0.0.0.0");
         Configurables.configure(eventSource, context);
 
-        List<Channel> channels = new ArrayList<Channel>();
+        final List<Channel> channels = new ArrayList<Channel>();
         channels.add(channel);
 
-        ChannelSelector cs = new ReplicatingChannelSelector();
+        final ChannelSelector cs = new ReplicatingChannelSelector();
         cs.setChannels(channels);
 
         eventSource.setChannelProcessor(new ChannelProcessor(cs));
@@ -128,8 +128,8 @@ public class FlumeAppenderTest {
 
     @Test
     public void testLog4jAvroAppender() throws InterruptedException, IOException {
-        Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
-        FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
+        final Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
+        final FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
             "false", null, null, null, null, null, "true", "1", null, null, null);
         avroAppender.start();
         avroLogger.addAppender(avroAppender);
@@ -139,10 +139,10 @@ public class FlumeAppenderTest {
 
         avroLogger.info("Test message");
 
-        Transaction transaction = channel.getTransaction();
+        final Transaction transaction = channel.getTransaction();
         transaction.begin();
 
-        Event event = channel.take();
+        final Event event = channel.take();
    	    Assert.assertNotNull(event);
   	    Assert.assertTrue("Channel contained event, but not expected message",
             getBody(event).endsWith("Test message"));
@@ -154,16 +154,16 @@ public class FlumeAppenderTest {
 
     @Test
     public void testStructured() throws InterruptedException, IOException {
-        Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
-        FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
+        final Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
+        final FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
             "false", null, null, null, null, null, "true", "1", null, null, null);
         avroAppender.start();
-        Logger eventLogger = (Logger) LogManager.getLogger("EventLogger");
+        final Logger eventLogger = (Logger) LogManager.getLogger("EventLogger");
         Assert.assertNotNull(eventLogger);
         eventLogger.addAppender(avroAppender);
         eventLogger.setLevel(Level.ALL);
 
-        StructuredDataMessage msg = new StructuredDataMessage("Transer", "Success", "Audit");
+        final StructuredDataMessage msg = new StructuredDataMessage("Transer", "Success", "Audit");
         msg.put("memo", "This is a memo");
         msg.put("acct", "12345");
         msg.put("amount", "100.00");
@@ -173,10 +173,10 @@ public class FlumeAppenderTest {
 
         EventLogger.logEvent(msg);
 
-        Transaction transaction = channel.getTransaction();
+        final Transaction transaction = channel.getTransaction();
         transaction.begin();
 
-        Event event = channel.take();
+        final Event event = channel.take();
         Assert.assertNotNull(event);
         Assert.assertTrue("Channel contained event, but not expected message",
             getBody(event).endsWith("Success"));
@@ -192,8 +192,8 @@ public class FlumeAppenderTest {
 
     @Test
     public void testMultiple() throws InterruptedException, IOException {
-        Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
-        FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
+        final Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
+        final FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
             "false", null, null, null, null, null, "true", "1", null, null, null);
         avroAppender.start();
         avroLogger.addAppender(avroAppender);
@@ -206,10 +206,10 @@ public class FlumeAppenderTest {
         }
 
         for (int i = 0; i < 10; ++i) {
-            Transaction transaction = channel.getTransaction();
+            final Transaction transaction = channel.getTransaction();
             transaction.begin();
 
-            Event event = channel.take();
+            final Event event = channel.take();
    	        Assert.assertNotNull(event);
   	        Assert.assertTrue("Channel contained event, but not expected message",
                 getBody(event).endsWith("Test message " + i));
@@ -222,8 +222,8 @@ public class FlumeAppenderTest {
 
      @Test
     public void testBatch() throws InterruptedException, IOException {
-        Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
-        FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
+        final Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
+        final FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
             "false", null, null, null, null, null, "true", "10", null, null, null);
         avroAppender.start();
         avroLogger.addAppender(avroAppender);
@@ -235,11 +235,11 @@ public class FlumeAppenderTest {
             avroLogger.info("Test message " + i);
         }
 
-        Transaction transaction = channel.getTransaction();
+        final Transaction transaction = channel.getTransaction();
         transaction.begin();
 
         for (int i = 0; i < 10; ++i) {
-            Event event = channel.take();
+            final Event event = channel.take();
    	        Assert.assertNotNull("No event for item " + i, event);
   	        Assert.assertTrue("Channel contained event, but not expected message",
                 getBody(event).endsWith("Test message " + i));
@@ -253,8 +253,8 @@ public class FlumeAppenderTest {
 
     @Test
     public void testConnectionRefused() {
-        Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
-        FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
+        final Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort)};
+        final FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
             "false", null, null, null, null, null, "true", "1", null, null, null);
         avroAppender.start();
         avroLogger.addAppender(avroAppender);
@@ -265,7 +265,7 @@ public class FlumeAppenderTest {
 
         try {
             avroLogger.info("message 1");
-        } catch (Throwable t) {
+        } catch (final Throwable t) {
             //logger.debug("Logging to a non-existant server failed (as expected)", t);
 
             caughtException = true;
@@ -278,10 +278,10 @@ public class FlumeAppenderTest {
 
     @Test
     public void testReconnect() throws Exception {
-        String altPort = Integer.toString(Integer.parseInt(testPort) + 1);
-        Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort),
+        final String altPort = Integer.toString(Integer.parseInt(testPort) + 1);
+        final Agent[] agents = new Agent[] {Agent.createAgent("localhost", testPort),
                                       Agent.createAgent("localhost", altPort)};
-        FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
+        final FlumeAppender avroAppender = FlumeAppender.createAppender(agents, null, "false", null, "100", "3", "avro",
             "false", null, null, null, null, null, "true", "1", null, null, null);
         avroAppender.start();
         avroLogger.addAppender(avroAppender);
@@ -301,14 +301,14 @@ public class FlumeAppenderTest {
 
         eventSource.stop();
         try {
-            Context context = new Context();
+            final Context context = new Context();
             context.put("port", altPort);
             context.put("bind", "0.0.0.0");
 
             Configurables.configure(eventSource, context);
 
             eventSource.start();
-        } catch (ChannelException e) {
+        } catch (final ChannelException e) {
             Assert.fail("Caught exception while resetting port to " + altPort + " : " + e.getMessage());
         }
 
@@ -327,23 +327,23 @@ public class FlumeAppenderTest {
 
 
 
-    private void removeAppenders(Logger logger) {
-        Map<String,Appender> map = logger.getAppenders();
-        for (Map.Entry<String, Appender> entry : map.entrySet()) {
-            Appender app = entry.getValue();
+    private void removeAppenders(final Logger logger) {
+        final Map<String,Appender> map = logger.getAppenders();
+        for (final Map.Entry<String, Appender> entry : map.entrySet()) {
+            final Appender app = entry.getValue();
             avroLogger.removeAppender(app);
             app.stop();
         }
     }
 
-    private Appender getAppender(Logger logger, String name) {
-        Map<String,Appender> map = logger.getAppenders();
+    private Appender getAppender(final Logger logger, final String name) {
+        final Map<String,Appender> map = logger.getAppenders();
         return map.get(name);
     }
 
-    private String getBody(Event event) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            InputStream is = new GZIPInputStream(new ByteArrayInputStream(event.getBody()));
+    private String getBody(final Event event) throws IOException {
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            final InputStream is = new GZIPInputStream(new ByteArrayInputStream(event.getBody()));
             int n = 0;
             while (-1 != (n = is.read())) {
                 baos.write(n);

Modified: logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java Mon Dec 10 19:36:06 2012
@@ -84,8 +84,8 @@ public class FlumeEmbeddedAgentTest {
 
     @Before
     public void setUp() throws Exception {
-        File file = new File("target/file-channel");
-        boolean result = deleteFiles(file);
+        final File file = new File("target/file-channel");
+        final boolean result = deleteFiles(file);
         primarySource = new AvroSource();
         primarySource.setName("Primary");
         altSource = new AvroSource();
@@ -114,16 +114,16 @@ public class FlumeEmbeddedAgentTest {
         context.put("bind", "localhost");
         Configurables.configure(altSource, context);
 
-        List<Channel> channels = new ArrayList<Channel>();
+        final List<Channel> channels = new ArrayList<Channel>();
         channels.add(primaryChannel);
 
-        ChannelSelector primaryCS = new ReplicatingChannelSelector();
+        final ChannelSelector primaryCS = new ReplicatingChannelSelector();
         primaryCS.setChannels(channels);
 
-        List<Channel> altChannels = new ArrayList<Channel>();
+        final List<Channel> altChannels = new ArrayList<Channel>();
         altChannels.add(alternateChannel);
 
-        ChannelSelector alternateCS = new ReplicatingChannelSelector();
+        final ChannelSelector alternateCS = new ReplicatingChannelSelector();
         alternateCS.setChannels(altChannels);
 
         primarySource.setChannelProcessor(new ChannelProcessor(primaryCS));
@@ -150,14 +150,14 @@ public class FlumeEmbeddedAgentTest {
             LifecycleController.waitForOneOf(primarySource, LifecycleState.STOP_OR_ERROR));
         Assert.assertEquals("Server is stopped", LifecycleState.STOP,
             primarySource.getLifecycleState());
-        File file = new File("target/file-channel");
-        boolean result = deleteFiles(file);
-        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
-        Set<ObjectName> names = server.queryNames(new ObjectName("org.apache.flume.*:*"), null);
-        for (ObjectName name : names) {
+        final File file = new File("target/file-channel");
+        final boolean result = deleteFiles(file);
+        final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+        final Set<ObjectName> names = server.queryNames(new ObjectName("org.apache.flume.*:*"), null);
+        for (final ObjectName name : names) {
             try {
                 server.unregisterMBean(name);
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 System.out.println("Unable to unregister " + name.toString());
             }
         }
@@ -166,15 +166,15 @@ public class FlumeEmbeddedAgentTest {
     @Test
     public void testLog4Event() throws InterruptedException, IOException {
 
-        StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Log4j", "Test");
+        final StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Log4j", "Test");
         EventLogger.logEvent(msg);
 
-        Transaction transaction = primaryChannel.getTransaction();
+        final Transaction transaction = primaryChannel.getTransaction();
         transaction.begin();
 
-        Event event = primaryChannel.take();
+        final Event event = primaryChannel.take();
         Assert.assertNotNull(event);
-        String body = getBody(event);
+        final String body = getBody(event);
         Assert.assertTrue("Channel contained event, but not expected message. Received: " + body,
             body.endsWith("Test Log4j"));
         transaction.commit();
@@ -187,17 +187,17 @@ public class FlumeEmbeddedAgentTest {
     public void testMultiple() throws InterruptedException, IOException {
 
         for (int i = 0; i < 10; ++i) {
-            StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Multiple " + i, "Test");
+            final StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Multiple " + i, "Test");
             EventLogger.logEvent(msg);
         }
         for (int i = 0; i < 10; ++i) {
-            Transaction transaction = primaryChannel.getTransaction();
+            final Transaction transaction = primaryChannel.getTransaction();
             transaction.begin();
 
-            Event event = primaryChannel.take();
+            final Event event = primaryChannel.take();
             Assert.assertNotNull("Missing event number " + i + 1, event);
-            String body = getBody(event);
-            String expected = "Test Multiple " + i;
+            final String body = getBody(event);
+            final String expected = "Test Multiple " + i;
             Assert.assertTrue("Channel contained event, but not expected message. Received: " + body,
                 body.endsWith(expected));
             transaction.commit();
@@ -210,20 +210,20 @@ public class FlumeEmbeddedAgentTest {
 
     @Test
     public void testFailover() throws InterruptedException, IOException {
-        Logger logger = LogManager.getLogger("testFailover");
+        final Logger logger = LogManager.getLogger("testFailover");
         logger.debug("Starting testFailover");
         for (int i = 0; i < 10; ++i) {
-            StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Primary " + i, "Test");
+            final StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Primary " + i, "Test");
             EventLogger.logEvent(msg);
         }
         for (int i = 0; i < 10; ++i) {
-            Transaction transaction = primaryChannel.getTransaction();
+            final Transaction transaction = primaryChannel.getTransaction();
             transaction.begin();
 
-            Event event = primaryChannel.take();
+            final Event event = primaryChannel.take();
             Assert.assertNotNull(event);
-            String body = getBody(event);
-            String expected = "Test Primary " + i;
+            final String body = getBody(event);
+            final String expected = "Test Primary " + i;
             Assert.assertTrue("Channel contained event, but not expected message. Received: " + body,
                 body.endsWith(expected));
             transaction.commit();
@@ -236,17 +236,17 @@ public class FlumeEmbeddedAgentTest {
 
 
         for (int i = 0; i < 10; ++i) {
-            StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Alternate " + i, "Test");
+            final StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Alternate " + i, "Test");
             EventLogger.logEvent(msg);
         }
         for (int i = 0; i < 10; ++i) {
-            Transaction transaction = alternateChannel.getTransaction();
+            final Transaction transaction = alternateChannel.getTransaction();
             transaction.begin();
 
-            Event event = alternateChannel.take();
+            final Event event = alternateChannel.take();
             Assert.assertNotNull(event);
-            String body = getBody(event);
-            String expected = "Test Alternate " + i;
+            final String body = getBody(event);
+            final String expected = "Test Alternate " + i;
             /* When running in Gump Flume consistently returns the last event from the primary channel after
                the failover, which fails this test */
             Assert.assertTrue("Channel contained event, but not expected message. Expected: " + expected +
@@ -257,9 +257,9 @@ public class FlumeEmbeddedAgentTest {
     }
 
 
-    private String getBody(Event event) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        InputStream is = new GZIPInputStream(new ByteArrayInputStream(event.getBody()));
+    private String getBody(final Event event) throws IOException {
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final InputStream is = new GZIPInputStream(new ByteArrayInputStream(event.getBody()));
         int n = 0;
         while (-1 != (n = is.read())) {
             baos.write(n);
@@ -268,12 +268,12 @@ public class FlumeEmbeddedAgentTest {
 
     }
 
-    private boolean deleteFiles(File file) {
+    private boolean deleteFiles(final File file) {
         boolean result = true;
         if (file.isDirectory()) {
 
-            File[] files = file.listFiles();
-            for (File child : files) {
+            final File[] files = file.listFiles();
+            for (final File child : files) {
                 result &= deleteFiles(child);
             }
 

Modified: logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAppenderTest.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAppenderTest.java Mon Dec 10 19:36:06 2012
@@ -84,8 +84,8 @@ public class FlumeEmbeddedAppenderTest {
 
     @Before
     public void setUp() throws Exception {
-        File file = new File("target/file-channel");
-        boolean result = deleteFiles(file);
+        final File file = new File("target/file-channel");
+        final boolean result = deleteFiles(file);
         primarySource = new AvroSource();
         primarySource.setName("Primary");
         altSource = new AvroSource();
@@ -114,16 +114,16 @@ public class FlumeEmbeddedAppenderTest {
         context.put("bind", "localhost");
         Configurables.configure(altSource, context);
 
-        List<Channel> channels = new ArrayList<Channel>();
+        final List<Channel> channels = new ArrayList<Channel>();
         channels.add(primaryChannel);
 
-        ChannelSelector primaryCS = new ReplicatingChannelSelector();
+        final ChannelSelector primaryCS = new ReplicatingChannelSelector();
         primaryCS.setChannels(channels);
 
-        List<Channel> altChannels = new ArrayList<Channel>();
+        final List<Channel> altChannels = new ArrayList<Channel>();
         altChannels.add(alternateChannel);
 
-        ChannelSelector alternateCS = new ReplicatingChannelSelector();
+        final ChannelSelector alternateCS = new ReplicatingChannelSelector();
         alternateCS.setChannels(altChannels);
 
         primarySource.setChannelProcessor(new ChannelProcessor(primaryCS));
@@ -150,14 +150,14 @@ public class FlumeEmbeddedAppenderTest {
 	           LifecycleController.waitForOneOf(primarySource, LifecycleState.STOP_OR_ERROR));
 	      Assert.assertEquals("Server is stopped", LifecycleState.STOP,
             primarySource.getLifecycleState());
-        File file = new File("target/file-channel");
-        boolean result = deleteFiles(file);
-        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
-        Set<ObjectName> names = server.queryNames(new ObjectName("org.apache.flume.*:*"), null);
-        for (ObjectName name : names) {
+        final File file = new File("target/file-channel");
+        final boolean result = deleteFiles(file);
+        final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+        final Set<ObjectName> names = server.queryNames(new ObjectName("org.apache.flume.*:*"), null);
+        for (final ObjectName name : names) {
             try {
                 server.unregisterMBean(name);
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 System.out.println("Unable to unregister " + name.toString());
             }
         }
@@ -166,15 +166,15 @@ public class FlumeEmbeddedAppenderTest {
     @Test
     public void testLog4Event() throws InterruptedException, IOException {
 
-        StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Log4j", "Test");
+        final StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Log4j", "Test");
         EventLogger.logEvent(msg);
 
-        Transaction transaction = primaryChannel.getTransaction();
+        final Transaction transaction = primaryChannel.getTransaction();
         transaction.begin();
 
-        Event event = primaryChannel.take();
+        final Event event = primaryChannel.take();
    	    Assert.assertNotNull(event);
-        String body = getBody(event);
+        final String body = getBody(event);
   	    Assert.assertTrue("Channel contained event, but not expected message. Received: " + body,
             body.endsWith("Test Log4j"));
 	      transaction.commit();
@@ -187,17 +187,17 @@ public class FlumeEmbeddedAppenderTest {
     public void testMultiple() throws InterruptedException, IOException {
 
         for (int i = 0; i < 10; ++i) {
-            StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Multiple " + i, "Test");
+            final StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Multiple " + i, "Test");
             EventLogger.logEvent(msg);
         }
         for (int i = 0; i < 10; ++i) {
-            Transaction transaction = primaryChannel.getTransaction();
+            final Transaction transaction = primaryChannel.getTransaction();
             transaction.begin();
 
-            Event event = primaryChannel.take();
+            final Event event = primaryChannel.take();
             Assert.assertNotNull(event);
-            String body = getBody(event);
-            String expected = "Test Multiple " + i;
+            final String body = getBody(event);
+            final String expected = "Test Multiple " + i;
             Assert.assertTrue("Channel contained event, but not expected message. Received: " + body,
                 body.endsWith(expected));
             transaction.commit();
@@ -210,20 +210,20 @@ public class FlumeEmbeddedAppenderTest {
 
     @Test
     public void testFailover() throws InterruptedException, IOException {
-        Logger logger = LogManager.getLogger("testFailover");
+        final Logger logger = LogManager.getLogger("testFailover");
         logger.debug("Starting testFailover");
         for (int i = 0; i < 10; ++i) {
-            StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Primary " + i, "Test");
+            final StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Primary " + i, "Test");
             EventLogger.logEvent(msg);
         }
         for (int i = 0; i < 10; ++i) {
-            Transaction transaction = primaryChannel.getTransaction();
+            final Transaction transaction = primaryChannel.getTransaction();
             transaction.begin();
 
-            Event event = primaryChannel.take();
+            final Event event = primaryChannel.take();
             Assert.assertNotNull(event);
-            String body = getBody(event);
-            String expected = "Test Primary " + i;
+            final String body = getBody(event);
+            final String expected = "Test Primary " + i;
             Assert.assertTrue("Channel contained event, but not expected message. Received: " + body,
                 body.endsWith(expected));
             transaction.commit();
@@ -237,17 +237,17 @@ public class FlumeEmbeddedAppenderTest {
 
 
         for (int i = 0; i < 10; ++i) {
-            StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Alternate " + i, "Test");
+            final StructuredDataMessage msg = new StructuredDataMessage("Test", "Test Alternate " + i, "Test");
             EventLogger.logEvent(msg);
         }
         for (int i = 0; i < 10; ++i) {
-            Transaction transaction = alternateChannel.getTransaction();
+            final Transaction transaction = alternateChannel.getTransaction();
             transaction.begin();
 
-            Event event = alternateChannel.take();
+            final Event event = alternateChannel.take();
             Assert.assertNotNull(event);
-            String body = getBody(event);
-            String expected = "Test Alternate " + i;
+            final String body = getBody(event);
+            final String expected = "Test Alternate " + i;
             /* When running in Gump Flume consistently returns the last event from the primary channel after
                the failover, which fails this test */
             Assert.assertTrue("Channel contained event, but not expected message. Expected: " + expected +
@@ -258,9 +258,9 @@ public class FlumeEmbeddedAppenderTest {
     }
 
 
-    private String getBody(Event event) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            InputStream is = new GZIPInputStream(new ByteArrayInputStream(event.getBody()));
+    private String getBody(final Event event) throws IOException {
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            final InputStream is = new GZIPInputStream(new ByteArrayInputStream(event.getBody()));
             int n = 0;
             while (-1 != (n = is.read())) {
                 baos.write(n);
@@ -269,12 +269,12 @@ public class FlumeEmbeddedAppenderTest {
 
     }
 
-    private boolean deleteFiles(File file) {
+    private boolean deleteFiles(final File file) {
         boolean result = true;
         if (file.isDirectory()) {
 
-            File[] files = file.listFiles();
-            for (File child : files) {
+            final File[] files = file.listFiles();
+            for (final File child : files) {
                 result &= deleteFiles(child);
             }
 

Modified: logging/log4j/log4j2/trunk/jcl-bridge/src/main/java/org/apache/logging/log4j/jcl/Log4JLog.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/jcl-bridge/src/main/java/org/apache/logging/log4j/jcl/Log4JLog.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/jcl-bridge/src/main/java/org/apache/logging/log4j/jcl/Log4JLog.java (original)
+++ logging/log4j/log4j2/trunk/jcl-bridge/src/main/java/org/apache/logging/log4j/jcl/Log4JLog.java Mon Dec 10 19:36:06 2012
@@ -25,7 +25,7 @@ import org.apache.logging.log4j.spi.Abst
  */
 public class Log4JLog extends AbstractLoggerWrapper implements Log {
 
-    public Log4JLog(AbstractLogger logger, String name) {
+    public Log4JLog(final AbstractLogger logger, final String name) {
         super(logger, name, null);
     }
 }

Modified: logging/log4j/log4j2/trunk/jcl-bridge/src/main/java/org/apache/logging/log4j/jcl/LogFactoryImpl.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/jcl-bridge/src/main/java/org/apache/logging/log4j/jcl/LogFactoryImpl.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/jcl-bridge/src/main/java/org/apache/logging/log4j/jcl/LogFactoryImpl.java (original)
+++ logging/log4j/log4j2/trunk/jcl-bridge/src/main/java/org/apache/logging/log4j/jcl/LogFactoryImpl.java Mon Dec 10 19:36:06 2012
@@ -36,16 +36,16 @@ public class LogFactoryImpl extends LogF
     private final Map<LoggerContext, ConcurrentMap<String, Log>> contextMap =
         new WeakHashMap<LoggerContext, ConcurrentMap<String, Log>>();
 
-    private ConcurrentMap<String, Object> attributes = new ConcurrentHashMap<String, Object>();
+    private final ConcurrentMap<String, Object> attributes = new ConcurrentHashMap<String, Object>();
 
     @Override
-    public Log getInstance(String name) throws LogConfigurationException {
-        LoggerContext context = PrivateManager.getContext();
-        ConcurrentMap<String, Log> loggers = getLoggersMap();
+    public Log getInstance(final String name) throws LogConfigurationException {
+        final LoggerContext context = PrivateManager.getContext();
+        final ConcurrentMap<String, Log> loggers = getLoggersMap();
         if (loggers.containsKey(name)) {
             return loggers.get(name);
         }
-        org.apache.logging.log4j.Logger logger = PrivateManager.getLogger(name);
+        final org.apache.logging.log4j.Logger logger = PrivateManager.getLogger(name);
         if (logger instanceof AbstractLogger) {
             loggers.putIfAbsent(name, new Log4JLog((AbstractLogger) logger, name));
             return loggers.get(name);
@@ -55,7 +55,7 @@ public class LogFactoryImpl extends LogF
     }
 
     private ConcurrentMap<String, Log> getLoggersMap() {
-        LoggerContext context = PrivateManager.getContext();
+        final LoggerContext context = PrivateManager.getContext();
         synchronized (contextMap) {
             ConcurrentMap<String, Log> map = contextMap.get(context);
             if (map == null) {
@@ -67,7 +67,7 @@ public class LogFactoryImpl extends LogF
     }
 
     @Override
-    public Object getAttribute(String name) {
+    public Object getAttribute(final String name) {
         return attributes.get(name);
     }
 
@@ -77,7 +77,7 @@ public class LogFactoryImpl extends LogF
     }
 
     @Override
-    public Log getInstance(Class clazz) throws LogConfigurationException {
+    public Log getInstance(final Class clazz) throws LogConfigurationException {
         return getInstance(clazz.getName());
     }
 
@@ -91,12 +91,12 @@ public class LogFactoryImpl extends LogF
     }
 
     @Override
-    public void removeAttribute(String name) {
+    public void removeAttribute(final String name) {
         attributes.remove(name);
     }
 
     @Override
-    public void setAttribute(String name, Object value) {
+    public void setAttribute(final String name, final Object value) {
         if (value != null) {
             attributes.put(name, value);
         } else {
@@ -114,7 +114,7 @@ public class LogFactoryImpl extends LogF
             return getContext(FQCN, false);
         }
 
-        public static org.apache.logging.log4j.Logger getLogger(String name) {
+        public static org.apache.logging.log4j.Logger getLogger(final String name) {
             return getLogger(FQCN, name);
         }
     }



Mime
View raw message