diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java index 7bb50cc4c7..cac9ba839f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java @@ -99,16 +99,21 @@ import org.apache.commons.logging.LogFactory; public class ActiveMQConnection implements Connection, TopicConnection, QueueConnection, StatsCapable, Closeable, StreamConnection, TransportListener { - private TaskRunnerFactory sessionTaskRunner = new TaskRunnerFactory("ActiveMQ Session Task", ThreadPriorities.INBOUND_CLIENT_SESSION, true, 1000); - private final ThreadPoolExecutor asyncConnectionThread; - - private static final Log LOG = LogFactory.getLog(ActiveMQConnection.class); - private static final IdGenerator connectionIdGenerator = new IdGenerator(); - public static final String DEFAULT_USER = ActiveMQConnectionFactory.DEFAULT_USER; public static final String DEFAULT_PASSWORD = ActiveMQConnectionFactory.DEFAULT_PASSWORD; public static final String DEFAULT_BROKER_URL = ActiveMQConnectionFactory.DEFAULT_BROKER_URL; + private static final Log LOG = LogFactory.getLog(ActiveMQConnection.class); + private static final IdGenerator CONNECTION_ID_GENERATOR = new IdGenerator(); + + public final ConcurrentHashMap activeTempDestinations = new ConcurrentHashMap(); + + protected boolean dispatchAsync; + protected boolean alwaysSessionAsync = true; + + private TaskRunnerFactory sessionTaskRunner = new TaskRunnerFactory("ActiveMQ Session Task", ThreadPriorities.INBOUND_CLIENT_SESSION, true, 1000); + private final ThreadPoolExecutor asyncConnectionThread; + // Connection state variables private final ConnectionInfo info; private ExceptionListener exceptionListener; @@ -127,8 +132,6 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon private boolean copyMessageOnSend = true; private boolean useCompression; private boolean objectMessageSerializationDefered; - protected boolean dispatchAsync; - protected boolean alwaysSessionAsync = true; private boolean useAsyncSend; private boolean optimizeAcknowledge; private boolean nestedMapAndListEnabled = true; @@ -163,7 +166,6 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon private final LongSequenceGenerator producerIdGenerator = new LongSequenceGenerator(); private final LongSequenceGenerator tempDestinationIdGenerator = new LongSequenceGenerator(); private final LongSequenceGenerator localTransactionIdGenerator = new LongSequenceGenerator(); - final ConcurrentHashMap activeTempDestinations = new ConcurrentHashMap(); private AdvisoryConsumer advisoryConsumer; private final CountDownLatch brokerInfoReceived = new CountDownLatch(1); @@ -201,7 +203,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon }); // asyncConnectionThread.allowCoreThreadTimeOut(true); - this.info = new ConnectionInfo(new ConnectionId(connectionIdGenerator.generateId())); + this.info = new ConnectionInfo(new ConnectionId(CONNECTION_ID_GENERATOR.generateId())); this.info.setManageable(true); this.connectionSessionId = new SessionId(info.getConnectionId(), -1); diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java index 8cf024a9f0..ba6d9e5114 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java @@ -62,7 +62,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne public static final String DEFAULT_PASSWORD = null; public static final int DEFAULT_PRODUCER_WINDOW_SIZE = 0; - static protected final Executor DEFAULT_CONNECTION_EXECUTOR = new ScheduledThreadPoolExecutor(5, new ThreadFactory() { + protected static final Executor DEFAULT_CONNECTION_EXECUTOR = new ScheduledThreadPoolExecutor(5, new ThreadFactory() { public Thread newThread(Runnable run) { Thread thread = new Thread(run); thread.setPriority(ThreadPriorities.INBOUND_CLIENT_CONNECTION); @@ -772,11 +772,11 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne this.factoryStats.setEnabled(statsEnabled); } - synchronized public int getProducerWindowSize() { + public synchronized int getProducerWindowSize() { return producerWindowSize; } - synchronized public void setProducerWindowSize(int producerWindowSize) { + public synchronized void setProducerWindowSize(int producerWindowSize) { this.producerWindowSize = producerWindowSize; } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageAudit.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageAudit.java index cf2a2f5abe..1814d464ca 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageAudit.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageAudit.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq; import java.util.LinkedHashMap; diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageProducerSupport.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageProducerSupport.java index 59309a0664..656d582716 100644 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageProducerSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageProducerSupport.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQOutputStream.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQOutputStream.java index 0a56bb8d9d..8ebe4696bc 100644 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQOutputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQOutputStream.java @@ -114,7 +114,7 @@ public class ActiveMQOutputStream extends OutputStream implements Disposable { } } - synchronized public void flush() throws IOException { + public synchronized void flush() throws IOException { flushBuffer(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQPrefetchPolicy.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQPrefetchPolicy.java index 7a30119aa4..0326baefa8 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQPrefetchPolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQPrefetchPolicy.java @@ -27,8 +27,8 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.3 $ */ public class ActiveMQPrefetchPolicy implements Serializable { - private static final Log log = LogFactory.getLog(ActiveMQPrefetchPolicy.class); - private static final int MAX_PREFETCH_SIZE = (Short.MAX_VALUE - 1); + private static final Log LOG = LogFactory.getLog(ActiveMQPrefetchPolicy.class); + private static final int MAX_PREFETCH_SIZE = Short.MAX_VALUE - 1; private int queuePrefetch; private int queueBrowserPrefetch; private int topicPrefetch; @@ -135,7 +135,7 @@ public class ActiveMQPrefetchPolicy implements Serializable { private int getMaxPrefetchLimit(int value) { int result = Math.min(value, MAX_PREFETCH_SIZE); if (result < value) { - log.warn("maximum prefetch limit has been reset from " + value + " to " + MAX_PREFETCH_SIZE); + LOG.warn("maximum prefetch limit has been reset from " + value + " to " + MAX_PREFETCH_SIZE); } return result; } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueBrowser.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueBrowser.java index ec06768384..3bd6edf5a6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueBrowser.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueBrowser.java @@ -194,7 +194,7 @@ public class ActiveMQQueueBrowser implements QueueBrowser, Enumeration { } } - synchronized public void close() throws JMSException { + public synchronized void close() throws JMSException { destroyConsumer(); closed = true; } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueSession.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueSession.java index 26422f7081..d93b290584 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueSession.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueSession.java @@ -125,14 +125,15 @@ public class ActiveMQQueueSession implements QueueSession { /** * @param destination * @param messageSelector - * @param NoLocal + * @param noLocal * @return * @throws JMSException */ - public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean NoLocal) throws JMSException { - if (destination instanceof Topic) + public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException { + if (destination instanceof Topic) { throw new InvalidDestinationException("Topics are not supported by a QueueSession"); - return next.createConsumer(destination, messageSelector, NoLocal); + } + return next.createConsumer(destination, messageSelector, noLocal); } /** diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java index 01b6ecf7b8..9563da6a9c 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java @@ -178,22 +178,14 @@ import org.apache.commons.logging.LogFactory; public class ActiveMQSession implements Session, QueueSession, TopicSession, StatsCapable, ActiveMQDispatcher { public static interface DeliveryListener { - public void beforeDelivery(ActiveMQSession session, Message msg); + void beforeDelivery(ActiveMQSession session, Message msg); - public void afterDelivery(ActiveMQSession session, Message msg); + void afterDelivery(ActiveMQSession session, Message msg); } - private static final Log log = LogFactory.getLog(ActiveMQSession.class); + private static final Log LOG = LogFactory.getLog(ActiveMQSession.class); protected int acknowledgementMode; - - private MessageListener messageListener; - private JMSSessionStatsImpl stats; - private TransactionContext transactionContext; - private DeliveryListener deliveryListener; - private MessageTransformer transformer; - private BlobTransferPolicy blobTransferPolicy; - protected final ActiveMQConnection connection; protected final SessionInfo info; protected final LongSequenceGenerator consumerIdGenerator = new LongSequenceGenerator(); @@ -211,6 +203,13 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta protected final boolean debug; protected Object sendMutex = new Object(); + private MessageListener messageListener; + private JMSSessionStatsImpl stats; + private TransactionContext transactionContext; + private DeliveryListener deliveryListener; + private MessageTransformer transformer; + private BlobTransferPolicy blobTransferPolicy; + /** * Construct the Session * @@ -223,7 +222,7 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta * @throws JMSException on internal error */ protected ActiveMQSession(ActiveMQConnection connection, SessionId sessionId, int acknowledgeMode, boolean asyncDispatch, boolean sessionAsyncDispatch) throws JMSException { - this.debug = log.isDebugEnabled(); + this.debug = LOG.isDebugEnabled(); this.connection = connection; this.acknowledgementMode = acknowledgeMode; this.asyncDispatch = asyncDispatch; @@ -602,7 +601,7 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta } } - synchronized public void dispose() throws JMSException { + public synchronized void dispose() throws JMSException { if (!closed) { try { @@ -765,7 +764,7 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta messageListener.onMessage(message); } catch (Throwable e) { // TODO: figure out proper way to handle error. - log.error("error dispatching message: ", e); + LOG.error("error dispatching message: ", e); connection.onAsyncException(e); } @@ -1577,7 +1576,7 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta msg.onSend(); msg.setProducerId(msg.getMessageId().getProducerId()); if (this.debug) { - log.debug("Sending message: " + msg); + LOG.debug("Sending message: " + msg); } if (!connection.isAlwaysSyncSend() && (!msg.isPersistent() || connection.isUseAsyncSend() || txid != null)) { this.connection.asyncSendPacket(msg); @@ -1823,9 +1822,9 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta try { c.close(); } catch (JMSException e) { - log.warn("Exception closing consumer", e); + LOG.warn("Exception closing consumer", e); } - log.warn("Closed consumer on Command"); + LOG.warn("Closed consumer on Command"); break; } } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSessionExecutor.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSessionExecutor.java index 68ed99a810..4ad5ddb898 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSessionExecutor.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSessionExecutor.java @@ -38,7 +38,7 @@ import org.apache.commons.logging.LogFactory; * @see javax.jms.Session */ public class ActiveMQSessionExecutor implements Task { - private static final transient Log log = LogFactory.getLog(ActiveMQSessionExecutor.class); + private static final Log LOG = LogFactory.getLog(ActiveMQSessionExecutor.class); private ActiveMQSession session; private MessageDispatchChannel messageQueue = new MessageDispatchChannel(); @@ -69,7 +69,7 @@ public class ActiveMQSessionExecutor implements Task { // lets only warn when a significant amount of time has passed // just in case its normal operation if (elapsedTime > aboutUnstartedConnectionTimeout) { - log.warn("Received a message on a connection which is not yet started. Have you forgotten to call Connection.start()? Connection: " + connection + LOG.warn("Received a message on a connection which is not yet started. Have you forgotten to call Connection.start()? Connection: " + connection + " Received: " + message); startedOrWarnedThatNotStarted = true; } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQTopicSession.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQTopicSession.java index 1ef36841cb..ab8a0a6f2e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQTopicSession.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQTopicSession.java @@ -126,15 +126,15 @@ public class ActiveMQTopicSession implements TopicSession { /** * @param destination * @param messageSelector - * @param NoLocal + * @param noLocal * @return * @throws JMSException */ - public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean NoLocal) throws JMSException { + public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException { if (destination instanceof Queue) { throw new InvalidDestinationException("Queues are not supported by a TopicSession"); } - return next.createConsumer(destination, messageSelector, NoLocal); + return next.createConsumer(destination, messageSelector, noLocal); } /** diff --git a/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java b/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java index 70a82a1f63..3d43bae6f3 100755 --- a/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java +++ b/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java @@ -30,12 +30,13 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class AdvisoryConsumer implements ActiveMQDispatcher { - private static final transient Log log = LogFactory.getLog(AdvisoryConsumer.class); + private static final transient Log LOG = LogFactory.getLog(AdvisoryConsumer.class); + + int deliveredCounter; private final ActiveMQConnection connection; private ConsumerInfo info; private boolean closed; - int deliveredCounter; public AdvisoryConsumer(ActiveMQConnection connection, ConsumerId consumerId) throws JMSException { this.connection = connection; @@ -53,7 +54,7 @@ public class AdvisoryConsumer implements ActiveMQDispatcher { try { this.connection.asyncSendPacket(info.createRemoveCommand()); } catch (JMSException e) { - log.info("Failed to send remove command: " + e, e); + LOG.info("Failed to send remove command: " + e, e); } this.connection.removeDispatcher(info.getConsumerId()); closed = true; diff --git a/activemq-core/src/main/java/org/apache/activemq/BlobMessage.java b/activemq-core/src/main/java/org/apache/activemq/BlobMessage.java index 50352ab9c9..92e2090013 100644 --- a/activemq-core/src/main/java/org/apache/activemq/BlobMessage.java +++ b/activemq-core/src/main/java/org/apache/activemq/BlobMessage.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/Closeable.java b/activemq-core/src/main/java/org/apache/activemq/Closeable.java index c9ae669b10..7ebb1e9d7e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/Closeable.java +++ b/activemq-core/src/main/java/org/apache/activemq/Closeable.java @@ -36,5 +36,5 @@ public interface Closeable { * @throws JMSException if the JMS provider fails to close the object due to * some internal error. */ - public void close() throws JMSException; + void close() throws JMSException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/ConnectionFailedException.java b/activemq-core/src/main/java/org/apache/activemq/ConnectionFailedException.java index 1547df8256..e40d4d54af 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ConnectionFailedException.java +++ b/activemq-core/src/main/java/org/apache/activemq/ConnectionFailedException.java @@ -40,7 +40,7 @@ public class ConnectionFailedException extends JMSException { super("The JMS connection has failed due to a Transport problem"); } - static private String extractMessage(IOException cause) { + private static String extractMessage(IOException cause) { String m = cause.getMessage(); if (m == null || m.length() == 0) m = cause.toString(); diff --git a/activemq-core/src/main/java/org/apache/activemq/CustomDestination.java b/activemq-core/src/main/java/org/apache/activemq/CustomDestination.java index 49a059fcfa..9b27864e72 100644 --- a/activemq-core/src/main/java/org/apache/activemq/CustomDestination.java +++ b/activemq-core/src/main/java/org/apache/activemq/CustomDestination.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/LocalTransactionEventListener.java b/activemq-core/src/main/java/org/apache/activemq/LocalTransactionEventListener.java index 8eab519af6..3ca4b6546a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/LocalTransactionEventListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/LocalTransactionEventListener.java @@ -21,9 +21,9 @@ package org.apache.activemq; * @version $Revision: 1.2 $ */ public interface LocalTransactionEventListener { - public void beginEvent(); + void beginEvent(); - public void commitEvent(); + void commitEvent(); - public void rollbackEvent(); + void rollbackEvent(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/Message.java b/activemq-core/src/main/java/org/apache/activemq/Message.java index cae1a8cac3..d18417a234 100644 --- a/activemq-core/src/main/java/org/apache/activemq/Message.java +++ b/activemq-core/src/main/java/org/apache/activemq/Message.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -28,6 +28,6 @@ public interface Message extends javax.jms.Message { * the MIME types of the different JMS messages, or in the case of {@link org.apache.activemq.BlobMessage} * it allows you to create a selector on the MIME type of the BLOB body */ - public String getJMSXMimeType(); + String getJMSXMimeType(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/MessageAvailableConsumer.java b/activemq-core/src/main/java/org/apache/activemq/MessageAvailableConsumer.java index d134a3b254..10ac006a40 100644 --- a/activemq-core/src/main/java/org/apache/activemq/MessageAvailableConsumer.java +++ b/activemq-core/src/main/java/org/apache/activemq/MessageAvailableConsumer.java @@ -31,11 +31,11 @@ public interface MessageAvailableConsumer extends MessageConsumer { * Sets the listener used to notify synchronous consumers that there is a message * available so that the {@link MessageConsumer#receiveNoWait()} can be called. */ - public void setAvailableListener(MessageAvailableListener availableListener); + void setAvailableListener(MessageAvailableListener availableListener); /** * Gets the listener used to notify synchronous consumers that there is a message * available so that the {@link MessageConsumer#receiveNoWait()} can be called. */ - public MessageAvailableListener getAvailableListener(); + MessageAvailableListener getAvailableListener(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/MessageTransformer.java b/activemq-core/src/main/java/org/apache/activemq/MessageTransformer.java index 275da2ced5..5520cbddfc 100644 --- a/activemq-core/src/main/java/org/apache/activemq/MessageTransformer.java +++ b/activemq-core/src/main/java/org/apache/activemq/MessageTransformer.java @@ -33,10 +33,10 @@ public interface MessageTransformer { /** * Transforms the given message inside the producer before it is sent to the JMS bus. */ - public Message producerTransform(Session session, MessageProducer producer, Message message) throws JMSException; + Message producerTransform(Session session, MessageProducer producer, Message message) throws JMSException; /** * Transforms the given message inside the consumer before being dispatched to the client code */ - public Message consumerTransform(Session session, MessageConsumer consumer, Message message)throws JMSException; + Message consumerTransform(Session session, MessageConsumer consumer, Message message)throws JMSException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/Service.java b/activemq-core/src/main/java/org/apache/activemq/Service.java index c4e6c8ffdd..841a37da0b 100644 --- a/activemq-core/src/main/java/org/apache/activemq/Service.java +++ b/activemq-core/src/main/java/org/apache/activemq/Service.java @@ -29,8 +29,8 @@ package org.apache.activemq; */ public interface Service { - public void start() throws Exception; + void start() throws Exception; - public void stop() throws Exception; + void stop() throws Exception; } diff --git a/activemq-core/src/main/java/org/apache/activemq/StreamConnection.java b/activemq-core/src/main/java/org/apache/activemq/StreamConnection.java index e7180f896f..7983456f8f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/StreamConnection.java +++ b/activemq-core/src/main/java/org/apache/activemq/StreamConnection.java @@ -36,21 +36,21 @@ import javax.jms.Topic; */ public interface StreamConnection extends Connection { - public InputStream createInputStream(Destination dest) throws JMSException; + InputStream createInputStream(Destination dest) throws JMSException; - public InputStream createInputStream(Destination dest, String messageSelector) throws JMSException; + InputStream createInputStream(Destination dest, String messageSelector) throws JMSException; - public InputStream createInputStream(Destination dest, String messageSelector, boolean noLocal) throws JMSException; + InputStream createInputStream(Destination dest, String messageSelector, boolean noLocal) throws JMSException; - public InputStream createDurableInputStream(Topic dest, String name) throws JMSException; + InputStream createDurableInputStream(Topic dest, String name) throws JMSException; - public InputStream createDurableInputStream(Topic dest, String name, String messageSelector) throws JMSException; + InputStream createDurableInputStream(Topic dest, String name, String messageSelector) throws JMSException; - public InputStream createDurableInputStream(Topic dest, String name, String messageSelector, boolean noLocal) throws JMSException; + InputStream createDurableInputStream(Topic dest, String name, String messageSelector, boolean noLocal) throws JMSException; - public OutputStream createOutputStream(Destination dest) throws JMSException; + OutputStream createOutputStream(Destination dest) throws JMSException; - public OutputStream createOutputStream(Destination dest, Map streamProperties, int deliveryMode, int priority, long timeToLive) throws JMSException; + OutputStream createOutputStream(Destination dest, Map streamProperties, int deliveryMode, int priority, long timeToLive) throws JMSException; /** * Unsubscribes a durable subscription that has been created by a client. @@ -71,5 +71,5 @@ public interface StreamConnection extends Connection { * specified. * @since 1.1 */ - public void unsubscribe(String name) throws JMSException; + void unsubscribe(String name) throws JMSException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/ThreadPriorities.java b/activemq-core/src/main/java/org/apache/activemq/ThreadPriorities.java index 5aea8ddc39..1195358fad 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ThreadPriorities.java +++ b/activemq-core/src/main/java/org/apache/activemq/ThreadPriorities.java @@ -24,9 +24,9 @@ package org.apache.activemq; */ public interface ThreadPriorities { - public static final int INBOUND_BROKER_CONNECTION = 6; - public static final int OUT_BOUND_BROKER_DISPATCH = 6; - public static final int INBOUND_CLIENT_CONNECTION = 7; - public static final int INBOUND_CLIENT_SESSION = 7; - public static final int BROKER_MANAGEMENT = 9; + int INBOUND_BROKER_CONNECTION = 6; + int OUT_BOUND_BROKER_DISPATCH = 6; + int INBOUND_CLIENT_CONNECTION = 7; + int INBOUND_CLIENT_SESSION = 7; + int BROKER_MANAGEMENT = 9; } diff --git a/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java b/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java index 3145022901..f56ca0c1e5 100755 --- a/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java +++ b/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java @@ -62,10 +62,10 @@ import org.apache.commons.logging.LogFactory; */ public class TransactionContext implements XAResource { - static final private Log log = LogFactory.getLog(TransactionContext.class); + private static final Log LOG = LogFactory.getLog(TransactionContext.class); // XATransactionId -> ArrayList of TransactionContext objects - private static final ConcurrentHashMap endedXATransactionContexts = new ConcurrentHashMap(); + private static final ConcurrentHashMap ENDED_XA_TRANSACTION_CONTEXTS = new ConcurrentHashMap(); private final ActiveMQConnection connection; private final LongSequenceGenerator localTransactionIdGenerator; @@ -267,12 +267,12 @@ public class TransactionContext implements XAResource { */ public void start(Xid xid, int flags) throws XAException { - if (log.isDebugEnabled()) - log.debug("Start: " + xid); - - if (isInLocalTransaction()) + if (LOG.isDebugEnabled()) { + LOG.debug("Start: " + xid); + } + if (isInLocalTransaction()) { throw new XAException(XAException.XAER_PROTO); - + } // Are we already associated? if (associatedXid != null) { throw new XAException(XAException.XAER_PROTO); @@ -299,8 +299,8 @@ public class TransactionContext implements XAResource { public void end(Xid xid, int flags) throws XAException { - if (log.isDebugEnabled()) - log.debug("End: " + xid); + if (LOG.isDebugEnabled()) + LOG.debug("End: " + xid); if (isInLocalTransaction()) throw new XAException(XAException.XAER_PROTO); @@ -344,8 +344,8 @@ public class TransactionContext implements XAResource { } public int prepare(Xid xid) throws XAException { - if (log.isDebugEnabled()) - log.debug("Prepare: " + xid); + if (LOG.isDebugEnabled()) + LOG.debug("Prepare: " + xid); // We allow interleaving multiple transactions, so // we don't limit prepare to the associated xid. @@ -373,8 +373,8 @@ public class TransactionContext implements XAResource { public void rollback(Xid xid) throws XAException { - if (log.isDebugEnabled()) - log.debug("Rollback: " + xid); + if (LOG.isDebugEnabled()) + LOG.debug("Rollback: " + xid); // We allow interleaving multiple transactions, so // we don't limit rollback to the associated xid. @@ -398,7 +398,7 @@ public class TransactionContext implements XAResource { TransactionInfo info = new TransactionInfo(getConnectionId(), x, TransactionInfo.ROLLBACK); this.connection.syncSendPacket(info); - ArrayList l = (ArrayList)endedXATransactionContexts.remove(x); + ArrayList l = (ArrayList)ENDED_XA_TRANSACTION_CONTEXTS.remove(x); if (l != null && !l.isEmpty()) { for (Iterator iter = l.iterator(); iter.hasNext();) { TransactionContext ctx = (TransactionContext)iter.next(); @@ -414,8 +414,8 @@ public class TransactionContext implements XAResource { // XAResource interface public void commit(Xid xid, boolean onePhase) throws XAException { - if (log.isDebugEnabled()) - log.debug("Commit: " + xid); + if (LOG.isDebugEnabled()) + LOG.debug("Commit: " + xid); // We allow interleaving multiple transactions, so // we don't limit commit to the associated xid. @@ -437,7 +437,7 @@ public class TransactionContext implements XAResource { this.connection.syncSendPacket(info); - ArrayList l = (ArrayList)endedXATransactionContexts.remove(x); + ArrayList l = (ArrayList)ENDED_XA_TRANSACTION_CONTEXTS.remove(x); if (l != null && !l.isEmpty()) { for (Iterator iter = l.iterator(); iter.hasNext();) { TransactionContext ctx = (TransactionContext)iter.next(); @@ -452,8 +452,8 @@ public class TransactionContext implements XAResource { } public void forget(Xid xid) throws XAException { - if (log.isDebugEnabled()) - log.debug("Forget: " + xid); + if (LOG.isDebugEnabled()) + LOG.debug("Forget: " + xid); // We allow interleaving multiple transactions, so // we don't limit forget to the associated xid. @@ -494,8 +494,8 @@ public class TransactionContext implements XAResource { } public Xid[] recover(int flag) throws XAException { - if (log.isDebugEnabled()) - log.debug("Recover: " + flag); + if (LOG.isDebugEnabled()) + LOG.debug("Recover: " + flag); TransactionInfo info = new TransactionInfo(getConnectionId(), null, TransactionInfo.RECOVER); try { @@ -551,8 +551,8 @@ public class TransactionContext implements XAResource { TransactionInfo info = new TransactionInfo(connectionId, transactionId, TransactionInfo.BEGIN); try { this.connection.asyncSendPacket(info); - if (log.isDebugEnabled()) - log.debug("Started XA transaction: " + transactionId); + if (LOG.isDebugEnabled()) + LOG.debug("Started XA transaction: " + transactionId); } catch (JMSException e) { throw toXAException(e); } @@ -563,18 +563,18 @@ public class TransactionContext implements XAResource { TransactionInfo info = new TransactionInfo(connectionId, transactionId, TransactionInfo.END); try { this.connection.syncSendPacket(info); - if (log.isDebugEnabled()) - log.debug("Ended XA transaction: " + transactionId); + if (LOG.isDebugEnabled()) + LOG.debug("Ended XA transaction: " + transactionId); } catch (JMSException e) { throw toXAException(e); } // Add our self to the list of contexts that are interested in // post commit/rollback events. - ArrayList l = (ArrayList)endedXATransactionContexts.get(transactionId); + ArrayList l = (ArrayList)ENDED_XA_TRANSACTION_CONTEXTS.get(transactionId); if (l == null) { l = new ArrayList(3); - endedXATransactionContexts.put(transactionId, l); + ENDED_XA_TRANSACTION_CONTEXTS.put(transactionId, l); l.add(this); } else if (!l.contains(this)) { l.add(this); diff --git a/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java b/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java index 815227bfef..bdeb127156 100755 --- a/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java @@ -50,20 +50,20 @@ import org.apache.commons.logging.LogFactory; */ public class AdvisoryBroker extends BrokerFilter { - private static final Log log = LogFactory.getLog(AdvisoryBroker.class); + private static final Log LOG = LogFactory.getLog(AdvisoryBroker.class); + private static final IdGenerator ID_GENERATOR = new IdGenerator(); protected final ConcurrentHashMap connections = new ConcurrentHashMap(); protected final ConcurrentHashMap consumers = new ConcurrentHashMap(); protected final ConcurrentHashMap producers = new ConcurrentHashMap(); protected final ConcurrentHashMap destinations = new ConcurrentHashMap(); - - static final private IdGenerator idGenerator = new IdGenerator(); protected final ProducerId advisoryProducerId = new ProducerId(); - final private LongSequenceGenerator messageIdGenerator = new LongSequenceGenerator(); + + private final LongSequenceGenerator messageIdGenerator = new LongSequenceGenerator(); public AdvisoryBroker(Broker next) { super(next); - advisoryProducerId.setConnectionId(idGenerator.generateId()); + advisoryProducerId.setConnectionId(ID_GENERATOR.generateId()); } public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { @@ -238,7 +238,7 @@ public class AdvisoryBroker extends BrokerFilter { ActiveMQTopic topic = AdvisorySupport.getExpiredMessageTopic(messageReference.getMessage().getDestination()); fireAdvisory(context, topic, messageReference.getMessage()); } catch (Exception e) { - log.warn("Failed to fire message expired advisory"); + LOG.warn("Failed to fire message expired advisory"); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerEventSource.java b/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerEventSource.java index b7fb5ad2d3..0402c499f7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerEventSource.java +++ b/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerEventSource.java @@ -44,7 +44,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class ConsumerEventSource implements Service, MessageListener { - private static final Log log = LogFactory.getLog(ConsumerEventSource.class); + private static final Log LOG = LogFactory.getLog(ConsumerEventSource.class); private final Connection connection; private final ActiveMQDestination destination; @@ -97,10 +97,10 @@ public class ConsumerEventSource implements Service, MessageListener { fireConsumerEvent(new ConsumerStoppedEvent(this, destination, (ConsumerId)removeInfo.getObjectId(), count)); } } else { - log.warn("Unknown command: " + command); + LOG.warn("Unknown command: " + command); } } else { - log.warn("Unknown message type: " + message + ". Message ignored"); + LOG.warn("Unknown message type: " + message + ". Message ignored"); } } @@ -116,9 +116,9 @@ public class ConsumerEventSource implements Service, MessageListener { Number n = (Number)value; return n.intValue(); } - log.warn("No consumerCount header available on the message: " + message); + LOG.warn("No consumerCount header available on the message: " + message); } catch (Exception e) { - log.warn("Failed to extract consumerCount from message: " + message + ".Reason: " + e, e); + LOG.warn("Failed to extract consumerCount from message: " + message + ".Reason: " + e, e); } return count; } diff --git a/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerListener.java b/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerListener.java index f3ed438fe8..1ee80738e9 100644 --- a/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerListener.java @@ -23,5 +23,5 @@ package org.apache.activemq.advisory; */ public interface ConsumerListener { - public void onConsumerEvent(ConsumerEvent event); + void onConsumerEvent(ConsumerEvent event); } diff --git a/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerStartedEvent.java b/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerStartedEvent.java index 1d6b42c51a..90c299aa94 100644 --- a/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerStartedEvent.java +++ b/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerStartedEvent.java @@ -28,7 +28,7 @@ public class ConsumerStartedEvent extends ConsumerEvent { private static final long serialVersionUID = 5088138839609391074L; - private transient final ConsumerInfo consumerInfo; + private final transient ConsumerInfo consumerInfo; public ConsumerStartedEvent(ConsumerEventSource source, ActiveMQDestination destination, ConsumerInfo consumerInfo, int count) { super(source, destination, consumerInfo.getConsumerId(), count); diff --git a/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerEventSource.java b/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerEventSource.java index 6cf02a9fd5..2ca45d7404 100644 --- a/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerEventSource.java +++ b/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerEventSource.java @@ -44,7 +44,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 359679 $ */ public class ProducerEventSource implements Service, MessageListener { - private static final Log log = LogFactory.getLog(ProducerEventSource.class); + private static final Log LOG = LogFactory.getLog(ProducerEventSource.class); private final Connection connection; private final ActiveMQDestination destination; @@ -97,10 +97,10 @@ public class ProducerEventSource implements Service, MessageListener { fireProducerEvent(new ProducerStoppedEvent(this, destination, (ProducerId)removeInfo.getObjectId(), count)); } } else { - log.warn("Unknown command: " + command); + LOG.warn("Unknown command: " + command); } } else { - log.warn("Unknown message type: " + message + ". Message ignored"); + LOG.warn("Unknown message type: " + message + ". Message ignored"); } } @@ -111,9 +111,9 @@ public class ProducerEventSource implements Service, MessageListener { Number n = (Number)value; return n.intValue(); } - log.warn("No producerCount header available on the message: " + message); + LOG.warn("No producerCount header available on the message: " + message); } catch (Exception e) { - log.warn("Failed to extract producerCount from message: " + message + ".Reason: " + e, e); + LOG.warn("Failed to extract producerCount from message: " + message + ".Reason: " + e, e); } return count; } diff --git a/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerListener.java b/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerListener.java index 7f95218903..3924174285 100644 --- a/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerListener.java @@ -23,5 +23,5 @@ package org.apache.activemq.advisory; */ public interface ProducerListener { - public void onProducerEvent(ProducerEvent event); + void onProducerEvent(ProducerEvent event); } diff --git a/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerStartedEvent.java b/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerStartedEvent.java index 2ba8f3f950..2313b75af6 100644 --- a/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerStartedEvent.java +++ b/activemq-core/src/main/java/org/apache/activemq/advisory/ProducerStartedEvent.java @@ -28,7 +28,7 @@ public class ProducerStartedEvent extends ProducerEvent { private static final long serialVersionUID = 5088138839609391074L; - private transient final ProducerInfo consumerInfo; + private final transient ProducerInfo consumerInfo; public ProducerStartedEvent(ProducerEventSource source, ActiveMQDestination destination, ProducerInfo consumerInfo, int count) { super(source, destination, consumerInfo.getProducerId(), count); diff --git a/activemq-core/src/main/java/org/apache/activemq/blob/BlobTransferPolicy.java b/activemq-core/src/main/java/org/apache/activemq/blob/BlobTransferPolicy.java index 3bc846b49a..e4857acf01 100644 --- a/activemq-core/src/main/java/org/apache/activemq/blob/BlobTransferPolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/blob/BlobTransferPolicy.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/blob/BlobUploadStrategy.java b/activemq-core/src/main/java/org/apache/activemq/blob/BlobUploadStrategy.java index f27920642d..8778acd1c4 100644 --- a/activemq-core/src/main/java/org/apache/activemq/blob/BlobUploadStrategy.java +++ b/activemq-core/src/main/java/org/apache/activemq/blob/BlobUploadStrategy.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/blob/BlobUploader.java b/activemq-core/src/main/java/org/apache/activemq/blob/BlobUploader.java index c0bdcaec90..fd1070e2c5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/blob/BlobUploader.java +++ b/activemq-core/src/main/java/org/apache/activemq/blob/BlobUploader.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/blob/DefaultBlobUploadStrategy.java b/activemq-core/src/main/java/org/apache/activemq/blob/DefaultBlobUploadStrategy.java index 48568f8221..164fd82a23 100644 --- a/activemq-core/src/main/java/org/apache/activemq/blob/DefaultBlobUploadStrategy.java +++ b/activemq-core/src/main/java/org/apache/activemq/blob/DefaultBlobUploadStrategy.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java b/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java index 3e14b362fb..802c8cae9f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java @@ -46,22 +46,22 @@ public interface Broker extends Region, Service { * @param type * @return */ - public Broker getAdaptor(Class type); + Broker getAdaptor(Class type); /** * Get the id of the broker */ - public BrokerId getBrokerId(); + BrokerId getBrokerId(); /** * Get the name of the broker */ - public String getBrokerName(); + String getBrokerName(); /** * A remote Broker connects */ - public void addBroker(Connection connection, BrokerInfo info); + void addBroker(Connection connection, BrokerInfo info); /** * Remove a BrokerInfo @@ -69,14 +69,14 @@ public interface Broker extends Region, Service { * @param connection * @param info */ - public void removeBroker(Connection connection, BrokerInfo info); + void removeBroker(Connection connection, BrokerInfo info); /** * A client is establishing a connection with the broker. * * @throws Exception TODO */ - public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception; + void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception; /** * A client is disconnecting from the broker. @@ -87,7 +87,7 @@ public interface Broker extends Region, Service { * that caused the client to disconnect. * @throws Exception TODO */ - public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception; + void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception; /** * Adds a session. @@ -96,7 +96,7 @@ public interface Broker extends Region, Service { * @param info * @throws Exception TODO */ - public void addSession(ConnectionContext context, SessionInfo info) throws Exception; + void addSession(ConnectionContext context, SessionInfo info) throws Exception; /** * Removes a session. @@ -105,7 +105,7 @@ public interface Broker extends Region, Service { * @param info * @throws Exception TODO */ - public void removeSession(ConnectionContext context, SessionInfo info) throws Exception; + void removeSession(ConnectionContext context, SessionInfo info) throws Exception; /** * Adds a producer. @@ -113,7 +113,7 @@ public interface Broker extends Region, Service { * @param context the enviorment the operation is being executed under. * @throws Exception TODO */ - public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception; + void addProducer(ConnectionContext context, ProducerInfo info) throws Exception; /** * Removes a producer. @@ -121,19 +121,19 @@ public interface Broker extends Region, Service { * @param context the enviorment the operation is being executed under. * @throws Exception TODO */ - public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception; + void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception; /** * @return all clients added to the Broker. * @throws Exception TODO */ - public Connection[] getClients() throws Exception; + Connection[] getClients() throws Exception; /** * @return all destinations added to the Broker. * @throws Exception TODO */ - public ActiveMQDestination[] getDestinations() throws Exception; + ActiveMQDestination[] getDestinations() throws Exception; /** * Gets a list of all the prepared xa transactions. @@ -142,7 +142,7 @@ public interface Broker extends Region, Service { * @return * @throws Exception TODO */ - public TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception; + TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception; /** * Starts a transaction. @@ -151,7 +151,7 @@ public interface Broker extends Region, Service { * @param xid * @throws Exception TODO */ - public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception; + void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception; /** * Prepares a transaction. Only valid for xa transactions. @@ -161,7 +161,7 @@ public interface Broker extends Region, Service { * @return id * @throws Exception TODO */ - public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception; + int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception; /** * Rollsback a transaction. @@ -171,7 +171,7 @@ public interface Broker extends Region, Service { * @throws Exception TODO */ - public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception; + void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception; /** * Commits a transaction. @@ -181,7 +181,7 @@ public interface Broker extends Region, Service { * @param onePhase * @throws Exception TODO */ - public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception; + void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception; /** * Forgets a transaction. @@ -190,7 +190,7 @@ public interface Broker extends Region, Service { * @param transactionId * @throws Exception */ - public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception; + void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception; /** * Get the BrokerInfo's of any connected Brokers @@ -204,24 +204,24 @@ public interface Broker extends Region, Service { * * @param messageDispatch */ - public void preProcessDispatch(MessageDispatch messageDispatch); + void preProcessDispatch(MessageDispatch messageDispatch); /** * Notify the Broker that a dispatch has happened * * @param messageDispatch */ - public void postProcessDispatch(MessageDispatch messageDispatch); + void postProcessDispatch(MessageDispatch messageDispatch); /** * @return true if the broker has stopped */ - public boolean isStopped(); + boolean isStopped(); /** * @return a Set of all durable destinations */ - public Set getDurableDestinations(); + Set getDurableDestinations(); /** * Add and process a DestinationInfo object @@ -230,7 +230,7 @@ public interface Broker extends Region, Service { * @param info * @throws Exception */ - public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception; + void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception; /** * Remove and process a DestinationInfo object @@ -239,18 +239,18 @@ public interface Broker extends Region, Service { * @param info * @throws Exception */ - public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception; + void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception; /** * @return true if fault tolerant */ - public boolean isFaultTolerantConfiguration(); + boolean isFaultTolerantConfiguration(); /** * @return the connection context used to make administration operations on * startup or via JMX MBeans */ - public abstract ConnectionContext getAdminConnectionContext(); + ConnectionContext getAdminConnectionContext(); /** * Sets the default administration connection context used when configuring @@ -258,22 +258,22 @@ public interface Broker extends Region, Service { * * @param adminConnectionContext */ - public abstract void setAdminConnectionContext(ConnectionContext adminConnectionContext); + void setAdminConnectionContext(ConnectionContext adminConnectionContext); /** * @return the temp data store */ - public Store getTempDataStore(); + Store getTempDataStore(); /** * @return the URI that can be used to connect to the local Broker */ - public URI getVmConnectorURI(); + URI getVmConnectorURI(); /** * called when the brokerService starts */ - public void brokerServiceStarted(); + void brokerServiceStarted(); /** * @return the BrokerService @@ -295,7 +295,7 @@ public interface Broker extends Region, Service { * @param messageReference * @return true if the message is expired */ - public boolean isExpired(MessageReference messageReference); + boolean isExpired(MessageReference messageReference); /** * A Message has Expired @@ -303,7 +303,7 @@ public interface Broker extends Region, Service { * @param context * @param messageReference */ - public void messageExpired(ConnectionContext context, MessageReference messageReference); + void messageExpired(ConnectionContext context, MessageReference messageReference); /** * A message needs to go the a DLQ @@ -311,6 +311,6 @@ public interface Broker extends Region, Service { * @param context * @param messageReference */ - public void sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference); + void sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFactory.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFactory.java index 96c4713336..6c5519ff05 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFactory.java @@ -31,12 +31,11 @@ import org.apache.activemq.util.IOExceptionSupport; */ public class BrokerFactory { - static final private FactoryFinder brokerFactoryHandlerFinder = new FactoryFinder( - "META-INF/services/org/apache/activemq/broker/"); + private static final FactoryFinder BROKER_FACTORY_HANDLER_FINDER = new FactoryFinder("META-INF/services/org/apache/activemq/broker/"); public static BrokerFactoryHandler createBrokerFactoryHandler(String type) throws IOException { try { - return (BrokerFactoryHandler)brokerFactoryHandlerFinder.newInstance(type); + return (BrokerFactoryHandler)BROKER_FACTORY_HANDLER_FINDER.newInstance(type); } catch (Throwable e) { throw IOExceptionSupport.create("Could load " + type + " factory:" + e, e); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFactoryHandler.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFactoryHandler.java index 7180ec5ec5..98b5bfac1b 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFactoryHandler.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFactoryHandler.java @@ -24,5 +24,5 @@ import java.net.URI; * @version $Revision$ */ public interface BrokerFactoryHandler { - public BrokerService createBroker(URI brokerURI) throws Exception; + BrokerService createBroker(URI brokerURI) throws Exception; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java index f9f20fa610..ff03bbcf86 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java @@ -48,7 +48,7 @@ import org.apache.activemq.kaha.Store; */ public class BrokerFilter implements Broker { - final protected Broker next; + protected final Broker next; public BrokerFilter(Broker next) { this.next = next; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPlugin.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPlugin.java index 47fcabc63b..79987d1dcf 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPlugin.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPlugin.java @@ -27,6 +27,6 @@ public interface BrokerPlugin { * Installs the plugin into the interceptor chain of the broker, returning the new * intercepted broker to use. */ - public Broker installPlugin(Broker broker) throws Exception; + Broker installPlugin(Broker broker) throws Exception; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java index c649ae3c9b..912ff2c864 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker; import java.util.HashMap; @@ -24,16 +26,16 @@ import org.apache.commons.logging.LogFactory; */ public class BrokerRegistry { - private static final Log log = LogFactory.getLog(BrokerRegistry.class); - static final private BrokerRegistry instance = new BrokerRegistry(); - - public static BrokerRegistry getInstance() { - return instance; - } + private static final Log LOG = LogFactory.getLog(BrokerRegistry.class); + private static final BrokerRegistry INSTANCE = new BrokerRegistry(); private final Object mutex = new Object(); private final HashMap brokers = new HashMap(); + public static BrokerRegistry getInstance() { + return INSTANCE; + } + /** * @param brokerName * @return the BrokerService @@ -45,7 +47,7 @@ public class BrokerRegistry { if (result == null && brokerName != null && brokerName.equals(BrokerService.DEFAULT_BROKER_NAME)) { result = findFirst(); if (result != null) { - log.warn("Broker localhost not started so using " + result.getBrokerName() + " instead"); + LOG.warn("Broker localhost not started so using " + result.getBrokerName() + " instead"); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerServiceAware.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerServiceAware.java index 52bfe18bde..4c6e023283 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerServiceAware.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerServiceAware.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -24,5 +24,5 @@ package org.apache.activemq.broker; */ public interface BrokerServiceAware { - public void setBrokerService(BrokerService brokerService); + void setBrokerService(BrokerService brokerService); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/Connection.java b/activemq-core/src/main/java/org/apache/activemq/broker/Connection.java index f77b27f81d..1344e5d0df 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/Connection.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/Connection.java @@ -31,78 +31,78 @@ public interface Connection extends Service { /** * @return the connector that created this connection. */ - public Connector getConnector(); + Connector getConnector(); /** * Sends a message to the client. * * @param message the message to send to the client. */ - public void dispatchSync(Command message); + void dispatchSync(Command message); /** * Sends a message to the client. * * @param command */ - public void dispatchAsync(Command command); + void dispatchAsync(Command command); /** * Services a client command and submits it to the broker. * * @param command */ - public Response service(Command command); + Response service(Command command); /** * Handles an unexpected error associated with a connection. * * @param error */ - public void serviceException(Throwable error); + void serviceException(Throwable error); /** * @return true if the Connection is slow */ - public boolean isSlow(); + boolean isSlow(); /** * @return if after being marked, the Connection is still writing */ - public boolean isBlocked(); + boolean isBlocked(); /** * @return true if the Connection is connected */ - public boolean isConnected(); + boolean isConnected(); /** * @return true if the Connection is active */ - public boolean isActive(); + boolean isActive(); /** * Returns the number of messages to be dispatched to this connection */ - public int getDispatchQueueSize(); + int getDispatchQueueSize(); /** * Returns the statistics for this connection */ - public ConnectionStatistics getStatistics(); + ConnectionStatistics getStatistics(); /** * @return true if the Connection will process control commands */ - public boolean isManageable(); + boolean isManageable(); /** * @return the source address for this connection */ - public String getRemoteAddress(); + String getRemoteAddress(); - public void serviceExceptionAsync(IOException e); + void serviceExceptionAsync(IOException e); - public String getConnectionId(); + String getConnectionId(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/Connector.java b/activemq-core/src/main/java/org/apache/activemq/broker/Connector.java index 308bd70e16..15a8d883a6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/Connector.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/Connector.java @@ -31,10 +31,10 @@ public interface Connector extends Service { * * @return */ - public BrokerInfo getBrokerInfo(); + BrokerInfo getBrokerInfo(); /** * @return the statistics for this connector */ - public ConnectorStatistics getStatistics(); + ConnectorStatistics getStatistics(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/ConsumerBrokerExchange.java b/activemq-core/src/main/java/org/apache/activemq/broker/ConsumerBrokerExchange.java index 91f5253a81..5fffb52c50 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/ConsumerBrokerExchange.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/ConsumerBrokerExchange.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker; import org.apache.activemq.broker.region.Destination; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/ProducerBrokerExchange.java b/activemq-core/src/main/java/org/apache/activemq/broker/ProducerBrokerExchange.java index d6687bd12b..9075fb1f58 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/ProducerBrokerExchange.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/ProducerBrokerExchange.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker; import org.apache.activemq.broker.region.Destination; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/TransactionBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/TransactionBroker.java index eacb5d2725..6667cb1ce3 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/TransactionBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/TransactionBroker.java @@ -51,7 +51,7 @@ import org.apache.commons.logging.LogFactory; */ public class TransactionBroker extends BrokerFilter { - private static final Log log = LogFactory.getLog(TransactionBroker.class); + private static final Log LOG = LogFactory.getLog(TransactionBroker.class); // The prepared XA transactions. private TransactionStore transactionStore; @@ -222,8 +222,8 @@ public class TransactionBroker extends BrokerFilter { if (sync != null && transaction != null) { transaction.removeSynchronization(sync); } - if (log.isDebugEnabled()) { - log.debug("IGNORING duplicate message " + message); + if (LOG.isDebugEnabled()) { + LOG.debug("IGNORING duplicate message " + message); } } } @@ -234,7 +234,7 @@ public class TransactionBroker extends BrokerFilter { Transaction transaction = (Transaction)iter.next(); transaction.rollback(); } catch (Exception e) { - log.warn("ERROR Rolling back disconnected client's transactions: ", e); + LOG.warn("ERROR Rolling back disconnected client's transactions: ", e); } iter.remove(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java b/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java index b67f102fcf..af39344c66 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker; import java.io.IOException; @@ -143,7 +145,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi private boolean networkConnection; private AtomicInteger protocolVersion = new AtomicInteger(CommandTypes.PROTOCOL_VERSION); private DemandForwardingBridge duplexBridge; - final private TaskRunnerFactory taskRunnerFactory; + private final TaskRunnerFactory taskRunnerFactory; private TransportConnectionState connectionState; static class TransportConnectionState extends org.apache.activemq.state.ConnectionState { @@ -366,7 +368,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processBeginTransaction(TransactionInfo info) throws Exception { + public synchronized Response processBeginTransaction(TransactionInfo info) throws Exception { TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); context = null; if (cs != null) { @@ -383,14 +385,14 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processEndTransaction(TransactionInfo info) throws Exception { + public synchronized Response processEndTransaction(TransactionInfo info) throws Exception { // No need to do anything. This packet is just sent by the client // make sure he is synced with the server as commit command could // come from a different connection. return null; } - synchronized public Response processPrepareTransaction(TransactionInfo info) throws Exception { + public synchronized Response processPrepareTransaction(TransactionInfo info) throws Exception { TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); context = null; if (cs != null) { @@ -415,7 +417,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi } } - synchronized public Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception { + public synchronized Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception { TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); context = cs.getContext(); cs.removeTransactionState(info.getTransactionId()); @@ -423,7 +425,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception { + public synchronized Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception { TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); context = cs.getContext(); cs.removeTransactionState(info.getTransactionId()); @@ -431,7 +433,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processRollbackTransaction(TransactionInfo info) throws Exception { + public synchronized Response processRollbackTransaction(TransactionInfo info) throws Exception { TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); context = cs.getContext(); cs.removeTransactionState(info.getTransactionId()); @@ -439,14 +441,14 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processForgetTransaction(TransactionInfo info) throws Exception { + public synchronized Response processForgetTransaction(TransactionInfo info) throws Exception { TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); context = cs.getContext(); broker.forgetTransaction(context, info.getTransactionId()); return null; } - synchronized public Response processRecoverTransactions(TransactionInfo info) throws Exception { + public synchronized Response processRecoverTransactions(TransactionInfo info) throws Exception { TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); context = cs.getContext(); TransactionId[] preparedTransactions = broker.getPreparedTransactions(context); @@ -475,7 +477,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processAddDestination(DestinationInfo info) throws Exception { + public synchronized Response processAddDestination(DestinationInfo info) throws Exception { TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); broker.addDestinationInfo(cs.getContext(), info); if (info.getDestination().isTemporary()) { @@ -484,7 +486,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processRemoveDestination(DestinationInfo info) throws Exception { + public synchronized Response processRemoveDestination(DestinationInfo info) throws Exception { TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); broker.removeDestinationInfo(cs.getContext(), info); if (info.getDestination().isTemporary()) { @@ -493,7 +495,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processAddProducer(ProducerInfo info) throws Exception { + public synchronized Response processAddProducer(ProducerInfo info) throws Exception { SessionId sessionId = info.getProducerId().getParentId(); ConnectionId connectionId = sessionId.getParentId(); TransportConnectionState cs = lookupConnectionState(connectionId); @@ -512,7 +514,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processRemoveProducer(ProducerId id) throws Exception { + public synchronized Response processRemoveProducer(ProducerId id) throws Exception { SessionId sessionId = id.getParentId(); ConnectionId connectionId = sessionId.getParentId(); TransportConnectionState cs = lookupConnectionState(connectionId); @@ -527,7 +529,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processAddConsumer(ConsumerInfo info) throws Exception { + public synchronized Response processAddConsumer(ConsumerInfo info) throws Exception { SessionId sessionId = info.getConsumerId().getParentId(); ConnectionId connectionId = sessionId.getParentId(); TransportConnectionState cs = lookupConnectionState(connectionId); @@ -546,7 +548,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processRemoveConsumer(ConsumerId id) throws Exception { + public synchronized Response processRemoveConsumer(ConsumerId id) throws Exception { SessionId sessionId = id.getParentId(); ConnectionId connectionId = sessionId.getParentId(); TransportConnectionState cs = lookupConnectionState(connectionId); @@ -561,7 +563,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processAddSession(SessionInfo info) throws Exception { + public synchronized Response processAddSession(SessionInfo info) throws Exception { ConnectionId connectionId = info.getSessionId().getParentId(); TransportConnectionState cs = lookupConnectionState(connectionId); // Avoid replaying dup commands @@ -576,7 +578,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processRemoveSession(SessionId id) throws Exception { + public synchronized Response processRemoveSession(SessionId id) throws Exception { ConnectionId connectionId = id.getParentId(); TransportConnectionState cs = lookupConnectionState(connectionId); SessionState session = cs.getSessionState(id); @@ -665,7 +667,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return null; } - synchronized public Response processRemoveConnection(ConnectionId id) { + public synchronized Response processRemoveConnection(ConnectionId id) { TransportConnectionState cs = lookupConnectionState(id); // Don't allow things to be added to the connection state while we are // shutting down. @@ -1061,7 +1063,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi return starting; } - synchronized protected void setStarting(boolean starting) { + protected synchronized void setStarting(boolean starting) { this.starting = starting; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/TransportStatusDetector.java b/activemq-core/src/main/java/org/apache/activemq/broker/TransportStatusDetector.java index 06546b7d2a..3992b289c2 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/TransportStatusDetector.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/TransportStatusDetector.java @@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.5 $ */ public class TransportStatusDetector implements Service, Runnable { - private static final Log log = LogFactory.getLog(TransportStatusDetector.class); + private static final Log LOG = LogFactory.getLog(TransportStatusDetector.class); private TransportConnector connector; private Set collectionCandidates = new CopyOnWriteArraySet(); private AtomicBoolean started = new AtomicBoolean(false); @@ -86,11 +86,11 @@ public class TransportStatusDetector implements Service, Runnable { } protected void doCollection(TransportConnection tc) { - log.warn("found a blocked client - stopping: " + tc); + LOG.warn("found a blocked client - stopping: " + tc); try { tc.stop(); } catch (Exception e) { - log.error("Error stopping " + tc, e); + LOG.error("Error stopping " + tc, e); } } @@ -101,7 +101,7 @@ public class TransportStatusDetector implements Service, Runnable { doSweep(); Thread.sleep(sweepInterval); } catch (Throwable e) { - log.error("failed to complete a sweep for blocked clients", e); + LOG.error("failed to complete a sweep for blocked clients", e); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java index f504d71e98..adaa256f22 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.ft; import java.util.concurrent.atomic.AtomicBoolean; @@ -51,7 +53,7 @@ import org.apache.commons.logging.LogFactory; */ public class MasterBroker extends InsertableMutableBrokerFilter { - private static final Log log = LogFactory.getLog(MasterBroker.class); + private static final Log LOG = LogFactory.getLog(MasterBroker.class); private Transport slave; private AtomicBoolean started = new AtomicBoolean(false); @@ -86,7 +88,7 @@ public class MasterBroker extends InsertableMutableBrokerFilter { } } } catch (Exception e) { - log.error("Failed to get Connections", e); + LOG.error("Failed to get Connections", e); } } @@ -344,7 +346,7 @@ public class MasterBroker extends InsertableMutableBrokerFilter { try { slave.oneway(command); } catch (Throwable e) { - log.error("Slave Failed", e); + LOG.error("Slave Failed", e); stopProcessing(); } } @@ -354,10 +356,10 @@ public class MasterBroker extends InsertableMutableBrokerFilter { Response response = (Response)slave.request(command); if (response.isException()) { ExceptionResponse er = (ExceptionResponse)response; - log.error("Slave Failed", er.getException()); + LOG.error("Slave Failed", er.getException()); } } catch (Throwable e) { - log.error("Slave Failed", e); + LOG.error("Slave Failed", e); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java b/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java index e1522cbffa..2909d2fb0c 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java @@ -55,7 +55,7 @@ import org.apache.commons.logging.LogFactory; */ public class MasterConnector implements Service, BrokerServiceAware { - private static final Log log = LogFactory.getLog(MasterConnector.class); + private static final Log LOG = LogFactory.getLog(MasterConnector.class); private BrokerService broker; private URI remoteURI; private URI localURI; @@ -104,7 +104,7 @@ public class MasterConnector implements Service, BrokerServiceAware { } localBroker = TransportFactory.connect(localURI); remoteBroker = TransportFactory.connect(remoteURI); - log.info("Starting a network connection between " + localBroker + " and " + remoteBroker + " has been established."); + LOG.info("Starting a network connection between " + localBroker + " and " + remoteBroker + " has been established."); localBroker.setTransportListener(new DefaultTransportListener() { public void onCommand(Object command) { @@ -141,7 +141,7 @@ public class MasterConnector implements Service, BrokerServiceAware { startBridge(); } catch (Exception e) { masterActive.set(false); - log.error("Failed to start network bridge: " + e, e); + LOG.error("Failed to start network bridge: " + e, e); } } }; @@ -175,7 +175,7 @@ public class MasterConnector implements Service, BrokerServiceAware { brokerInfo.setPeerBrokerInfos(broker.getBroker().getPeerBrokerInfos()); brokerInfo.setSlaveBroker(true); remoteBroker.oneway(brokerInfo); - log.info("Slave connection between " + localBroker + " and " + remoteBroker + " has been established."); + LOG.info("Slave connection between " + localBroker + " and " + remoteBroker + " has been established."); } public void stop() throws Exception { @@ -192,7 +192,7 @@ public class MasterConnector implements Service, BrokerServiceAware { remoteBroker.oneway(new ShutdownInfo()); localBroker.oneway(new ShutdownInfo()); } catch (IOException e) { - log.debug("Caught exception stopping", e); + LOG.debug("Caught exception stopping", e); } finally { ServiceStopper ss = new ServiceStopper(); ss.stop(localBroker); @@ -202,7 +202,7 @@ public class MasterConnector implements Service, BrokerServiceAware { } protected void serviceRemoteException(IOException error) { - log.error("Network connection between " + localBroker + " and " + remoteBroker + " shutdown: " + error.getMessage(), error); + LOG.error("Network connection between " + localBroker + " and " + remoteBroker + " shutdown: " + error.getMessage(), error); shutDown(); } @@ -213,7 +213,7 @@ public class MasterConnector implements Service, BrokerServiceAware { command = md.getMessage(); } if (command.getDataStructureType() == CommandTypes.SHUTDOWN_INFO) { - log.warn("The Master has shutdown"); + LOG.warn("The Master has shutdown"); shutDown(); } else { boolean responseRequired = command.isResponseRequired(); @@ -232,7 +232,7 @@ public class MasterConnector implements Service, BrokerServiceAware { } protected void serviceLocalException(Throwable error) { - log.info("Network connection between " + localBroker + " and " + remoteBroker + " shutdown: " + error.getMessage(), error); + LOG.info("Network connection between " + localBroker + " and " + remoteBroker + " shutdown: " + error.getMessage(), error); ServiceSupport.dispose(this); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java index 494c10bffe..c64239828d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java @@ -22,85 +22,105 @@ import org.apache.activemq.Service; public interface BrokerViewMBean extends Service { - /** - * @return The unique id of the broker. - */ - public abstract String getBrokerId(); + /** + * @return The unique id of the broker. + */ + String getBrokerId(); /** - * The Broker will fush it's caches so that the garbage - * collector can recalaim more memory. + * The Broker will fush it's caches so that the garbage collector can + * recalaim more memory. * * @throws Exception */ - public void gc() throws Exception; - - - public void resetStatistics(); - - public void enableStatistics(); - public void disableStatistics(); - public boolean isStatisticsEnabled(); - - public long getTotalEnqueueCount(); - public long getTotalDequeueCount(); - public long getTotalConsumerCount(); - public long getTotalMessageCount(); - - public int getMemoryPercentageUsed(); - public long getMemoryLimit(); - public void setMemoryLimit(long limit); + void gc() throws Exception; + + void resetStatistics(); + + void enableStatistics(); + + void disableStatistics(); + + boolean isStatisticsEnabled(); + + long getTotalEnqueueCount(); + + long getTotalDequeueCount(); + + long getTotalConsumerCount(); + + long getTotalMessageCount(); + + int getMemoryPercentageUsed(); + + long getMemoryLimit(); + + void setMemoryLimit(long limit); /** * Shuts down the JVM. - * @param exitCode the exit code that will be reported by the JVM process when it exits. + * + * @param exitCode the exit code that will be reported by the JVM process + * when it exits. */ - public void terminateJVM(int exitCode); - + void terminateJVM(int exitCode); + /** * Stop the broker and all it's components. */ - public void stop() throws Exception; - - public ObjectName[] getTopics(); - public ObjectName[] getQueues(); - public ObjectName[] getTemporaryTopics(); - public ObjectName[] getTemporaryQueues(); - - public ObjectName[] getTopicSubscribers(); - public ObjectName[] getDurableTopicSubscribers(); - public ObjectName[] getInactiveDurableTopicSubscribers(); - public ObjectName[] getQueueSubscribers(); - public ObjectName[] getTemporaryTopicSubscribers(); - public ObjectName[] getTemporaryQueueSubscribers(); - - /** + void stop() throws Exception; + + ObjectName[] getTopics(); + + ObjectName[] getQueues(); + + ObjectName[] getTemporaryTopics(); + + ObjectName[] getTemporaryQueues(); + + ObjectName[] getTopicSubscribers(); + + ObjectName[] getDurableTopicSubscribers(); + + ObjectName[] getInactiveDurableTopicSubscribers(); + + ObjectName[] getQueueSubscribers(); + + ObjectName[] getTemporaryTopicSubscribers(); + + ObjectName[] getTemporaryQueueSubscribers(); + + /** * Adds a Topic destination to the broker. + * * @param name The name of the Topic * @throws Exception */ - public void addTopic(String name) throws Exception; + void addTopic(String name) throws Exception; /** * Adds a Queue destination to the broker. + * * @param name The name of the Queue * @throws Exception */ - public void addQueue(String name) throws Exception; + void addQueue(String name) throws Exception; - /** + /** * Removes a Topic destination from the broker. + * * @param name The name of the Topic * @throws Exception */ - public void removeTopic(String name) throws Exception; + void removeTopic(String name) throws Exception; /** * Removes a Queue destination from the broker. + * * @param name The name of the Queue * @throws Exception */ - public void removeQueue(String name) throws Exception; + void removeQueue(String name) throws Exception; /** * Creates a new durable topic subscriber @@ -109,10 +129,9 @@ public interface BrokerViewMBean extends Service { * @param subscriberName the durable subscriber name * @param topicName the name of the topic to subscribe to * @param selector a selector or null - * * @return the object name of the MBean registered in JMX */ - public ObjectName createDurableSubscriber(String clientId, String subscriberName, String topicName, String selector) throws Exception; + ObjectName createDurableSubscriber(String clientId, String subscriberName, String topicName, String selector) throws Exception; /** * Destroys a durable subscriber @@ -120,6 +139,6 @@ public interface BrokerViewMBean extends Service { * @param clientId the JMS client ID * @param subscriberName the durable subscriber name */ - public void destroyDurableSubscriber(String clientId, String subscriberName) throws Exception; - + void destroyDurableSubscriber(String clientId, String subscriberName) throws Exception; + } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java index 1be0aaff74..25defc8bb7 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java @@ -22,52 +22,52 @@ public interface ConnectionViewMBean extends Service { /** * @return true if the Connection is slow */ - public boolean isSlow(); + boolean isSlow(); /** * @return if after being marked, the Connection is still writing */ - public boolean isBlocked(); + boolean isBlocked(); /** * @return true if the Connection is connected */ - public boolean isConnected(); + boolean isConnected(); /** * @return true if the Connection is active */ - public boolean isActive(); + boolean isActive(); /** * Returns the number of messages to be dispatched to this connection */ - public int getDispatchQueueSize(); + int getDispatchQueueSize(); /** * Resets the statistics */ - public void resetStatistics(); + void resetStatistics(); /** * Returns the number of messages enqueued on this connection * * @return the number of messages enqueued on this connection */ - public long getEnqueueCount(); + long getEnqueueCount(); /** * Returns the number of messages dequeued on this connection * * @return the number of messages dequeued on this connection */ - public long getDequeueCount(); + long getDequeueCount(); /** * Returns the source address for this connection * * @return the souce address for this connection */ - public String getRemoteAddress(); + String getRemoteAddress(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java index 2617fcfc4a..662ac7a032 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java @@ -46,37 +46,36 @@ public class ConnectorView implements ConnectorViewMBean { public BrokerInfo getBrokerInfo() { return connector.getBrokerInfo(); } - + /** * Resets the statistics */ public void resetStatistics() { connector.getStatistics().reset(); } - - + /** * enable statistics gathering - */ + */ public void enableStatistics() { - connector.getStatistics().setEnabled(true); - } - + connector.getStatistics().setEnabled(true); + } + /** * disable statistics gathering - */ + */ public void disableStatistics() { - connector.getStatistics().setEnabled(false); - } - + connector.getStatistics().setEnabled(false); + } + /** * Returns true if statistics is enabled * * @return true if statistics is enabled - */ + */ public boolean isStatisticsEnabled() { - return connector.getStatistics().isEnabled(); - } + return connector.getStatistics().isEnabled(); + } /** * Returns the number of messages enqueued on this connector @@ -85,7 +84,7 @@ public class ConnectorView implements ConnectorViewMBean { */ public long getEnqueueCount() { return connector.getStatistics().getEnqueues().getCount(); - + } /** diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java index fcc697202a..a5ba66fbc5 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java @@ -23,37 +23,37 @@ public interface ConnectorViewMBean extends Service { /** * Resets the statistics */ - public void resetStatistics(); + void resetStatistics(); /** * enable statistics gathering */ - public void enableStatistics(); + void enableStatistics(); /** * disable statistics gathering */ - public void disableStatistics(); + void disableStatistics(); /** * Returns true if statistics is enabled * * @return true if statistics is enabled */ - public boolean isStatisticsEnabled(); + boolean isStatisticsEnabled(); /** * Returns the number of messages enqueued on this connector * * @return the number of messages enqueued on this connector */ - public long getEnqueueCount(); + long getEnqueueCount(); /** * Returns the number of messages dequeued on this connector * * @return the number of messages dequeued on this connector */ - public long getDequeueCount(); + long getDequeueCount(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java index b1d10fef50..1d5fce3224 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java @@ -48,7 +48,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class DestinationView implements DestinationViewMBean { - private static final Log log = LogFactory.getLog(DestinationViewMBean.class); + private static final Log LOG = LogFactory.getLog(DestinationViewMBean.class); protected final Destination destination; protected final ManagedRegionBroker broker; @@ -147,7 +147,7 @@ public class DestinationView implements DestinationViewMBean { } } catch (Throwable e) { - log.warn("exception browsing destination", e); + LOG.warn("exception browsing destination", e); } } @@ -188,7 +188,7 @@ public class DestinationView implements DestinationViewMBean { } } catch (Throwable e) { - log.warn("exception browsing destination", e); + LOG.warn("exception browsing destination", e); } } return answer; @@ -224,7 +224,7 @@ public class DestinationView implements DestinationViewMBean { } } } catch (Throwable e) { - log.warn("exception browsing destination", e); + LOG.warn("exception browsing destination", e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java index 343780e0cd..49fa52b2f6 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java @@ -24,121 +24,131 @@ import javax.management.openmbean.CompositeData; import javax.management.openmbean.OpenDataException; import javax.management.openmbean.TabularData; - public interface DestinationViewMBean { - + /** * Returns the name of this destination */ - public String getName(); - - /** - * Resets the managment counters. - */ - public void resetStatistics(); + String getName(); + + /** + * Resets the managment counters. + */ + void resetStatistics(); /** * Returns the number of messages that have been sent to the destination. - * + * * @return The number of messages that have been sent to the destination. */ - public long getEnqueueCount(); - + long getEnqueueCount(); + /** - * Returns the number of messages that have been delivered (potentially not acknowledged) to consumers. - * - * @return The number of messages that have been delivered (potentially not acknowledged) to consumers. + * Returns the number of messages that have been delivered (potentially not + * acknowledged) to consumers. + * + * @return The number of messages that have been delivered (potentially not + * acknowledged) to consumers. */ - public long getDispatchCount(); - + long getDispatchCount(); + /** - * Returns the number of messages that have been acknowledged from the destination. - * - * @return The number of messages that have been acknowledged from the destination. + * Returns the number of messages that have been acknowledged from the + * destination. + * + * @return The number of messages that have been acknowledged from the + * destination. */ - public long getDequeueCount(); + long getDequeueCount(); /** * Returns the number of consumers subscribed this destination. - * + * * @return The number of consumers subscribed this destination. */ - public long getConsumerCount(); + long getConsumerCount(); /** - * Returns the number of messages in this destination which are yet to be consumed - * - * @return Returns the number of messages in this destination which are yet to be consumed + * Returns the number of messages in this destination which are yet to be + * consumed + * + * @return Returns the number of messages in this destination which are yet + * to be consumed */ - public long getQueueSize(); - - /** - * @return An array of all the messages in the destination's queue. - */ - public CompositeData[] browse() throws OpenDataException; - - /** - * @return A list of all the messages in the destination's queue. - */ - public TabularData browseAsTable() throws OpenDataException; + long getQueueSize(); /** * @return An array of all the messages in the destination's queue. - * @throws InvalidSelectorException */ - public CompositeData[] browse(String selector) throws OpenDataException, InvalidSelectorException; - + CompositeData[] browse() throws OpenDataException; + /** * @return A list of all the messages in the destination's queue. - * @throws InvalidSelectorException */ - public TabularData browseAsTable(String selector) throws OpenDataException, InvalidSelectorException; + TabularData browseAsTable() throws OpenDataException; + + /** + * @return An array of all the messages in the destination's queue. + * @throws InvalidSelectorException + */ + CompositeData[] browse(String selector) throws OpenDataException, InvalidSelectorException; + + /** + * @return A list of all the messages in the destination's queue. + * @throws InvalidSelectorException + */ + TabularData browseAsTable(String selector) throws OpenDataException, InvalidSelectorException; /** * Sends a TextMesage to the destination. + * * @param body the text to send * @return the message id of the message sent. * @throws Exception */ - public String sendTextMessage(String body) throws Exception; + String sendTextMessage(String body) throws Exception; /** * Sends a TextMesage to the destination. - * @param headers the message headers and properties to set. Can only container Strings maped to primitive types. + * + * @param headers the message headers and properties to set. Can only + * container Strings maped to primitive types. * @param body the text to send * @return the message id of the message sent. * @throws Exception */ - public String sendTextMessage(Map headers, String body) throws Exception; + String sendTextMessage(Map headers, String body) throws Exception; - public int getMemoryPercentageUsed(); - public long getMemoryLimit(); - public void setMemoryLimit(long limit); + int getMemoryPercentageUsed(); + + long getMemoryLimit(); + + void setMemoryLimit(long limit); /** * Browses the current destination returning a list of messages */ - public List browseMessages() throws InvalidSelectorException; + List browseMessages() throws InvalidSelectorException; /** - * Browses the current destination with the given selector returning a list of messages + * Browses the current destination with the given selector returning a list + * of messages */ - public List browseMessages(String selector) throws InvalidSelectorException; - - + List browseMessages(String selector) throws InvalidSelectorException; + /** * @return longest time a message is held by a destination */ - public long getMaxEnqueueTime(); - + long getMaxEnqueueTime(); + /** * @return shortest time a message is held by a destination */ - public long getMinEnqueueTime(); - + long getMinEnqueueTime(); + /** * @return average time a message is held by a destination */ - public double getAverageEnqueueTime(); + double getAverageEnqueueTime(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java index a4b417430f..1fcf6de7af 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java @@ -27,7 +27,7 @@ public interface DurableSubscriptionViewMBean extends SubscriptionViewMBean { /** * @return name of the durable subscription name */ - public String getSubscriptionName(); + String getSubscriptionName(); /** * Browse messages for this durable subscriber @@ -35,7 +35,7 @@ public interface DurableSubscriptionViewMBean extends SubscriptionViewMBean { * @return messages * @throws OpenDataException */ - public CompositeData[] browse() throws OpenDataException; + CompositeData[] browse() throws OpenDataException; /** * Browse messages for this durable subscriber @@ -43,11 +43,11 @@ public interface DurableSubscriptionViewMBean extends SubscriptionViewMBean { * @return messages * @throws OpenDataException */ - public TabularData browseAsTable() throws OpenDataException; + TabularData browseAsTable() throws OpenDataException; /** * Destroys the durable subscription so that messages will no longer be * stored for this subscription */ - public void destroy() throws Exception; + void destroy() throws Exception; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java index d0300051fd..c32e7533d3 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java @@ -73,7 +73,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class ManagedRegionBroker extends RegionBroker { - private static final Log log = LogFactory.getLog(ManagedRegionBroker.class); + private static final Log LOG = LogFactory.getLog(ManagedRegionBroker.class); private final MBeanServer mbeanServer; private final ObjectName brokerObjectName; private final Map topics = new ConcurrentHashMap(); @@ -113,7 +113,7 @@ public class ManagedRegionBroker extends RegionBroker { try { mbeanServer.unregisterMBean(name); } catch (InstanceNotFoundException e) { - log.warn("The MBean: " + name + " is no longer registered with JMX"); + LOG.warn("The MBean: " + name + " is no longer registered with JMX"); } catch (Exception e) { stopper.onException(this, e); } @@ -148,13 +148,13 @@ public class ManagedRegionBroker extends RegionBroker { view = new TopicView(this, (Topic)destination); } else { view = null; - log.warn("JMX View is not supported for custom destination: " + destination); + LOG.warn("JMX View is not supported for custom destination: " + destination); } if (view != null) { registerDestination(objectName, destName, view); } } catch (Exception e) { - log.error("Failed to register destination " + destName, e); + LOG.error("Failed to register destination " + destName, e); } } @@ -163,7 +163,7 @@ public class ManagedRegionBroker extends RegionBroker { ObjectName objectName = createObjectName(destName); unregisterDestination(objectName); } catch (Exception e) { - log.error("Failed to unregister " + destName, e); + LOG.error("Failed to unregister " + destName, e); } } @@ -205,7 +205,7 @@ public class ManagedRegionBroker extends RegionBroker { subscriptionMap.put(sub, objectName); return objectName; } catch (Exception e) { - log.error("Failed to register subscription " + sub, e); + LOG.error("Failed to register subscription " + sub, e); return null; } } @@ -216,7 +216,7 @@ public class ManagedRegionBroker extends RegionBroker { try { unregisterSubscription(name); } catch (Exception e) { - log.error("Failed to unregister subscription " + sub, e); + LOG.error("Failed to unregister subscription " + sub, e); } } } @@ -239,8 +239,8 @@ public class ManagedRegionBroker extends RegionBroker { mbeanServer.registerMBean(view, key); registeredMBeans.add(key); } catch (Throwable e) { - log.warn("Failed to register MBean: " + key); - log.debug("Failure reason: " + e, e); + LOG.warn("Failed to register MBean: " + key); + LOG.debug("Failure reason: " + e, e); } } @@ -253,8 +253,8 @@ public class ManagedRegionBroker extends RegionBroker { try { mbeanServer.unregisterMBean(key); } catch (Throwable e) { - log.warn("Failed to unregister MBean: " + key); - log.debug("Failure reason: " + e, e); + LOG.warn("Failed to unregister MBean: " + key); + LOG.debug("Failure reason: " + e, e); } } } @@ -282,7 +282,7 @@ public class ManagedRegionBroker extends RegionBroker { mbeanServer.unregisterMBean(inactiveName); } } catch (Throwable e) { - log.error("Unable to unregister inactive durable subscriber: " + subscriptionKey, e); + LOG.error("Unable to unregister inactive durable subscriber: " + subscriptionKey, e); } } else { topicSubscribers.put(key, view); @@ -294,8 +294,8 @@ public class ManagedRegionBroker extends RegionBroker { mbeanServer.registerMBean(view, key); registeredMBeans.add(key); } catch (Throwable e) { - log.warn("Failed to register MBean: " + key); - log.debug("Failure reason: " + e, e); + LOG.warn("Failed to register MBean: " + key); + LOG.debug("Failure reason: " + e, e); } } @@ -310,8 +310,8 @@ public class ManagedRegionBroker extends RegionBroker { try { mbeanServer.unregisterMBean(key); } catch (Throwable e) { - log.warn("Failed to unregister MBean: " + key); - log.debug("Failure reason: " + e, e); + LOG.warn("Failed to unregister MBean: " + key); + LOG.debug("Failure reason: " + e, e); } } DurableSubscriptionView view = (DurableSubscriptionView)durableTopicSubscribers.remove(key); @@ -337,7 +337,7 @@ public class ManagedRegionBroker extends RegionBroker { if (infos != null) { for (int i = 0; i < infos.length; i++) { SubscriptionInfo info = infos[i]; - log.debug("Restoring durable subscription: " + info); + LOG.debug("Restoring durable subscription: " + info); SubscriptionKey key = new SubscriptionKey(info); subscriptions.put(key, info); } @@ -364,14 +364,14 @@ public class ManagedRegionBroker extends RegionBroker { mbeanServer.registerMBean(view, objectName); registeredMBeans.add(objectName); } catch (Throwable e) { - log.warn("Failed to register MBean: " + key); - log.debug("Failure reason: " + e, e); + LOG.warn("Failed to register MBean: " + key); + LOG.debug("Failure reason: " + e, e); } inactiveDurableTopicSubscribers.put(objectName, view); subscriptionKeys.put(key, objectName); } catch (Exception e) { - log.error("Failed to register subscription " + info, e); + LOG.error("Failed to register subscription " + info, e); } } @@ -382,7 +382,7 @@ public class ManagedRegionBroker extends RegionBroker { try { c[i] = OpenTypeSupport.convert((Message)messages.get(i)); } catch (Throwable e) { - log.error("failed to browse : " + view, e); + LOG.error("failed to browse : " + view, e); } } return c; @@ -428,7 +428,7 @@ public class ManagedRegionBroker extends RegionBroker { } }); } catch (Throwable e) { - log.error("Failed to browse messages for Subscription " + view, e); + LOG.error("Failed to browse messages for Subscription " + view, e); } return result; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java index 2ba7b987a3..7416064af4 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java @@ -40,7 +40,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public class ManagedTransportConnection extends TransportConnection { - private static final Log log = LogFactory.getLog(ManagedTransportConnection.class); + private static final Log LOG = LogFactory.getLog(ManagedTransportConnection.class); private final MBeanServer server; private final ObjectName connectorName; @@ -101,8 +101,8 @@ public class ManagedTransportConnection extends TransportConnection { try { server.registerMBean(mbean, name); } catch (Throwable e) { - log.warn("Failed to register MBean: " + name); - log.debug("Failure reason: " + e, e); + LOG.warn("Failed to register MBean: " + name); + LOG.debug("Failure reason: " + e, e); } } } @@ -112,8 +112,8 @@ public class ManagedTransportConnection extends TransportConnection { try { server.unregisterMBean(name); } catch (Throwable e) { - log.warn("Failed to unregister mbean: " + name); - log.debug("Failure reason: " + e, e); + LOG.warn("Failed to unregister mbean: " + name); + LOG.debug("Failure reason: " + e, e); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeView.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeView.java index 7eb9f505c2..8c9808dbe1 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeView.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeView.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeViewMBean.java index 41f610e96d..74eb300901 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeViewMBean.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -19,12 +19,17 @@ package org.apache.activemq.broker.jmx; import org.apache.activemq.Service; public interface NetworkBridgeViewMBean extends Service { - - public String getLocalAddress(); - public String getRemoteAddress(); - public String getRemoteBrokerName(); - public String getLocalBrokerName(); - public long getEnqueueCounter(); - public long getDequeueCounter(); -} \ No newline at end of file + String getLocalAddress(); + + String getRemoteAddress(); + + String getRemoteBrokerName(); + + String getLocalBrokerName(); + + long getEnqueueCounter(); + + long getDequeueCounter(); + +} diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkConnectorViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkConnectorViewMBean.java index 2cbac83c33..eb9d4dca30 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkConnectorViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/NetworkConnectorViewMBean.java @@ -20,42 +20,42 @@ import org.apache.activemq.Service; public interface NetworkConnectorViewMBean extends Service { - public String getName(); + String getName(); - public int getNetworkTTL(); + int getNetworkTTL(); - public int getPrefetchSize(); + int getPrefetchSize(); - public String getUserName(); + String getUserName(); - public boolean isBridgeTempDestinations(); + boolean isBridgeTempDestinations(); - public boolean isConduitSubscriptions(); + boolean isConduitSubscriptions(); - public boolean isDecreaseNetworkConsumerPriority(); + boolean isDecreaseNetworkConsumerPriority(); - public boolean isDispatchAsync(); + boolean isDispatchAsync(); - public boolean isDynamicOnly(); + boolean isDynamicOnly(); - public void setBridgeTempDestinations(boolean bridgeTempDestinations); + void setBridgeTempDestinations(boolean bridgeTempDestinations); - public void setConduitSubscriptions(boolean conduitSubscriptions); + void setConduitSubscriptions(boolean conduitSubscriptions); - public void setDispatchAsync(boolean dispatchAsync); + void setDispatchAsync(boolean dispatchAsync); - public void setDynamicOnly(boolean dynamicOnly); + void setDynamicOnly(boolean dynamicOnly); - public void setNetworkTTL(int networkTTL); + void setNetworkTTL(int networkTTL); - public void setPassword(String password); + void setPassword(String password); - public void setPrefetchSize(int prefetchSize); + void setPrefetchSize(int prefetchSize); - public void setUserName(String userName); + void setUserName(String userName); - public String getPassword(); + String getPassword(); - public void setDecreaseNetworkConsumerPriority(boolean decreaseNetworkConsumerPriority); + void setDecreaseNetworkConsumerPriority(boolean decreaseNetworkConsumerPriority); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java index a386cb7a7b..d31a495712 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java @@ -48,7 +48,7 @@ public class OpenTypeSupport { Map getFields(Object o) throws OpenDataException; } - private static final HashMap openTypeFactories = new HashMap(); + private static final HashMap OPEN_TYPE_FACTORIES = new HashMap(); abstract static class AbstractOpenTypeFactory implements OpenTypeFactory { @@ -75,7 +75,7 @@ public class OpenTypeSupport { return new CompositeType(getTypeName(), getDescription(), itemNames, itemDescriptions, itemTypes); } - abstract protected String getTypeName(); + protected abstract String getTypeName(); protected void addItem(String name, String description, OpenType type) { itemNamesList.add(name); @@ -257,16 +257,16 @@ public class OpenTypeSupport { } static { - openTypeFactories.put(ActiveMQMessage.class, new MessageOpenTypeFactory()); - openTypeFactories.put(ActiveMQBytesMessage.class, new ByteMessageOpenTypeFactory()); - openTypeFactories.put(ActiveMQMapMessage.class, new MapMessageOpenTypeFactory()); - openTypeFactories.put(ActiveMQObjectMessage.class, new ObjectMessageOpenTypeFactory()); - openTypeFactories.put(ActiveMQStreamMessage.class, new StreamMessageOpenTypeFactory()); - openTypeFactories.put(ActiveMQTextMessage.class, new TextMessageOpenTypeFactory()); + OPEN_TYPE_FACTORIES.put(ActiveMQMessage.class, new MessageOpenTypeFactory()); + OPEN_TYPE_FACTORIES.put(ActiveMQBytesMessage.class, new ByteMessageOpenTypeFactory()); + OPEN_TYPE_FACTORIES.put(ActiveMQMapMessage.class, new MapMessageOpenTypeFactory()); + OPEN_TYPE_FACTORIES.put(ActiveMQObjectMessage.class, new ObjectMessageOpenTypeFactory()); + OPEN_TYPE_FACTORIES.put(ActiveMQStreamMessage.class, new StreamMessageOpenTypeFactory()); + OPEN_TYPE_FACTORIES.put(ActiveMQTextMessage.class, new TextMessageOpenTypeFactory()); } public static OpenTypeFactory getFactory(Class clazz) throws OpenDataException { - return (OpenTypeFactory)openTypeFactories.get(clazz); + return (OpenTypeFactory)OPEN_TYPE_FACTORIES.get(clazz); } public static CompositeData convert(Message message) throws OpenDataException { diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java index 00c7bc7e55..379d68085e 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java @@ -19,19 +19,17 @@ package org.apache.activemq.broker.jmx; import javax.management.openmbean.CompositeData; import javax.management.openmbean.OpenDataException; - public interface QueueViewMBean extends DestinationViewMBean { - - /** + + /** * Retrieve a message from the destination's queue. * - * @param messageId - * the message id of the message to retrieve + * @param messageId the message id of the message to retrieve * @return A CompositeData object which is a JMX version of the messages * @throws OpenDataException */ - public CompositeData getMessage(String messageId) throws OpenDataException; - + CompositeData getMessage(String messageId) throws OpenDataException; + /** * Removes a message from the queue. If the message has already been * dispatched to another consumer, the message cannot be deleted and this @@ -39,31 +37,32 @@ public interface QueueViewMBean extends DestinationViewMBean { * * @param messageId * @return true if the message was found and could be successfully deleted. - * @throws Exception + * @throws Exception */ - public boolean removeMessage(String messageId) throws Exception; + boolean removeMessage(String messageId) throws Exception; /** * Removes the messages matching the given selector * * @return the number of messages removed */ - public int removeMatchingMessages(String selector) throws Exception; + int removeMatchingMessages(String selector) throws Exception; /** - * Removes the messages matching the given selector up to the maximum number of matched messages + * Removes the messages matching the given selector up to the maximum number + * of matched messages * * @return the number of messages removed */ - public int removeMatchingMessages(String selector, int maximumMessages) throws Exception; - + int removeMatchingMessages(String selector, int maximumMessages) throws Exception; /** * Removes all of the messages in the queue. - * @throws Exception + * + * @throws Exception */ - public void purge() throws Exception; - + void purge() throws Exception; + /** * Copies a given message to another destination. * @@ -73,21 +72,22 @@ public interface QueueViewMBean extends DestinationViewMBean { * other destination. * @throws Exception */ - public boolean copyMessageTo(String messageId, String destinationName) throws Exception; + boolean copyMessageTo(String messageId, String destinationName) throws Exception; /** * Copies the messages matching the given selector * * @return the number of messages copied */ - public int copyMatchingMessagesTo(String selector, String destinationName) throws Exception; + int copyMatchingMessagesTo(String selector, String destinationName) throws Exception; /** - * Copies the messages matching the given selector up to the maximum number of matched messages + * Copies the messages matching the given selector up to the maximum number + * of matched messages * * @return the number of messages copied */ - public int copyMatchingMessagesTo(String selector, String destinationName, int maximumMessages) throws Exception; + int copyMatchingMessagesTo(String selector, String destinationName, int maximumMessages) throws Exception; /** * Moves the message to another destination. @@ -98,18 +98,19 @@ public interface QueueViewMBean extends DestinationViewMBean { * other destination. * @throws Exception */ - public boolean moveMessageTo(String messageId, String destinationName) throws Exception; + boolean moveMessageTo(String messageId, String destinationName) throws Exception; /** * Moves the messages matching the given selector * * @return the number of messages removed */ - public int moveMatchingMessagesTo(String selector, String destinationName) throws Exception; - + int moveMatchingMessagesTo(String selector, String destinationName) throws Exception; + /** - * Moves the messages matching the given selector up to the maximum number of matched messages + * Moves the messages matching the given selector up to the maximum number + * of matched messages */ - public int moveMatchingMessagesTo(String selector, String destinationName, int maximumMessages) throws Exception; + int moveMatchingMessagesTo(String selector, String destinationName, int maximumMessages) throws Exception; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java index f51d85fb30..4aa684be44 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java @@ -26,68 +26,68 @@ public interface SubscriptionViewMBean { /** * @return the clientId of the Connection the Subscription is on */ - public String getClientId(); + String getClientId(); /** * @return the id of the Connection the Subscription is on */ - public String getConnectionId(); + String getConnectionId(); /** * @return the id of the Session the subscription is on */ - public long getSessionId(); + long getSessionId(); /** * @return the id of the Subscription */ - public long getSubcriptionId(); + long getSubcriptionId(); /** * @return the destination name */ - public String getDestinationName(); + String getDestinationName(); /** * @return the JMS selector on the current subscription */ - public String getSelector(); + String getSelector(); /** * Attempts to change the current active selector on the subscription. This * operation is not supported for persistent topics. */ - public void setSelector(String selector) throws InvalidSelectorException, UnsupportedOperationException; + void setSelector(String selector) throws InvalidSelectorException, UnsupportedOperationException; /** * @return true if the destination is a Queue */ - public boolean isDestinationQueue(); + boolean isDestinationQueue(); /** * @return true of the destination is a Topic */ - public boolean isDestinationTopic(); + boolean isDestinationTopic(); /** * @return true if the destination is temporary */ - public boolean isDestinationTemporary(); + boolean isDestinationTemporary(); /** * @return true if the subscriber is active */ - public boolean isActive(); + boolean isActive(); /** * @return number of messages pending delivery */ - public int getPendingQueueSize(); + int getPendingQueueSize(); /** * @return number of messages dispatched */ - public int getDispatchedQueueSize(); + int getDispatchedQueueSize(); /** * @return number of messages that matched the subscription @@ -107,27 +107,27 @@ public interface SubscriptionViewMBean { /** * @return the prefetch that has been configured for this subscriber */ - public int getPrefetchSize(); + int getPrefetchSize(); /** * @return whether or not the subscriber is retroactive or not */ - public boolean isRetroactive(); + boolean isRetroactive(); /** * @return whether or not the subscriber is an exclusive consumer */ - public boolean isExclusive(); + boolean isExclusive(); /** * @return whether or not the subscriber is durable (persistent) */ - public boolean isDurable(); + boolean isDurable(); /** * @return whether or not the subscriber ignores local messages */ - public boolean isNoLocal(); + boolean isNoLocal(); /** * @return the maximum number of pending messages allowed in addition to the @@ -135,16 +135,16 @@ public interface SubscriptionViewMBean { * perform eviction of messages for slow consumers on non-durable * topics. */ - public int getMaximumPendingMessageLimit(); + int getMaximumPendingMessageLimit(); /** * @return the consumer priority */ - public byte getPriority(); + byte getPriority(); /** * @return the name of the consumer which is only used for durable * consumers. */ - public String getSubcriptionName(); + String getSubcriptionName(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicSubscriptionViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicSubscriptionViewMBean.java index af2929543d..efcb65d40f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicSubscriptionViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicSubscriptionViewMBean.java @@ -25,12 +25,12 @@ public interface TopicSubscriptionViewMBean extends SubscriptionViewMBean { /** * @return the number of messages discarded due to being a slow consumer */ - public int getDiscardedCount(); + int getDiscardedCount(); /** * @return the maximun number of messages that can be pending. */ - public int getMaximumPendingQueueSize(); - public void setMaximumPendingQueueSize(int max); + int getMaximumPendingQueueSize(); + void setMaximumPendingQueueSize(int max); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java index a7658ceb7b..9fd4270955 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java @@ -48,7 +48,7 @@ import org.apache.commons.logging.LogFactory; /** * @version $Revision: 1.14 $ */ -abstract public class AbstractRegion implements Region { +public abstract class AbstractRegion implements Region { private static final Log LOG = LogFactory.getLog(AbstractRegion.class); diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java index 72e436fbc7..ccb8f530db 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java @@ -37,18 +37,18 @@ import org.apache.activemq.selector.SelectorParser; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -abstract public class AbstractSubscription implements Subscription { +public abstract class AbstractSubscription implements Subscription { - static private final Log log = LogFactory.getLog(AbstractSubscription.class); + private static final Log LOG = LogFactory.getLog(AbstractSubscription.class); protected Broker broker; protected ConnectionContext context; protected ConsumerInfo info; - final protected DestinationFilter destinationFilter; + protected final DestinationFilter destinationFilter; + protected final CopyOnWriteArrayList destinations = new CopyOnWriteArrayList(); private BooleanExpression selectorExpression; private ObjectName objectName; - final protected CopyOnWriteArrayList destinations = new CopyOnWriteArrayList(); public AbstractSubscription(Broker broker, ConnectionContext context, ConsumerInfo info) throws InvalidSelectorException { this.broker = broker; @@ -58,7 +58,7 @@ abstract public class AbstractSubscription implements Subscription { this.selectorExpression = parseSelector(info); } - static private BooleanExpression parseSelector(ConsumerInfo info) throws InvalidSelectorException { + private static BooleanExpression parseSelector(ConsumerInfo info) throws InvalidSelectorException { BooleanExpression rc = null; if (info.getSelector() != null) { rc = new SelectorParser().parse(info.getSelector()); @@ -89,7 +89,7 @@ abstract public class AbstractSubscription implements Subscription { try { return (selectorExpression == null || selectorExpression.matches(context)) && this.context.isAllowedToConsume(node); } catch (JMSException e) { - log.info("Selector failed to evaluate: " + e.getMessage(), e); + LOG.info("Selector failed to evaluate: " + e.getMessage(), e); return false; } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Destination.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Destination.java index a726da8927..60754910a6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Destination.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Destination.java @@ -55,9 +55,9 @@ public interface Destination extends Service { DeadLetterStrategy getDeadLetterStrategy(); - public Message[] browse(); + Message[] browse(); - public String getName(); + String getName(); - public MessageStore getMessageStore(); + MessageStore getMessageStore(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactory.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactory.java index 95590f48c6..a8bd00d458 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactory.java @@ -35,21 +35,21 @@ public abstract class DestinationFactory { /** * Create destination implementation. */ - abstract public Destination createDestination(ConnectionContext context, ActiveMQDestination destination, DestinationStatistics destinationStatistics) throws Exception; + public abstract Destination createDestination(ConnectionContext context, ActiveMQDestination destination, DestinationStatistics destinationStatistics) throws Exception; /** * Returns a set of all the {@link org.apache.activemq.command.ActiveMQDestination} * objects that the persistence store is aware exist. */ - abstract public Set getDestinations(); + public abstract Set getDestinations(); /** * Lists all the durable subscirptions for a given destination. */ - abstract public SubscriptionInfo[] getAllDurableSubscriptions(ActiveMQTopic topic) throws IOException; + public abstract SubscriptionInfo[] getAllDurableSubscriptions(ActiveMQTopic topic) throws IOException; - abstract public long getLastMessageBrokerSequenceId() throws IOException; + public abstract long getLastMessageBrokerSequenceId() throws IOException; - abstract public void setRegionBroker(RegionBroker regionBroker); + public abstract void setRegionBroker(RegionBroker regionBroker); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java index 2871561984..8710522cb2 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region; import java.io.IOException; @@ -49,7 +51,7 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us subscriptionKey = new SubscriptionKey(context.getClientId(), info.getSubscriptionName()); } - synchronized public boolean isActive() { + public synchronized boolean isActive() { return active; } @@ -57,7 +59,7 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us return !active || super.isFull(); } - synchronized public void gc() { + public synchronized void gc() { } public synchronized void add(ConnectionContext context, Destination destination) throws Exception { @@ -101,7 +103,7 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us } } - synchronized public void deactivate(boolean keepDurableSubsActive) throws Exception { + public synchronized void deactivate(boolean keepDurableSubsActive) throws Exception { active = false; this.usageManager.removeUsageListener(this); synchronized (pending) { diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/IndirectMessageReference.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/IndirectMessageReference.java index 429ea291d5..0b32fcc1db 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/IndirectMessageReference.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/IndirectMessageReference.java @@ -78,15 +78,15 @@ public class IndirectMessageReference implements QueueMessageReference { this.cachedSize = message.getSize(); } - synchronized public Message getMessageHardRef() { + public synchronized Message getMessageHardRef() { return message; } - synchronized public int getReferenceCount() { + public synchronized int getReferenceCount() { return referenceCount; } - synchronized public int incrementReferenceCount() { + public synchronized int incrementReferenceCount() { int rc = ++referenceCount; if (persistent && rc == 1 && message == null) { @@ -105,7 +105,7 @@ public class IndirectMessageReference implements QueueMessageReference { return rc; } - synchronized public int decrementReferenceCount() { + public synchronized int decrementReferenceCount() { int rc = --referenceCount; if (persistent && rc == 0 && message != null) { message.decrementReferenceCount(); @@ -114,7 +114,7 @@ public class IndirectMessageReference implements QueueMessageReference { return rc; } - synchronized public Message getMessage() { + public synchronized Message getMessage() { return message; } @@ -122,15 +122,15 @@ public class IndirectMessageReference implements QueueMessageReference { return "Message " + messageId + " dropped=" + dropped + " locked=" + (lockOwner != null); } - synchronized public void incrementRedeliveryCounter() { + public synchronized void incrementRedeliveryCounter() { this.redeliveryCounter++; } - synchronized public boolean isDropped() { + public synchronized boolean isDropped() { return dropped; } - synchronized public void drop() { + public synchronized void drop() { dropped = true; lockOwner = null; if (!persistent && message != null) { @@ -150,15 +150,15 @@ public class IndirectMessageReference implements QueueMessageReference { } } - synchronized public void unlock() { + public synchronized void unlock() { lockOwner = null; } - synchronized public LockOwner getLockOwner() { + public synchronized LockOwner getLockOwner() { return lockOwner; } - synchronized public int getRedeliveryCounter() { + public synchronized int getRedeliveryCounter() { return redeliveryCounter; } @@ -174,15 +174,15 @@ public class IndirectMessageReference implements QueueMessageReference { return persistent; } - synchronized public boolean isLocked() { + public synchronized boolean isLocked() { return lockOwner != null; } - synchronized public boolean isAcked() { + public synchronized boolean isAcked() { return acked; } - synchronized public void setAcked(boolean b) { + public synchronized void setAcked(boolean b) { acked = b; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/LockOwner.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/LockOwner.java index 47b0f14a03..86982a0ff0 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/LockOwner.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/LockOwner.java @@ -18,7 +18,7 @@ package org.apache.activemq.broker.region; public interface LockOwner { - public static final LockOwner HIGH_PRIORITY_LOCK_OWNER = new LockOwner() { + LockOwner HIGH_PRIORITY_LOCK_OWNER = new LockOwner() { public int getLockPriority() { return Integer.MAX_VALUE; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/MessageReference.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/MessageReference.java index 7b70d62a5e..ac649a8f9d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/MessageReference.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/MessageReference.java @@ -31,29 +31,29 @@ import org.apache.activemq.command.MessageId; */ public interface MessageReference { - public MessageId getMessageId(); - public Message getMessageHardRef(); - public Message getMessage() throws IOException; - public boolean isPersistent(); + MessageId getMessageId(); + Message getMessageHardRef(); + Message getMessage() throws IOException; + boolean isPersistent(); - public Destination getRegionDestination(); + Destination getRegionDestination(); - public int getRedeliveryCounter(); - public void incrementRedeliveryCounter(); + int getRedeliveryCounter(); + void incrementRedeliveryCounter(); - public int getReferenceCount(); + int getReferenceCount(); - public int incrementReferenceCount(); - public int decrementReferenceCount(); - public ConsumerId getTargetConsumerId(); - public int getSize(); - public long getExpiration(); - public String getGroupID(); - public int getGroupSequence(); + int incrementReferenceCount(); + int decrementReferenceCount(); + ConsumerId getTargetConsumerId(); + int getSize(); + long getExpiration(); + String getGroupID(); + int getGroupSequence(); /** * Returns true if this message is expired */ - public boolean isExpired(); + boolean isExpired(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/MessageReferenceFilter.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/MessageReferenceFilter.java index b6c7f859bc..e02c5a55c3 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/MessageReferenceFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/MessageReferenceFilter.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -27,5 +27,5 @@ import org.apache.activemq.broker.ConnectionContext; */ public interface MessageReferenceFilter { - public boolean evaluate(ConnectionContext context, MessageReference messageReference) throws JMSException; + boolean evaluate(ConnectionContext context, MessageReference messageReference) throws JMSException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java index f6e90c7eef..56d2f4f9ee 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region; import java.io.IOException; @@ -44,11 +46,11 @@ import org.apache.commons.logging.LogFactory; * * @version $Revision: 1.15 $ */ -abstract public class PrefetchSubscription extends AbstractSubscription { +public abstract class PrefetchSubscription extends AbstractSubscription { - static private final Log LOG = LogFactory.getLog(PrefetchSubscription.class); + private static final Log LOG = LogFactory.getLog(PrefetchSubscription.class); protected PendingMessageCursor pending; - final protected LinkedList dispatched = new LinkedList(); + protected final LinkedList dispatched = new LinkedList(); protected int prefetchExtension; protected long enqueueCounter; protected long dispatchCounter; @@ -317,15 +319,15 @@ abstract public class PrefetchSubscription extends AbstractSubscription { return dispatched.size(); } - synchronized public long getDequeueCounter() { + public synchronized long getDequeueCounter() { return dequeueCounter; } - synchronized public long getDispatchedCounter() { + public synchronized long getDispatchedCounter() { return dispatchCounter; } - synchronized public long getEnqueueCounter() { + public synchronized long getEnqueueCounter() { return enqueueCounter; } @@ -499,7 +501,7 @@ abstract public class PrefetchSubscription extends AbstractSubscription { * (another sub may have already dispatched it for example). * @throws IOException */ - abstract protected boolean canDispatch(MessageReference node) throws IOException; + protected abstract boolean canDispatch(MessageReference node) throws IOException; /** * Used during acknowledgment to remove the message. diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueMessageReference.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueMessageReference.java index 9f8b1efab9..997bfb2545 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueMessageReference.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueMessageReference.java @@ -24,19 +24,19 @@ package org.apache.activemq.broker.region; */ public interface QueueMessageReference extends MessageReference { - public static final QueueMessageReference NULL_MESSAGE = new NullMessageReference(); + QueueMessageReference NULL_MESSAGE = new NullMessageReference(); - public boolean isAcked(); + boolean isAcked(); - public void setAcked(boolean b); + void setAcked(boolean b); - public void drop(); + void drop(); - public boolean isDropped(); + boolean isDropped(); - public boolean lock(LockOwner subscription); + boolean lock(LockOwner subscription); - public void unlock(); + void unlock(); - public LockOwner getLockOwner(); + LockOwner getLockOwner(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java index 326b90da48..278b727e8b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; public class QueueSubscription extends PrefetchSubscription implements LockOwner { - private static final Log log = LogFactory.getLog(QueueSubscription.class); + private static final Log LOG = LogFactory.getLog(QueueSubscription.class); public QueueSubscription(Broker broker, ConnectionContext context, ConsumerInfo info) throws InvalidSelectorException { super(broker, context, info); @@ -132,7 +132,7 @@ public class QueueSubscription extends PrefetchSubscription implements LockOwner try { activeMessage.setBooleanProperty("JMSXGroupFirstForConsumer", true, false); } catch (JMSException e) { - log.warn("Failed to set boolean header: " + e, e); + LOG.warn("Failed to set boolean header: " + e, e); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Region.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Region.java index a24639a2fc..c1a7278754 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Region.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Region.java @@ -50,7 +50,7 @@ public interface Region extends Service { * @return TODO * @throws Exception TODO */ - public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception; + Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception; /** * Used to destroy a destination. @@ -62,14 +62,14 @@ public interface Region extends Service { * @param timeout the max amount of time to wait for the destination to quiesce * @throws Exception TODO */ - public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception; + void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception; /** * Returns a copy of the current destinations available in the region * * @return a copy of the regions currently active at the time of the call with the key the destination and the value the Destination. */ - public Map getDestinationMap(); + Map getDestinationMap(); /** @@ -78,14 +78,14 @@ public interface Region extends Service { * @return TODO * @throws Exception TODO */ - public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception; + Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception; /** * Removes a consumer. * @param context the environment the operation is being executed under. * @throws Exception TODO */ - public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception; + void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception; /** * Deletes a durable subscription. @@ -93,7 +93,7 @@ public interface Region extends Service { * @param info TODO * @throws Exception TODO */ - public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception; + void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception; /** * Send a message to the broker to using the specified destination. The destination specified @@ -103,34 +103,34 @@ public interface Region extends Service { * @param message * @throws Exception TODO */ - public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception; + void send(ProducerBrokerExchange producerExchange, Message message) throws Exception; /** * Used to acknowledge the receipt of a message by a client. * @param consumerExchange the environment the operation is being executed under. * @throws Exception TODO */ - public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception; + void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception; /** * Allows a consumer to pull a message from a queue */ - public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception; + Response messagePull(ConnectionContext context, MessagePull pull) throws Exception; /** * Process a notification of a dispatch - used by a Slave Broker * @param messageDispatchNotification * @throws Exception TODO */ - public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception; + void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception; - public void gc(); + void gc(); /** * Provide an exact or wildcard lookup of destinations in the region * * @return a set of matching destination objects. */ - public Set getDestinations(ActiveMQDestination destination); + Set getDestinations(ActiveMQDestination destination); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java index 99d81ca118..b44d6d580a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java @@ -74,7 +74,7 @@ import org.apache.commons.logging.LogFactory; */ public class RegionBroker implements Broker { private static final Log LOG = LogFactory.getLog(RegionBroker.class); - private static final IdGenerator brokerIdGenerator = new IdGenerator(); + private static final IdGenerator BROKER_ID_GENERATOR = new IdGenerator(); private final Region queueRegion; private final Region topicRegion; @@ -486,7 +486,7 @@ public class RegionBroker implements Broker { // TODO: this should persist the broker id so that subsequent // startup // uses the same broker id. - brokerId = new BrokerId(brokerIdGenerator.generateId()); + brokerId = new BrokerId(BROKER_ID_GENERATOR.generateId()); } return brokerId; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Subscription.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Subscription.java index fa17a94b16..695e129b30 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Subscription.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Subscription.java @@ -140,50 +140,50 @@ public interface Subscription extends SubscriptionRecovery { /** * @return the JMS selector on the current subscription */ - public String getSelector(); + String getSelector(); /** * Attempts to change the current active selector on the subscription. * This operation is not supported for persistent topics. */ - public void setSelector(String selector) throws InvalidSelectorException, UnsupportedOperationException; + void setSelector(String selector) throws InvalidSelectorException, UnsupportedOperationException; /** * @return the JMX object name that this subscription was registered as if applicable */ - public ObjectName getObjectName(); + ObjectName getObjectName(); /** * Set when the subscription is registered in JMX */ - public void setObjectName(ObjectName objectName); + void setObjectName(ObjectName objectName); /** * @return true when 60% or more room is left for dispatching messages */ - public boolean isLowWaterMark(); + boolean isLowWaterMark(); /** * @return true when 10% or less room is left for dispatching messages */ - public boolean isHighWaterMark(); + boolean isHighWaterMark(); /** * inform the MessageConsumer on the client to change it's prefetch * @param newPrefetch */ - public void updateConsumerPrefetch(int newPrefetch); + void updateConsumerPrefetch(int newPrefetch); /** * optimize message consumer prefetch if the consumer supports it * */ - public void optimizePrefetch(); + void optimizePrefetch(); /** * Called when the subscription is destroyed. */ - public void destroy(); + void destroy(); /** * @return the prefetch size that is configured for the subscription @@ -196,6 +196,6 @@ public interface Subscription extends SubscriptionRecovery { * @see org.apache.activemq.region.cursors.PendingMessageCursor * @return true if recovery required */ - public boolean isRecoveryRequired(); + boolean isRecoveryRequired(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopicRegion.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopicRegion.java index d6ca4572fa..38e63f7138 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopicRegion.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopicRegion.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region; import javax.jms.JMSException; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java index d55cefb889..18ea90c773 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region; import java.io.IOException; @@ -42,25 +44,28 @@ import org.apache.commons.logging.LogFactory; public class TopicSubscription extends AbstractSubscription { private static final Log LOG = LogFactory.getLog(TopicSubscription.class); - private static final AtomicLong cursorNameCounter = new AtomicLong(0); + private static final AtomicLong CURSOR_NAME_COUNTER = new AtomicLong(0); + protected PendingMessageCursor matched; - final protected UsageManager usageManager; + protected final UsageManager usageManager; protected AtomicLong dispatchedCounter = new AtomicLong(); protected AtomicLong prefetchExtension = new AtomicLong(); + + boolean singleDestination = true; + Destination destination; + private int maximumPendingMessages = -1; private MessageEvictionStrategy messageEvictionStrategy = new OldestMessageEvictionStrategy(); private int discarded; private final Object matchedListMutex = new Object(); private final AtomicLong enqueueCounter = new AtomicLong(0); private final AtomicLong dequeueCounter = new AtomicLong(0); - boolean singleDestination = true; - Destination destination; private int memoryUsageHighWaterMark = 95; public TopicSubscription(Broker broker, ConnectionContext context, ConsumerInfo info, UsageManager usageManager) throws Exception { super(broker, context, info); this.usageManager = usageManager; - String matchedName = "TopicSubscription:" + cursorNameCounter.getAndIncrement() + "[" + info.getConsumerId().toString() + "]"; + String matchedName = "TopicSubscription:" + CURSOR_NAME_COUNTER.getAndIncrement() + "[" + info.getConsumerId().toString() + "]"; this.matched = new FilePendingMessageCursor(matchedName, broker.getTempDataStore()); } @@ -165,7 +170,7 @@ public class TopicSubscription extends AbstractSubscription { } } - synchronized public void acknowledge(final ConnectionContext context, final MessageAck ack) throws Exception { + public synchronized void acknowledge(final ConnectionContext context, final MessageAck ack) throws Exception { // Handle the standard acknowledgment case. boolean wasFull = isFull(); if (ack.isStandardAck() || ack.isPoisonAck()) { diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/AbstractPendingMessageCursor.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/AbstractPendingMessageCursor.java index d117993512..1a44ead042 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/AbstractPendingMessageCursor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/AbstractPendingMessageCursor.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.cursors; import java.util.LinkedList; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java index 0786647e10..2558217e80 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.cursors; import java.io.IOException; @@ -39,8 +41,9 @@ import org.apache.commons.logging.LogFactory; */ public class FilePendingMessageCursor extends AbstractPendingMessageCursor implements UsageListener { - static private final Log LOG = LogFactory.getLog(FilePendingMessageCursor.class); - static private final AtomicLong nameCount = new AtomicLong(); + private static final Log LOG = LogFactory.getLog(FilePendingMessageCursor.class); + private static final AtomicLong NAME_COUNT = new AtomicLong(); + private Store store; private String name; private LinkedList memoryList = new LinkedList(); @@ -56,7 +59,7 @@ public class FilePendingMessageCursor extends AbstractPendingMessageCursor imple * @param store */ public FilePendingMessageCursor(String name, Store store) { - this.name = nameCount.incrementAndGet() + "_" + name; + this.name = NAME_COUNT.incrementAndGet() + "_" + name; this.store = store; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/PendingMessageCursor.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/PendingMessageCursor.java index b5df30d95b..62a715c91d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/PendingMessageCursor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/PendingMessageCursor.java @@ -1,15 +1,18 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.broker.region.cursors; @@ -37,7 +40,7 @@ public interface PendingMessageCursor extends Service { * @param destination * @throws Exception */ - public void add(ConnectionContext context, Destination destination) throws Exception; + void add(ConnectionContext context, Destination destination) throws Exception; /** * remove a destination @@ -46,12 +49,12 @@ public interface PendingMessageCursor extends Service { * @param destination * @throws Exception */ - public void remove(ConnectionContext context, Destination destination) throws Exception; + void remove(ConnectionContext context, Destination destination) throws Exception; /** * @return true if there are no pending messages */ - public boolean isEmpty(); + boolean isEmpty(); /** * check if a Destination is Empty for this cursor @@ -59,18 +62,18 @@ public interface PendingMessageCursor extends Service { * @param destination * @return true id the Destination is empty */ - public boolean isEmpty(Destination destination); + boolean isEmpty(Destination destination); /** * reset the cursor */ - public void reset(); + void reset(); /** * hint to the cursor to release any locks it might have grabbed after a * reset */ - public void release(); + void release(); /** * add message to await dispatch @@ -79,7 +82,7 @@ public interface PendingMessageCursor extends Service { * @throws IOException * @throws Exception */ - public void addMessageLast(MessageReference node) throws Exception; + void addMessageLast(MessageReference node) throws Exception; /** * add message to await dispatch @@ -87,7 +90,7 @@ public interface PendingMessageCursor extends Service { * @param node * @throws Exception */ - public void addMessageFirst(MessageReference node) throws Exception; + void addMessageFirst(MessageReference node) throws Exception; /** * Add a message recovered from a retroactive policy @@ -95,32 +98,32 @@ public interface PendingMessageCursor extends Service { * @param node * @throws Exception */ - public void addRecoveredMessage(MessageReference node) throws Exception; + void addRecoveredMessage(MessageReference node) throws Exception; /** * @return true if there pending messages to dispatch */ - public boolean hasNext(); + boolean hasNext(); /** * @return the next pending message */ - public MessageReference next(); + MessageReference next(); /** * remove the message at the cursor position */ - public void remove(); + void remove(); /** * @return the number of pending messages */ - public int size(); + int size(); /** * clear all pending messages */ - public void clear(); + void clear(); /** * Informs the Broker if the subscription needs to intervention to recover @@ -128,37 +131,37 @@ public interface PendingMessageCursor extends Service { * * @return true if recovery required */ - public boolean isRecoveryRequired(); + boolean isRecoveryRequired(); /** * @return the maximum batch size */ - public int getMaxBatchSize(); + int getMaxBatchSize(); /** * Set the max batch size * * @param maxBatchSize */ - public void setMaxBatchSize(int maxBatchSize); + void setMaxBatchSize(int maxBatchSize); /** * Give the cursor a hint that we are about to remove messages from memory * only */ - public void resetForGC(); + void resetForGC(); /** * remove a node * * @param node */ - public void remove(MessageReference node); + void remove(MessageReference node); /** * free up any internal buffers */ - public void gc(); + void gc(); /** * Set the UsageManager @@ -166,39 +169,39 @@ public interface PendingMessageCursor extends Service { * @param usageManager * @see org.apache.activemq.memory.UsageManager */ - public void setUsageManager(UsageManager usageManager); + void setUsageManager(UsageManager usageManager); /** * @return the usageManager */ - public UsageManager getUsageManager(); + UsageManager getUsageManager(); /** * @return the memoryUsageHighWaterMark */ - public int getMemoryUsageHighWaterMark(); + int getMemoryUsageHighWaterMark(); /** * @param memoryUsageHighWaterMark the memoryUsageHighWaterMark to set */ - public void setMemoryUsageHighWaterMark(int memoryUsageHighWaterMark); + void setMemoryUsageHighWaterMark(int memoryUsageHighWaterMark); /** * @return true if the cursor is full */ - public boolean isFull(); + boolean isFull(); /** * @return true if the cursor has buffered messages ready to deliver */ - public boolean hasMessagesBufferedToDeliver(); + boolean hasMessagesBufferedToDeliver(); /** * destroy the cursor * * @throws Exception */ - public void destroy() throws Exception; + void destroy() throws Exception; /** * Page in a restricted number of messages @@ -206,6 +209,6 @@ public interface PendingMessageCursor extends Service { * @param maxItems * @return a list of paged in messages */ - public LinkedList pageInList(int maxItems); + LinkedList pageInList(int maxItems); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/QueueStorePrefetch.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/QueueStorePrefetch.java index a231c62315..59da7a672e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/QueueStorePrefetch.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/QueueStorePrefetch.java @@ -1,21 +1,19 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.cursors; import java.io.IOException; @@ -38,7 +36,7 @@ import org.apache.commons.logging.LogFactory; */ class QueueStorePrefetch extends AbstractPendingMessageCursor implements MessageRecoveryListener { - static private final Log LOG = LogFactory.getLog(QueueStorePrefetch.class); + private static final Log LOG = LogFactory.getLog(QueueStorePrefetch.class); private MessageStore store; private final LinkedList batchList = new LinkedList(); diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreDurableSubscriberCursor.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreDurableSubscriberCursor.java index de8b417f95..02f8825959 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreDurableSubscriberCursor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreDurableSubscriberCursor.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.cursors; import java.io.IOException; @@ -32,14 +34,14 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * perist pending messages pending message (messages awaiting disptach to a + * persist pending messages pending message (messages awaiting dispatch to a * consumer) cursor * * @version $Revision$ */ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor { - static private final Log log = LogFactory.getLog(StoreDurableSubscriberCursor.class); + private static final Log LOG = LogFactory.getLog(StoreDurableSubscriberCursor.class); private int pendingCount; private String clientId; private String subscriberName; @@ -182,7 +184,7 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor { try { currentCursor = getNextCursor(); } catch (Exception e) { - log.error("Failed to get current cursor ", e); + LOG.error("Failed to get current cursor ", e); throw new RuntimeException(e); } result = currentCursor != null ? currentCursor.hasNext() : false; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreQueueCursor.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreQueueCursor.java index e260747dca..252c00fd20 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreQueueCursor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreQueueCursor.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.cursors; import org.apache.activemq.broker.region.MessageReference; @@ -29,7 +31,7 @@ import org.apache.commons.logging.LogFactory; */ public class StoreQueueCursor extends AbstractPendingMessageCursor { - static private final Log LOG = LogFactory.getLog(StoreQueueCursor.class); + private static final Log LOG = LogFactory.getLog(StoreQueueCursor.class); private int pendingCount = 0; private Queue queue; private Store tmpStore; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/TopicStorePrefetch.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/TopicStorePrefetch.java index 649adfcf95..b067f52eca 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/TopicStorePrefetch.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/TopicStorePrefetch.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.cursors; import java.io.IOException; @@ -34,7 +36,7 @@ import org.apache.commons.logging.LogFactory; */ class TopicStorePrefetch extends AbstractPendingMessageCursor implements MessageRecoveryListener { - static private final Log log = LogFactory.getLog(TopicStorePrefetch.class); + private static final Log LOG = LogFactory.getLog(TopicStorePrefetch.class); private TopicMessageStore store; private final LinkedList batchList = new LinkedList(); private String clientId; @@ -64,7 +66,7 @@ class TopicStorePrefetch extends AbstractPendingMessageCursor implements Message try { fillBatch(); } catch (Exception e) { - log.error("Failed to fill batch", e); + LOG.error("Failed to fill batch", e); throw new RuntimeException(e); } } @@ -133,7 +135,7 @@ class TopicStorePrefetch extends AbstractPendingMessageCursor implements Message try { fillBatch(); } catch (final Exception e) { - log.error("Failed to fill batch", e); + LOG.error("Failed to fill batch", e); throw new RuntimeException(e); } if (batchList.isEmpty()) { @@ -193,7 +195,7 @@ class TopicStorePrefetch extends AbstractPendingMessageCursor implements Message batchList.removeFirst(); } if (batchList.isEmpty()) { - log.debug("Refilling batch - haven't got past first message = " + firstMessageId); + LOG.debug("Refilling batch - haven't got past first message = " + firstMessageId); fillBatch(); } } @@ -212,7 +214,7 @@ class TopicStorePrefetch extends AbstractPendingMessageCursor implements Message try { return store.getMessageCount(clientId, subscriberName); } catch (IOException e) { - log.error(this + " Failed to get the outstanding message count from the store", e); + LOG.error(this + " Failed to get the outstanding message count from the store", e); throw new RuntimeException(e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/VMPendingMessageCursor.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/VMPendingMessageCursor.java index 0d6bba4efa..8563022b62 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/VMPendingMessageCursor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/VMPendingMessageCursor.java @@ -1,15 +1,18 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.broker.region.cursors; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucketFactory.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucketFactory.java index 3c0fa559fe..d3b26221a1 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucketFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucketFactory.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupMapFactory.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupMapFactory.java index 7251078334..a9bc4f2dd9 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupMapFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupMapFactory.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -24,6 +24,6 @@ package org.apache.activemq.broker.region.group; */ public interface MessageGroupMapFactory { - public MessageGroupMap createMessageGroupMap(); + MessageGroupMap createMessageGroupMap(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/group/SimpleMessageGroupMapFactory.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/group/SimpleMessageGroupMapFactory.java index 670fd54525..0322dd5390 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/group/SimpleMessageGroupMapFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/group/SimpleMessageGroupMapFactory.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/DeadLetterStrategy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/DeadLetterStrategy.java index f9ff87f4da..d4453b6c34 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/DeadLetterStrategy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/DeadLetterStrategy.java @@ -32,7 +32,7 @@ public interface DeadLetterStrategy { * @param message * @return true if message should be sent to a dead letter queue */ - public boolean isSendToDeadLetterQueue(Message message); + boolean isSendToDeadLetterQueue(Message message); /** * Returns the dead letter queue for the given destination. diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingDurableSubscriberMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingDurableSubscriberMessageStoragePolicy.java index 41267d65a2..419abe710f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingDurableSubscriberMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingDurableSubscriberMessageStoragePolicy.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.region.cursors.FilePendingMessageCursor; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingQueueMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingQueueMessageStoragePolicy.java index 49301117ca..cb906e4dda 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingQueueMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingQueueMessageStoragePolicy.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.region.Queue; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingSubscriberMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingSubscriberMessageStoragePolicy.java index 1707c99c4b..2ee55377cc 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingSubscriberMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FilePendingSubscriberMessageStoragePolicy.java @@ -1,15 +1,18 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.broker.region.policy; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FixedCountSubscriptionRecoveryPolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FixedCountSubscriptionRecoveryPolicy.java index 3fe1a708aa..e423a87293 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FixedCountSubscriptionRecoveryPolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/FixedCountSubscriptionRecoveryPolicy.java @@ -45,14 +45,14 @@ public class FixedCountSubscriptionRecoveryPolicy implements SubscriptionRecover return rc; } - synchronized public boolean add(ConnectionContext context, MessageReference node) throws Exception { + public synchronized boolean add(ConnectionContext context, MessageReference node) throws Exception { messages[tail++] = node; if (tail >= messages.length) tail = 0; return true; } - synchronized public void recover(ConnectionContext context, Topic topic, SubscriptionRecovery sub) throws Exception { + public synchronized void recover(ConnectionContext context, Topic topic, SubscriptionRecovery sub) throws Exception { // Re-dispatch the last message seen. int t = tail; // The buffer may not have rolled over yet..., start from the front diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/LastImageSubscriptionRecoveryPolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/LastImageSubscriptionRecoveryPolicy.java index ddd3f04f33..aa0871f1c5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/LastImageSubscriptionRecoveryPolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/LastImageSubscriptionRecoveryPolicy.java @@ -35,7 +35,7 @@ import org.apache.activemq.filter.DestinationFilter; */ public class LastImageSubscriptionRecoveryPolicy implements SubscriptionRecoveryPolicy { - volatile private MessageReference lastImage; + private volatile MessageReference lastImage; public boolean add(ConnectionContext context, MessageReference node) throws Exception { lastImage = node; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/MessageQuery.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/MessageQuery.java index 859d5585dd..deff534a09 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/MessageQuery.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/MessageQuery.java @@ -34,7 +34,7 @@ public interface MessageQuery { * @param destination the destination on which the query is to be performed * @param listener is the listener to notify as each message is created or loaded */ - public void execute(ActiveMQDestination destination, MessageListener listener) throws Exception; + void execute(ActiveMQDestination destination, MessageListener listener) throws Exception; /** * Returns true if the given update is valid and does not overlap with the initial message query. @@ -48,6 +48,6 @@ public interface MessageQuery { * @param message the update message which may have been sent before the query actually completed * @return true if the update message is valid otherwise false in which case the update message will be discarded. */ - public boolean validateUpdate(Message message); + boolean validateUpdate(Message message); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingDurableSubscriberMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingDurableSubscriberMessageStoragePolicy.java index 24c6c4922f..629aec6eb4 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingDurableSubscriberMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingDurableSubscriberMessageStoragePolicy.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.region.cursors.PendingMessageCursor; @@ -34,5 +36,5 @@ public interface PendingDurableSubscriberMessageStoragePolicy { * @param maxBatchSize * @return the Pending Message cursor */ - public PendingMessageCursor getSubscriberPendingMessageCursor(String clientId, String name, Store tmpStorage, int maxBatchSize); + PendingMessageCursor getSubscriberPendingMessageCursor(String clientId, String name, Store tmpStorage, int maxBatchSize); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingQueueMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingQueueMessageStoragePolicy.java index a9d746f5c6..0976462471 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingQueueMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingQueueMessageStoragePolicy.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.region.Queue; @@ -33,5 +35,5 @@ public interface PendingQueueMessageStoragePolicy { * @param tmpStore * @return the cursor */ - public PendingMessageCursor getQueuePendingMessageCursor(Queue queue, Store tmpStore); + PendingMessageCursor getQueuePendingMessageCursor(Queue queue, Store tmpStore); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingSubscriberMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingSubscriberMessageStoragePolicy.java index 2b50eaa82c..d7a22dc865 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingSubscriberMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PendingSubscriberMessageStoragePolicy.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.region.cursors.PendingMessageCursor; @@ -33,5 +35,5 @@ public interface PendingSubscriberMessageStoragePolicy { * @param maxBatchSize * @return the Pending Message cursor */ - public PendingMessageCursor getSubscriberPendingMessageCursor(String name, Store tmpStorage, int maxBatchSize); + PendingMessageCursor getSubscriberPendingMessageCursor(String name, Store tmpStorage, int maxBatchSize); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java index 0eed28a464..200300414b 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.Broker; @@ -37,7 +39,7 @@ import org.apache.commons.logging.LogFactory; */ public class PolicyEntry extends DestinationMapEntry { - private static final Log log = LogFactory.getLog(PolicyEntry.class); + private static final Log LOG = LogFactory.getLog(PolicyEntry.class); private DispatchPolicy dispatchPolicy; private SubscriptionRecoveryPolicy subscriptionRecoveryPolicy; private boolean sendAdvisoryIfNoConsumers; @@ -93,8 +95,8 @@ public class PolicyEntry extends DestinationMapEntry { } } if (value >= 0) { - if (log.isDebugEnabled()) { - log.debug("Setting the maximumPendingMessages size to: " + value + " for consumer: " + subscription.getInfo().getConsumerId()); + if (LOG.isDebugEnabled()) { + LOG.debug("Setting the maximumPendingMessages size to: " + value + " for consumer: " + subscription.getInfo().getConsumerId()); } subscription.setMaximumPendingMessages(value); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/QueryBasedSubscriptionRecoveryPolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/QueryBasedSubscriptionRecoveryPolicy.java index cf920c2d14..0713f28f1a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/QueryBasedSubscriptionRecoveryPolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/QueryBasedSubscriptionRecoveryPolicy.java @@ -47,7 +47,7 @@ import org.apache.commons.logging.LogFactory; */ public class QueryBasedSubscriptionRecoveryPolicy implements SubscriptionRecoveryPolicy { - private static final Log log = LogFactory.getLog(QueryBasedSubscriptionRecoveryPolicy.class); + private static final Log LOG = LogFactory.getLog(QueryBasedSubscriptionRecoveryPolicy.class); private MessageQuery query; private AtomicLong messageSequence = new AtomicLong(0); @@ -112,7 +112,7 @@ public class QueryBasedSubscriptionRecoveryPolicy implements SubscriptionRecover configure(activeMessage); sub.addRecoveredMessage(context, activeMessage); } catch (Throwable e) { - log.warn("Failed to dispatch initial message: " + message + " into subscription. Reason: " + e, e); + LOG.warn("Failed to dispatch initial message: " + message + " into subscription. Reason: " + e, e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/RoundRobinDispatchPolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/RoundRobinDispatchPolicy.java index eccef2fd59..d387de5329 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/RoundRobinDispatchPolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/RoundRobinDispatchPolicy.java @@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class RoundRobinDispatchPolicy implements DispatchPolicy { - static final Log log = LogFactory.getLog(RoundRobinDispatchPolicy.class); + static final Log LOG = LogFactory.getLog(RoundRobinDispatchPolicy.class); /** * @param node diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/StorePendingDurableSubscriberMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/StorePendingDurableSubscriberMessageStoragePolicy.java index ce5b8b14e3..b41551f878 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/StorePendingDurableSubscriberMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/StorePendingDurableSubscriberMessageStoragePolicy.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.region.cursors.PendingMessageCursor; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/StorePendingQueueMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/StorePendingQueueMessageStoragePolicy.java index 138e1eb28f..9c39d8d3ae 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/StorePendingQueueMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/StorePendingQueueMessageStoragePolicy.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.region.Queue; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingDurableSubscriberMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingDurableSubscriberMessageStoragePolicy.java index f4d0e48026..bfd8d22489 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingDurableSubscriberMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingDurableSubscriberMessageStoragePolicy.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.region.cursors.PendingMessageCursor; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingQueueMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingQueueMessageStoragePolicy.java index e1dfdff4cd..ccfa06646a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingQueueMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingQueueMessageStoragePolicy.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.policy; import org.apache.activemq.broker.region.Queue; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingSubscriberMessageStoragePolicy.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingSubscriberMessageStoragePolicy.java index e7f95ebb7c..4eb01cfc88 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingSubscriberMessageStoragePolicy.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/VMPendingSubscriberMessageStoragePolicy.java @@ -1,15 +1,18 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.broker.region.policy; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/virtual/VirtualDestination.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/virtual/VirtualDestination.java index 64c3020bfb..0727d3fdc0 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/virtual/VirtualDestination.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/virtual/VirtualDestination.java @@ -30,10 +30,10 @@ public interface VirtualDestination extends DestinationInterceptor { /** * Returns the virtual destination */ - public ActiveMQDestination getVirtualDestination(); + ActiveMQDestination getVirtualDestination(); /** * Creates a virtual destination from the physical destination */ - public Destination intercept(Destination destination); + Destination intercept(Destination destination); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/virtual/VirtualDestinationInterceptor.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/virtual/VirtualDestinationInterceptor.java index 1950344a4a..4ad1500fec 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/virtual/VirtualDestinationInterceptor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/virtual/VirtualDestinationInterceptor.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java b/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java index ac0f01f230..484a9b0dab 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -40,7 +40,7 @@ import org.springframework.beans.factory.InitializingBean; * @org.apache.xbean.XBean */ public class CommandAgent implements Service, InitializingBean, DisposableBean, FactoryBean { - private static final Log log = LogFactory.getLog(CommandAgent.class); + private static final Log LOG = LogFactory.getLog(CommandAgent.class); private String brokerUrl = "vm://localhost"; private ConnectionFactory connectionFactory; @@ -54,8 +54,8 @@ public class CommandAgent implements Service, InitializingBean, DisposableBean, session = getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); listener = new CommandMessageListener(session); Destination destination = getCommandDestination(); - if (log.isDebugEnabled()) { - log.debug("Agent subscribing to control destination: " + destination); + if (LOG.isDebugEnabled()) { + LOG.debug("Agent subscribing to control destination: " + destination); } consumer = session.createConsumer(destination); consumer.setMessageListener(listener); diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandHandler.java b/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandHandler.java index 331bb597a1..0ba19f4c9a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandHandler.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandHandler.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandMessageListener.java b/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandMessageListener.java index 3a6546019c..6f0d206079 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandMessageListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandMessageListener.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -36,7 +36,7 @@ import java.io.InputStreamReader; * @version $Revision: $ */ public class CommandMessageListener implements MessageListener { - private static final Log log = LogFactory.getLog(CommandMessageListener.class); + private static final Log LOG = LogFactory.getLog(CommandMessageListener.class); private Session session; private MessageProducer producer; @@ -47,15 +47,15 @@ public class CommandMessageListener implements MessageListener { } public void onMessage(Message message) { - if (log.isDebugEnabled()) { - log.debug("Received command: " + message); + if (LOG.isDebugEnabled()) { + LOG.debug("Received command: " + message); } if (message instanceof TextMessage) { TextMessage request = (TextMessage) message; try { Destination replyTo = message.getJMSReplyTo(); if (replyTo == null) { - log.warn("Ignored message as no JMSReplyTo set: " + message); + LOG.warn("Ignored message as no JMSReplyTo set: " + message); return; } Message response = processCommand(request); @@ -63,11 +63,11 @@ public class CommandMessageListener implements MessageListener { getProducer().send(replyTo, response); } catch (Exception e) { - log.error("Failed to process message due to: " + e + ". Message: " + message, e); + LOG.error("Failed to process message due to: " + e + ". Message: " + message, e); } } else { - log.warn("Ignoring invalid message: " + message); + LOG.warn("Ignoring invalid message: " + message); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/util/UDPTraceBrokerPlugin.java b/activemq-core/src/main/java/org/apache/activemq/broker/util/UDPTraceBrokerPlugin.java index 97ef86eae0..857e5e08c6 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/util/UDPTraceBrokerPlugin.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/util/UDPTraceBrokerPlugin.java @@ -67,7 +67,7 @@ import org.apache.commons.logging.LogFactory; */ public class UDPTraceBrokerPlugin extends BrokerPluginSupport { - static final private Log log = LogFactory.getLog(UDPTraceBrokerPlugin.class); + private static final Log LOG = LogFactory.getLog(UDPTraceBrokerPlugin.class); protected WireFormat wireFormat; protected WireFormatFactory wireFormatFactory; protected int maxTraceDatagramSize = 1024 * 4; @@ -124,7 +124,7 @@ public class UDPTraceBrokerPlugin extends BrokerPluginSupport { socket.send(datagram); } catch (Throwable e) { - log.debug("Failed to trace: " + command, e); + LOG.debug("Failed to trace: " + command, e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/view/ConnectionDotFileInterceptor.java b/activemq-core/src/main/java/org/apache/activemq/broker/view/ConnectionDotFileInterceptor.java index ea21ec4b70..de8805420a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/view/ConnectionDotFileInterceptor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/view/ConnectionDotFileInterceptor.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/view/ConnectionDotFilePlugin.java b/activemq-core/src/main/java/org/apache/activemq/broker/view/ConnectionDotFilePlugin.java index 858d2523c9..fd87769bd1 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/view/ConnectionDotFilePlugin.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/view/ConnectionDotFilePlugin.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/view/DestinationDotFileInterceptor.java b/activemq-core/src/main/java/org/apache/activemq/broker/view/DestinationDotFileInterceptor.java index a0d2f11464..204f86d961 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/view/DestinationDotFileInterceptor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/view/DestinationDotFileInterceptor.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/view/DestinationDotFilePlugin.java b/activemq-core/src/main/java/org/apache/activemq/broker/view/DestinationDotFilePlugin.java index 024677d8ce..c3823f7f98 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/view/DestinationDotFilePlugin.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/view/DestinationDotFilePlugin.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/view/DotFileInterceptorSupport.java b/activemq-core/src/main/java/org/apache/activemq/broker/view/DotFileInterceptorSupport.java index 549ea0fb93..3b6d3d3123 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/view/DotFileInterceptorSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/view/DotFileInterceptorSupport.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelConnection.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelConnection.java index 9e74f74f7c..9b6a81ad66 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelConnection.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelConnection.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelConnectionFactory.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelConnectionFactory.java index dd7494befa..8577b0b162 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelConnectionFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelConnectionFactory.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelDestination.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelDestination.java index 6f44706f99..fd2c95f560 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelDestination.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelDestination.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelMessageConsumer.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelMessageConsumer.java index 960d531133..4188ee451b 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelMessageConsumer.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelMessageConsumer.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelMessageProducer.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelMessageProducer.java index 26f0f83700..78f28e18d5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelMessageProducer.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelMessageProducer.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueue.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueue.java index 4a4c218733..278c716b3d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueue.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueue.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueueReceiver.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueueReceiver.java index f22b7d749d..681ef26472 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueueReceiver.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueueReceiver.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueueSender.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueueSender.java index 8785541937..7052f56c96 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueueSender.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelQueueSender.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopic.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopic.java index 86ccb6b864..2c92e1a2ce 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopic.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopic.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopicPublisher.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopicPublisher.java index 0e9210f795..63cc35b29a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopicPublisher.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopicPublisher.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopicSubscriber.java b/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopicSubscriber.java index 7c958b4513..38370a8cbe 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopicSubscriber.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/CamelTopicSubscriber.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQBlobMessage.java b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQBlobMessage.java index 0e831f1b53..bcf7f8cd8c 100644 --- a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQBlobMessage.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQBlobMessage.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java index 237448c971..fd2f3407b6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java @@ -94,10 +94,10 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag public static final byte DATA_STRUCTURE_TYPE = CommandTypes.ACTIVEMQ_BYTES_MESSAGE; - transient protected DataOutputStream dataOut; - transient protected ByteArrayOutputStream bytesOut; - transient protected DataInputStream dataIn; - transient protected int length; + protected transient DataOutputStream dataOut; + protected transient ByteArrayOutputStream bytesOut; + protected transient DataInputStream dataIn; + protected transient int length; public Message copy() { ActiveMQBytesMessage copy = new ActiveMQBytesMessage(); diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQDestination.java b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQDestination.java index ac39b265b9..1eb3a7d166 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQDestination.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQDestination.java @@ -41,7 +41,7 @@ import org.apache.activemq.util.URISupport; * @openwire:marshaller * @version $Revision: 1.10 $ */ -abstract public class ActiveMQDestination extends JNDIBaseStorable implements DataStructure, Destination, +public abstract class ActiveMQDestination extends JNDIBaseStorable implements DataStructure, Destination, Externalizable, Comparable { private static final long serialVersionUID = -3885260014960795889L; @@ -64,15 +64,15 @@ abstract public class ActiveMQDestination extends JNDIBaseStorable implements Da protected String physicalName; - transient protected ActiveMQDestination[] compositeDestinations; - transient protected String[] destinationPaths; - transient protected boolean isPattern; - transient protected int hashValue; + protected transient ActiveMQDestination[] compositeDestinations; + protected transient String[] destinationPaths; + protected transient boolean isPattern; + protected transient int hashValue; protected Map options; // static helper methods for working with destinations // ------------------------------------------------------------------------- - static public ActiveMQDestination createDestination(String name, byte defaultType) { + public static ActiveMQDestination createDestination(String name, byte defaultType) { if (name.startsWith(QUEUE_QUALIFIED_PREFIX)) { return new ActiveMQQueue(name.substring(QUEUE_QUALIFIED_PREFIX.length())); @@ -186,7 +186,7 @@ abstract public class ActiveMQDestination extends JNDIBaseStorable implements Da return getQualifiedPrefix() + physicalName; } - abstract protected String getQualifiedPrefix(); + protected abstract String getQualifiedPrefix(); /** * @openwire:property version=1 @@ -271,7 +271,7 @@ abstract public class ActiveMQDestination extends JNDIBaseStorable implements Da return destinationPaths; } - abstract public byte getDestinationType(); + public abstract byte getDestinationType(); public boolean isQueue() { return false; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java index 29d785f627..7ee0c4e1aa 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java @@ -99,7 +99,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { public static final byte DATA_STRUCTURE_TYPE = CommandTypes.ACTIVEMQ_MAP_MESSAGE; - transient protected Map map = new HashMap(); + protected transient Map map = new HashMap(); public Message copy() { ActiveMQMapMessage copy = new ActiveMQMapMessage(); diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java index 64d3a2179a..aea31fee38 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java @@ -50,7 +50,7 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess return DATA_STRUCTURE_TYPE; } - transient protected Callback acknowledgeCallback; + protected transient Callback acknowledgeCallback; public Message copy() { ActiveMQMessage copy = new ActiveMQMessage(); @@ -180,7 +180,7 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess return "jms/message"; } - static protected String decodeString(byte[] data) throws JMSException { + protected static String decodeString(byte[] data) throws JMSException { try { if (data == null) { return null; @@ -191,7 +191,7 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess } } - static protected byte[] encodeString(String data) throws JMSException { + protected static byte[] encodeString(String data) throws JMSException { try { if (data == null) { return null; @@ -280,10 +280,10 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess } interface PropertySetter { - public void set(Message message, Object value) throws MessageFormatException; + void set(Message message, Object value) throws MessageFormatException; } - static final private HashMap JMS_PROPERTY_SETERS = new HashMap(); + private static final HashMap JMS_PROPERTY_SETERS = new HashMap(); static { JMS_PROPERTY_SETERS.put("JMSXDeliveryCount", new PropertySetter() { public void set(Message message, Object value) throws MessageFormatException { diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java index 82c9f8eb02..34ad027a3a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java @@ -113,10 +113,10 @@ public class ActiveMQStreamMessage extends ActiveMQMessage implements StreamMess public static final byte DATA_STRUCTURE_TYPE = CommandTypes.ACTIVEMQ_STREAM_MESSAGE; - transient protected DataOutputStream dataOut; - transient protected ByteArrayOutputStream bytesOut; - transient protected DataInputStream dataIn; - transient protected int remainingBytes = -1; + protected transient DataOutputStream dataOut; + protected transient ByteArrayOutputStream bytesOut; + protected transient DataInputStream dataIn; + protected transient int remainingBytes = -1; public Message copy() { ActiveMQStreamMessage copy = new ActiveMQStreamMessage(); diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTempDestination.java b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTempDestination.java index eb4258ed0a..e7b127ce87 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTempDestination.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTempDestination.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.command; import javax.jms.JMSException; @@ -23,9 +25,9 @@ import org.apache.commons.logging.LogFactory; * @openwire:marshaller * @version $Revision: 1.5 $ */ -abstract public class ActiveMQTempDestination extends ActiveMQDestination { +public abstract class ActiveMQTempDestination extends ActiveMQDestination { - private static final Log log = LogFactory.getLog(ActiveMQTempDestination.class); + private static final Log LOG = LogFactory.getLog(ActiveMQTempDestination.class); protected transient ActiveMQConnection connection; protected transient String connectionId; protected transient int sequenceId; @@ -70,7 +72,7 @@ abstract public class ActiveMQTempDestination extends ActiveMQDestination { try { sequenceId = Integer.parseInt(seqStr); } catch (NumberFormatException e) { - log.debug("Did not parse sequence Id from " + physicalName); + LOG.debug("Did not parse sequence Id from " + physicalName); } // The rest should be the connection id. connectionId = this.physicalName.substring(0, p); diff --git a/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java b/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java index 89cd4b14f9..b0891cf200 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java @@ -24,7 +24,7 @@ import org.apache.activemq.util.IntrospectionSupport; * @openwire:marshaller * @version $Revision: 1.11 $ */ -abstract public class BaseCommand implements Command { +public abstract class BaseCommand implements Command { protected int commandId; protected boolean responseRequired; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/Command.java b/activemq-core/src/main/java/org/apache/activemq/command/Command.java index a99b169c5d..949880a92b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/Command.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/Command.java @@ -51,14 +51,14 @@ public interface Command extends DataStructure { * The endpoint within the transport where this message came from which could be null if the * transport only supports a single endpoint. */ - public Endpoint getFrom(); + Endpoint getFrom(); - public void setFrom(Endpoint from); + void setFrom(Endpoint from); /** * The endpoint within the transport where this message is going to - null means all endpoints. */ - public Endpoint getTo(); + Endpoint getTo(); - public void setTo(Endpoint to); + void setTo(Endpoint to); } diff --git a/activemq-core/src/main/java/org/apache/activemq/command/CommandTypes.java b/activemq-core/src/main/java/org/apache/activemq/command/CommandTypes.java index 9609e70bb5..36a1347656 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/CommandTypes.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/CommandTypes.java @@ -22,155 +22,138 @@ package org.apache.activemq.command; * @version $Revision: 1.21 $ */ public interface CommandTypes { - - // What is the latest version of the openwire protocol - byte PROTOCOL_VERSION = 3; + + // What is the latest version of the openwire protocol + byte PROTOCOL_VERSION = 3; // A marshaling layer can use this type to specify a null object. - byte NULL = 0; + byte NULL = 0; - /////////////////////////////////////////////////// + // ///////////////////////////////////////////////// // // Info objects sent back and forth client/server when // setting up a client connection. // - /////////////////////////////////////////////////// - byte WIREFORMAT_INFO = 1; - byte BROKER_INFO = 2; - byte CONNECTION_INFO = 3; - byte SESSION_INFO = 4; - byte CONSUMER_INFO = 5; - byte PRODUCER_INFO = 6; - byte TRANSACTION_INFO = 7; - byte DESTINATION_INFO = 8; - byte REMOVE_SUBSCRIPTION_INFO = 9; - byte KEEP_ALIVE_INFO = 10; - byte SHUTDOWN_INFO = 11; - byte REMOVE_INFO = 12; - byte CONTROL_COMMAND = 14; - byte FLUSH_COMMAND = 15; - byte CONNECTION_ERROR = 16; - byte CONSUMER_CONTROL = 17; - byte CONNECTION_CONTROL = 18; - - /////////////////////////////////////////////////// + // ///////////////////////////////////////////////// + byte WIREFORMAT_INFO = 1; + byte BROKER_INFO = 2; + byte CONNECTION_INFO = 3; + byte SESSION_INFO = 4; + byte CONSUMER_INFO = 5; + byte PRODUCER_INFO = 6; + byte TRANSACTION_INFO = 7; + byte DESTINATION_INFO = 8; + byte REMOVE_SUBSCRIPTION_INFO = 9; + byte KEEP_ALIVE_INFO = 10; + byte SHUTDOWN_INFO = 11; + byte REMOVE_INFO = 12; + byte CONTROL_COMMAND = 14; + byte FLUSH_COMMAND = 15; + byte CONNECTION_ERROR = 16; + byte CONSUMER_CONTROL = 17; + byte CONNECTION_CONTROL = 18; + + // ///////////////////////////////////////////////// // // Messages that go back and forth between the client // and the server. // - /////////////////////////////////////////////////// - byte PRODUCER_ACK = 19; - byte MESSAGE_PULL = 20; - byte MESSAGE_DISPATCH = 21; - byte MESSAGE_ACK = 22; - - byte ACTIVEMQ_MESSAGE = 23; - byte ACTIVEMQ_BYTES_MESSAGE = 24; - byte ACTIVEMQ_MAP_MESSAGE = 25; - byte ACTIVEMQ_OBJECT_MESSAGE = 26; - byte ACTIVEMQ_STREAM_MESSAGE = 27; - byte ACTIVEMQ_TEXT_MESSAGE = 28; - byte ACTIVEMQ_BLOB_MESSAGE = 29; + // ///////////////////////////////////////////////// + byte PRODUCER_ACK = 19; + byte MESSAGE_PULL = 20; + byte MESSAGE_DISPATCH = 21; + byte MESSAGE_ACK = 22; - /////////////////////////////////////////////////// + byte ACTIVEMQ_MESSAGE = 23; + byte ACTIVEMQ_BYTES_MESSAGE = 24; + byte ACTIVEMQ_MAP_MESSAGE = 25; + byte ACTIVEMQ_OBJECT_MESSAGE = 26; + byte ACTIVEMQ_STREAM_MESSAGE = 27; + byte ACTIVEMQ_TEXT_MESSAGE = 28; + byte ACTIVEMQ_BLOB_MESSAGE = 29; + + // ///////////////////////////////////////////////// // // Command Response messages // - /////////////////////////////////////////////////// - byte RESPONSE = 30; - byte EXCEPTION_RESPONSE = 31; - byte DATA_RESPONSE = 32; - byte DATA_ARRAY_RESPONSE = 33; - byte INTEGER_RESPONSE = 34; + // ///////////////////////////////////////////////// + byte RESPONSE = 30; + byte EXCEPTION_RESPONSE = 31; + byte DATA_RESPONSE = 32; + byte DATA_ARRAY_RESPONSE = 33; + byte INTEGER_RESPONSE = 34; - - /////////////////////////////////////////////////// + // ///////////////////////////////////////////////// // // Used by discovery // - /////////////////////////////////////////////////// - byte DISCOVERY_EVENT = 40; - - /////////////////////////////////////////////////// + // ///////////////////////////////////////////////// + byte DISCOVERY_EVENT = 40; + + // ///////////////////////////////////////////////// // // Command object used by the Journal // - /////////////////////////////////////////////////// - byte JOURNAL_ACK = 50; - byte JOURNAL_REMOVE = 52; - byte JOURNAL_TRACE = 53; - byte JOURNAL_TRANSACTION = 54; - byte DURABLE_SUBSCRIPTION_INFO = 55; + // ///////////////////////////////////////////////// + byte JOURNAL_ACK = 50; + byte JOURNAL_REMOVE = 52; + byte JOURNAL_TRACE = 53; + byte JOURNAL_TRANSACTION = 54; + byte DURABLE_SUBSCRIPTION_INFO = 55; - - /////////////////////////////////////////////////// + // ///////////////////////////////////////////////// // // Reliability and fragmentation // - /////////////////////////////////////////////////// - byte PARTIAL_COMMAND = 60; - byte PARTIAL_LAST_COMMAND = 61; - - byte REPLAY = 65; + // ///////////////////////////////////////////////// + byte PARTIAL_COMMAND = 60; + byte PARTIAL_LAST_COMMAND = 61; + byte REPLAY = 65; - - - /////////////////////////////////////////////////// + // ///////////////////////////////////////////////// // // Types used represent basic Java types. // - /////////////////////////////////////////////////// - byte BYTE_TYPE = 70; - byte CHAR_TYPE = 71; - byte SHORT_TYPE = 72; - byte INTEGER_TYPE = 73; - byte LONG_TYPE = 74; - byte DOUBLE_TYPE = 75; - byte FLOAT_TYPE = 76; - byte STRING_TYPE = 77; - byte BOOLEAN_TYPE = 78; - byte BYTE_ARRAY_TYPE = 79; - - - - - - - /////////////////////////////////////////////////// + // ///////////////////////////////////////////////// + byte BYTE_TYPE = 70; + byte CHAR_TYPE = 71; + byte SHORT_TYPE = 72; + byte INTEGER_TYPE = 73; + byte LONG_TYPE = 74; + byte DOUBLE_TYPE = 75; + byte FLOAT_TYPE = 76; + byte STRING_TYPE = 77; + byte BOOLEAN_TYPE = 78; + byte BYTE_ARRAY_TYPE = 79; + + // ///////////////////////////////////////////////// // // Broker to Broker command objects // - /////////////////////////////////////////////////// - - byte MESSAGE_DISPATCH_NOTIFICATION = 90; - byte NETWORK_BRIDGE_FILTER = 91; - - - /////////////////////////////////////////////////// + // ///////////////////////////////////////////////// + + byte MESSAGE_DISPATCH_NOTIFICATION = 90; + byte NETWORK_BRIDGE_FILTER = 91; + + // ///////////////////////////////////////////////// // // Data structures contained in the command objects. // - /////////////////////////////////////////////////// - byte ACTIVEMQ_QUEUE = 100; - byte ACTIVEMQ_TOPIC = 101; - byte ACTIVEMQ_TEMP_QUEUE = 102; - byte ACTIVEMQ_TEMP_TOPIC = 103; - - byte MESSAGE_ID = 110; - byte ACTIVEMQ_LOCAL_TRANSACTION_ID = 111; - byte ACTIVEMQ_XA_TRANSACTION_ID = 112; + // ///////////////////////////////////////////////// + byte ACTIVEMQ_QUEUE = 100; + byte ACTIVEMQ_TOPIC = 101; + byte ACTIVEMQ_TEMP_QUEUE = 102; + byte ACTIVEMQ_TEMP_TOPIC = 103; - byte CONNECTION_ID = 120; - byte SESSION_ID = 121; - byte CONSUMER_ID = 122; - byte PRODUCER_ID = 123; - byte BROKER_ID = 124; - - - - - + byte MESSAGE_ID = 110; + byte ACTIVEMQ_LOCAL_TRANSACTION_ID = 111; + byte ACTIVEMQ_XA_TRANSACTION_ID = 112; + byte CONNECTION_ID = 120; + byte SESSION_ID = 121; + byte CONSUMER_ID = 122; + byte PRODUCER_ID = 123; + byte BROKER_ID = 124; } diff --git a/activemq-core/src/main/java/org/apache/activemq/command/Endpoint.java b/activemq-core/src/main/java/org/apache/activemq/command/Endpoint.java index 6b0bf3345a..aea4fca7df 100644 --- a/activemq-core/src/main/java/org/apache/activemq/command/Endpoint.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/Endpoint.java @@ -30,20 +30,20 @@ public interface Endpoint { /** * Returns the name of the endpoint. */ - public String getName(); + String getName(); /** * Returns the broker ID for this endpoint, if the endpoint is a broker or * null */ - public BrokerId getBrokerId(); + BrokerId getBrokerId(); /** * Returns the broker information for this endpoint, if the endpoint is a * broker or null */ - public BrokerInfo getBrokerInfo(); + BrokerInfo getBrokerInfo(); - public void setBrokerInfo(BrokerInfo brokerInfo); + void setBrokerInfo(BrokerInfo brokerInfo); } diff --git a/activemq-core/src/main/java/org/apache/activemq/command/MarshallAware.java b/activemq-core/src/main/java/org/apache/activemq/command/MarshallAware.java index acac6fdacc..154a11d1c2 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/MarshallAware.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/MarshallAware.java @@ -22,10 +22,12 @@ import org.apache.activemq.wireformat.WireFormat; public interface MarshallAware { - public void beforeMarshall(WireFormat wireFormat) throws IOException; - public void afterMarshall(WireFormat wireFormat) throws IOException; - - public void beforeUnmarshall(WireFormat wireFormat) throws IOException; - public void afterUnmarshall(WireFormat wireFormat) throws IOException; - + void beforeMarshall(WireFormat wireFormat) throws IOException; + + void afterMarshall(WireFormat wireFormat) throws IOException; + + void beforeUnmarshall(WireFormat wireFormat) throws IOException; + + void afterUnmarshall(WireFormat wireFormat) throws IOException; + } diff --git a/activemq-core/src/main/java/org/apache/activemq/command/Message.java b/activemq-core/src/main/java/org/apache/activemq/command/Message.java index 742197b8af..8e042da2f8 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/Message.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/Message.java @@ -38,7 +38,7 @@ import org.apache.activemq.wireformat.WireFormat; * @openwire:marshaller * @version $Revision$ */ -abstract public class Message extends BaseCommand implements MarshallAware, MessageReference { +public abstract class Message extends BaseCommand implements MarshallAware, MessageReference { public static final int AVERAGE_MESSAGE_SIZE_OVERHEAD = 500; @@ -85,7 +85,7 @@ abstract public class Message extends BaseCommand implements MarshallAware, Mess protected boolean droppable; private BrokerId[] cluster; - abstract public Message copy(); + public abstract Message copy(); protected void copy(Message copy) { super.copy(copy); @@ -108,10 +108,11 @@ abstract public class Message extends BaseCommand implements MarshallAware, Mess copy.userID = userID; copy.groupSequence = groupSequence; - if (properties != null) + if (properties != null) { copy.properties = new HashMap(properties); - else + } else { copy.properties = properties; + } copy.content = content; copy.marshalledProperties = marshalledProperties; @@ -585,7 +586,7 @@ abstract public class Message extends BaseCommand implements MarshallAware, Mess return rc; } - synchronized public int decrementReferenceCount() { + public synchronized int decrementReferenceCount() { int rc; int size; synchronized (this) { diff --git a/activemq-core/src/main/java/org/apache/activemq/command/MessageDispatch.java b/activemq-core/src/main/java/org/apache/activemq/command/MessageDispatch.java index 11fc09182a..ee94659bc4 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/MessageDispatch.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/MessageDispatch.java @@ -32,9 +32,9 @@ public class MessageDispatch extends BaseCommand { protected Message message; protected int redeliveryCounter; - transient protected long deliverySequenceId; - transient protected Object consumer; - transient protected Runnable transmitCallback; + protected transient long deliverySequenceId; + protected transient Object consumer; + protected transient Runnable transmitCallback; public byte getDataStructureType() { return DATA_STRUCTURE_TYPE; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java b/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java index a935ba97ec..e50ab791f7 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java @@ -28,8 +28,8 @@ public class MessageId implements DataStructure, Comparable { protected long producerSequenceId; protected long brokerSequenceId; - transient private String key; - transient private int hashCode; + private transient String key; + private transient int hashCode; public MessageId() { this.producerId = new ProducerId(); diff --git a/activemq-core/src/main/java/org/apache/activemq/command/NetworkBridgeFilter.java b/activemq-core/src/main/java/org/apache/activemq/command/NetworkBridgeFilter.java index 3f846d896b..fb6bff02c7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/command/NetworkBridgeFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/NetworkBridgeFilter.java @@ -32,8 +32,8 @@ import org.apache.commons.logging.LogFactory; */ public class NetworkBridgeFilter implements DataStructure, BooleanExpression { - static final Log log = LogFactory.getLog(NetworkBridgeFilter.class); public static final byte DATA_STRUCTURE_TYPE = CommandTypes.NETWORK_BRIDGE_FILTER; + static final Log LOG = LogFactory.getLog(NetworkBridgeFilter.class); private BrokerId networkBrokerId; private int networkTTL; @@ -74,8 +74,8 @@ public class NetworkBridgeFilter implements DataStructure, BooleanExpression { protected boolean matchesForwardingFilter(Message message) { if (contains(message.getBrokerPath(), networkBrokerId)) { - if (log.isTraceEnabled()) { - log.trace("Message all ready routed once through this broker - ignoring: " + message); + if (LOG.isTraceEnabled()) { + LOG.trace("Message all ready routed once through this broker - ignoring: " + message); } return false; } @@ -83,8 +83,8 @@ public class NetworkBridgeFilter implements DataStructure, BooleanExpression { int hops = message.getBrokerPath() == null ? 0 : message.getBrokerPath().length; if (hops >= networkTTL) { - if (log.isTraceEnabled()) { - log.trace("Message restricted to " + networkTTL + " network hops ignoring: " + message); + if (LOG.isTraceEnabled()) { + LOG.trace("Message restricted to " + networkTTL + " network hops ignoring: " + message); } return false; } @@ -94,8 +94,8 @@ public class NetworkBridgeFilter implements DataStructure, BooleanExpression { ConsumerInfo info = (ConsumerInfo)message.getDataStructure(); hops = info.getBrokerPath() == null ? 0 : info.getBrokerPath().length; if (hops >= networkTTL) { - if (log.isTraceEnabled()) { - log.trace("ConsumerInfo advisory restricted to " + networkTTL + " network hops ignoring: " + message); + if (LOG.isTraceEnabled()) { + LOG.trace("ConsumerInfo advisory restricted to " + networkTTL + " network hops ignoring: " + message); } return false; } diff --git a/activemq-core/src/main/java/org/apache/activemq/command/TransactionId.java b/activemq-core/src/main/java/org/apache/activemq/command/TransactionId.java index 7f0b6a5971..0647e32c50 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/TransactionId.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/TransactionId.java @@ -20,11 +20,11 @@ package org.apache.activemq.command; * @openwire:marshaller * @version $Revision: 1.6 $ */ -abstract public class TransactionId implements DataStructure { +public abstract class TransactionId implements DataStructure { - abstract public boolean isXATransaction(); - abstract public boolean isLocalTransaction(); - abstract public String getTransactionKey(); + public abstract boolean isXATransaction(); + public abstract boolean isLocalTransaction(); + public abstract String getTransactionKey(); public boolean isMarshallAware() { return false; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java b/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java index f276cc7a57..a1bffcd84e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java @@ -40,7 +40,7 @@ public class WireFormatInfo implements Command, MarshallAware { private static final int MAX_PROPERTY_SIZE = 1024 * 4; public static final byte DATA_STRUCTURE_TYPE = CommandTypes.WIREFORMAT_INFO; - static final private byte MAGIC[] = new byte[] {'A', 'c', 't', 'i', 'v', 'e', 'M', 'Q'}; + private static final byte MAGIC[] = new byte[] {'A', 'c', 't', 'i', 'v', 'e', 'M', 'Q'}; protected byte magic[] = MAGIC; protected int version; diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java b/activemq-core/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java index ae7092c6aa..f2abdd5c05 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java @@ -199,6 +199,6 @@ public abstract class ArithmeticExpression extends BinaryExpression { * @param rvalue * @return */ - abstract protected Object evaluate(Object lvalue, Object rvalue); + protected abstract Object evaluate(Object lvalue, Object rvalue); } diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/BinaryExpression.java b/activemq-core/src/main/java/org/apache/activemq/filter/BinaryExpression.java index 94ca56c3ed..b72491c2c9 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/BinaryExpression.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/BinaryExpression.java @@ -23,7 +23,7 @@ package org.apache.activemq.filter; * * @version $Revision: 1.2 $ */ -abstract public class BinaryExpression implements Expression { +public abstract class BinaryExpression implements Expression { protected Expression left; protected Expression right; @@ -77,7 +77,7 @@ abstract public class BinaryExpression implements Expression { * * @return */ - abstract public String getExpressionSymbol(); + public abstract String getExpressionSymbol(); /** * @param expression diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/BooleanExpression.java b/activemq-core/src/main/java/org/apache/activemq/filter/BooleanExpression.java index 1ebec8b3fa..a0bb6a243f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/BooleanExpression.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/BooleanExpression.java @@ -32,6 +32,6 @@ public interface BooleanExpression extends Expression { * @return true if the expression evaluates to Boolean.TRUE. * @throws JMSException */ - public boolean matches(MessageEvaluationContext message) throws JMSException; + boolean matches(MessageEvaluationContext message) throws JMSException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java b/activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java index 2231bb66f4..902ba9550d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java @@ -38,7 +38,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B return LogicExpression.createOR(createLessThan(value, left), createGreaterThan(value, right)); } - static final private HashSet REGEXP_CONTROL_CHARS = new HashSet(); + private static final HashSet REGEXP_CONTROL_CHARS = new HashSet(); static { REGEXP_CONTROL_CHARS.add(Character.valueOf('.')); @@ -415,8 +415,9 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } else { return Boolean.FALSE; } - } else + } else { return Boolean.FALSE; + } } return asBoolean(lv.compareTo(rv)) ? Boolean.TRUE : Boolean.FALSE; } diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/Expression.java b/activemq-core/src/main/java/org/apache/activemq/filter/Expression.java index f6d35efd01..e814ecc735 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/Expression.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/Expression.java @@ -30,6 +30,6 @@ public interface Expression { /** * @return the value of this expression */ - public Object evaluate(MessageEvaluationContext message) throws JMSException; + Object evaluate(MessageEvaluationContext message) throws JMSException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/LogicExpression.java b/activemq-core/src/main/java/org/apache/activemq/filter/LogicExpression.java index 9910ee155f..14a8877e36 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/LogicExpression.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/LogicExpression.java @@ -78,7 +78,7 @@ public abstract class LogicExpression extends BinaryExpression implements Boolea super(left, right); } - abstract public Object evaluate(MessageEvaluationContext message) throws JMSException; + public abstract Object evaluate(MessageEvaluationContext message) throws JMSException; public boolean matches(MessageEvaluationContext message) throws JMSException { Object object = evaluate(message); diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/MultiExpressionEvaluator.java b/activemq-core/src/main/java/org/apache/activemq/filter/MultiExpressionEvaluator.java index 58c0c01877..f60a742a7e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/MultiExpressionEvaluator.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/MultiExpressionEvaluator.java @@ -133,7 +133,7 @@ public class MultiExpressionEvaluator { * implement this interface. */ static interface ExpressionListener { - public void evaluateResultEvent(Expression selector, MessageEvaluationContext message, Object result); + void evaluateResultEvent(Expression selector, MessageEvaluationContext message, Object result); } /** diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java b/activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java index 8b6c8c468b..95ec0661aa 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java @@ -36,10 +36,10 @@ import org.apache.activemq.util.JMSExceptionSupport; public class PropertyExpression implements Expression { interface SubExpression { - public Object evaluate(Message message); + Object evaluate(Message message); } - static final private HashMap JMS_PROPERTY_EXPRESSIONS = new HashMap(); + private static final HashMap JMS_PROPERTY_EXPRESSIONS = new HashMap(); static { JMS_PROPERTY_EXPRESSIONS.put("JMSDestination", new SubExpression() { diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java b/activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java index 2f6e9b672f..0d952c0fc2 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java @@ -107,10 +107,11 @@ public abstract class UnaryExpression implements Expression { } public String getExpressionSymbol() { - if (not) + if (not) { return "NOT IN"; - else + } else { return "IN"; + } } }; } @@ -249,6 +250,6 @@ public abstract class UnaryExpression implements Expression { * * @return */ - abstract public String getExpressionSymbol(); + public abstract String getExpressionSymbol(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/filter/XPathExpression.java b/activemq-core/src/main/java/org/apache/activemq/filter/XPathExpression.java index 2950ba6263..148b112c39 100755 --- a/activemq-core/src/main/java/org/apache/activemq/filter/XPathExpression.java +++ b/activemq-core/src/main/java/org/apache/activemq/filter/XPathExpression.java @@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory; */ public final class XPathExpression implements BooleanExpression { - private static final Log log = LogFactory.getLog(XPathExpression.class); + private static final Log LOG = LogFactory.getLog(XPathExpression.class); private static final String EVALUATOR_SYSTEM_PROPERTY = "org.apache.activemq.XPathEvaluatorClassName"; private static final String DEFAULT_EVALUATOR_CLASS_NAME = XalanXPathEvaluator.class.getName(); @@ -45,13 +45,13 @@ public final class XPathExpression implements BooleanExpression { try { m = getXPathEvaluatorConstructor(cn); } catch (Throwable e) { - log.warn("Invalid " + XPathEvaluator.class.getName() + " implementation: " + cn + LOG.warn("Invalid " + XPathEvaluator.class.getName() + " implementation: " + cn + ", reason: " + e, e); cn = DEFAULT_EVALUATOR_CLASS_NAME; try { m = getXPathEvaluatorConstructor(cn); } catch (Throwable e2) { - log.error("Default XPath evaluator could not be loaded", e); + LOG.error("Default XPath evaluator could not be loaded", e); } } } finally { @@ -71,8 +71,8 @@ public final class XPathExpression implements BooleanExpression { private final String xpath; private final XPathEvaluator evaluator; - static public interface XPathEvaluator { - public boolean evaluate(Message message) throws JMSException; + public static interface XPathEvaluator { + boolean evaluate(Message message) throws JMSException; } XPathExpression(String xpath) { diff --git a/activemq-core/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java b/activemq-core/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java index 197e019473..2d3309b6cf 100755 --- a/activemq-core/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java @@ -47,9 +47,7 @@ import org.apache.activemq.command.ActiveMQTopic; */ public class ActiveMQInitialContextFactory implements InitialContextFactory { - private static final String[] defaultConnectionFactoryNames = {"ConnectionFactory", - "QueueConnectionFactory", - "TopicConnectionFactory"}; + private static final String[] DEFAULT_CONNECTION_FACTORY_NAMES = {"ConnectionFactory", "QueueConnectionFactory", "TopicConnectionFactory"}; private String connectionPrefix = "connection."; private String queuePrefix = "queue."; @@ -126,8 +124,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory { return new ReadOnlyContext(environment, data); } - protected ActiveMQConnectionFactory createConnectionFactory(String name, Hashtable environment) - throws URISyntaxException { + protected ActiveMQConnectionFactory createConnectionFactory(String name, Hashtable environment) throws URISyntaxException { Hashtable temp = new Hashtable(environment); String prefix = connectionPrefix + name + "."; for (Iterator iter = environment.entrySet().iterator(); iter.hasNext();) { @@ -147,8 +144,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory { String factoryNames = (String)environment.get("connectionFactoryNames"); if (factoryNames != null) { List list = new ArrayList(); - for (StringTokenizer enumeration = new StringTokenizer(factoryNames, ","); enumeration - .hasMoreTokens();) { + for (StringTokenizer enumeration = new StringTokenizer(factoryNames, ","); enumeration.hasMoreTokens();) { list.add(enumeration.nextToken().trim()); } int size = list.size(); @@ -158,7 +154,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory { return answer; } } - return defaultConnectionFactoryNames; + return DEFAULT_CONNECTION_FACTORY_NAMES; } protected void createQueues(Map data, Hashtable environment) { @@ -201,8 +197,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory { * Factory method to create a new connection factory from the given * environment */ - protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment) - throws URISyntaxException { + protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment) throws URISyntaxException { ActiveMQConnectionFactory answer = new ActiveMQConnectionFactory(); Properties properties = new Properties(); properties.putAll(environment); diff --git a/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIStorableInterface.java b/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIStorableInterface.java index 426a2a4b44..e8643ab0b7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIStorableInterface.java +++ b/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIStorableInterface.java @@ -32,7 +32,7 @@ public interface JNDIStorableInterface extends Referenceable { * @param properties */ - public void setProperties(Properties properties); + void setProperties(Properties properties); /** * Get the properties from this instance for storing in JNDI @@ -40,6 +40,6 @@ public interface JNDIStorableInterface extends Referenceable { * @return */ - public Properties getProperties(); + Properties getProperties(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java b/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java index dce23394aa..cfbd7b9b93 100755 --- a/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java +++ b/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java @@ -60,9 +60,10 @@ import javax.naming.spi.NamingManager; * @version $Revision: 1.2 $ $Date: 2005/08/27 03:52:39 $ */ public class ReadOnlyContext implements Context, Serializable { - private static final long serialVersionUID = -5754338187296859149L; - protected static final NameParser nameParser = new NameParserImpl(); + public static final String SEPARATOR = "/"; + protected static final NameParser NAME_PARSER = new NameParserImpl(); + private static final long serialVersionUID = -5754338187296859149L; protected final Hashtable environment; // environment for this context protected final Map bindings; // bindings at my level @@ -339,11 +340,11 @@ public class ReadOnlyContext implements Context, Serializable { } public NameParser getNameParser(Name name) throws NamingException { - return nameParser; + return NAME_PARSER; } public NameParser getNameParser(String name) throws NamingException { - return nameParser; + return NAME_PARSER; } public void rebind(Name name, Object obj) throws NamingException { diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/ListContainer.java b/activemq-core/src/main/java/org/apache/activemq/kaha/ListContainer.java index a82b2e43e3..3039d220ac 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/ListContainer.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/ListContainer.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha; import java.util.List; @@ -30,18 +32,18 @@ public interface ListContainer extends List { * populates the container will all the indexes used etc and should be * called before any operations on the container */ - public void load(); + void load(); /** * unload indexes from the container * */ - public void unload(); + void unload(); /** * @return true if the indexes are loaded */ - public boolean isLoaded(); + boolean isLoaded(); /** * For homogenous containers can set a custom marshaller for loading values @@ -49,24 +51,24 @@ public interface ListContainer extends List { * * @param marshaller */ - public void setMarshaller(Marshaller marshaller); + void setMarshaller(Marshaller marshaller); /** * @return the id the MapContainer was create with */ - public Object getId(); + Object getId(); /** * @return the number of values in the container */ - public int size(); + int size(); /** * Inserts the given element at the beginning of this list. * * @param o the element to be inserted at the beginning of this list. */ - public void addFirst(V o); + void addFirst(V o); /** * Appends the given element to the end of this list. (Identical in function @@ -74,7 +76,7 @@ public interface ListContainer extends List { * * @param o the element to be inserted at the end of this list. */ - public void addLast(V o); + void addLast(V o); /** * Removes and returns the first element from this list. @@ -82,7 +84,7 @@ public interface ListContainer extends List { * @return the first element from this list. * @throws NoSuchElementException if this list is empty. */ - public V removeFirst(); + V removeFirst(); /** * Removes and returns the last element from this list. @@ -90,7 +92,7 @@ public interface ListContainer extends List { * @return the last element from this list. * @throws NoSuchElementException if this list is empty. */ - public V removeLast(); + V removeLast(); /** * remove an objecr from the list without retrieving the old value from the @@ -99,7 +101,7 @@ public interface ListContainer extends List { * @param position * @return true if successful */ - public boolean doRemove(int position); + boolean doRemove(int position); /** * add an Object to the list but get a StoreEntry of its position @@ -107,7 +109,7 @@ public interface ListContainer extends List { * @param object * @return the entry in the Store */ - public StoreEntry placeLast(V object); + StoreEntry placeLast(V object); /** * insert an Object in first position int the list but get a StoreEntry of @@ -116,7 +118,7 @@ public interface ListContainer extends List { * @param object * @return the location in the Store */ - public StoreEntry placeFirst(V object); + StoreEntry placeFirst(V object); /** * Advanced feature = must ensure the object written doesn't overwrite other @@ -125,7 +127,7 @@ public interface ListContainer extends List { * @param entry * @param object */ - public void update(StoreEntry entry, V object); + void update(StoreEntry entry, V object); /** * Retrieve an Object from the Store by its location @@ -133,21 +135,21 @@ public interface ListContainer extends List { * @param entry * @return the Object at that entry */ - public V get(StoreEntry entry); + V get(StoreEntry entry); /** * Get the StoreEntry for the first item of the list * * @return the first StoreEntry or null if the list is empty */ - public StoreEntry getFirst(); + StoreEntry getFirst(); /** * Get the StoreEntry for the last item of the list * * @return the last StoreEntry or null if the list is empty */ - public StoreEntry getLast(); + StoreEntry getLast(); /** * Get the next StoreEntry from the list @@ -155,7 +157,7 @@ public interface ListContainer extends List { * @param entry * @return the next StoreEntry or null */ - public StoreEntry getNext(StoreEntry entry); + StoreEntry getNext(StoreEntry entry); /** * Get the previous StoreEntry from the list @@ -163,7 +165,7 @@ public interface ListContainer extends List { * @param entry * @return the previous store entry or null */ - public StoreEntry getPrevious(StoreEntry entry); + StoreEntry getPrevious(StoreEntry entry); /** * remove the Object at the StoreEntry @@ -171,7 +173,7 @@ public interface ListContainer extends List { * @param entry * @return true if successful */ - public boolean remove(StoreEntry entry); + boolean remove(StoreEntry entry); /** * It's possible that a StoreEntry could be come stale this will return an @@ -180,5 +182,5 @@ public interface ListContainer extends List { * @param entry old entry * @return a refreshed StoreEntry */ - public StoreEntry refresh(StoreEntry entry); + StoreEntry refresh(StoreEntry entry); } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/MapContainer.java b/activemq-core/src/main/java/org/apache/activemq/kaha/MapContainer.java index ccee6589b2..913d29ebb7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/MapContainer.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/MapContainer.java @@ -33,18 +33,18 @@ public interface MapContainer extends Map { * populates the container will all the indexes used etc and should be * called before any operations on the container */ - public void load(); + void load(); /** * unload indexes from the container * */ - public void unload(); + void unload(); /** * @return true if the indexes are loaded */ - public boolean isLoaded(); + boolean isLoaded(); /** * For homogenous containers can set a custom marshaller for loading keys @@ -52,7 +52,7 @@ public interface MapContainer extends Map { * * @param keyMarshaller */ - public void setKeyMarshaller(Marshaller keyMarshaller); + void setKeyMarshaller(Marshaller keyMarshaller); /** * For homogenous containers can set a custom marshaller for loading values @@ -61,28 +61,28 @@ public interface MapContainer extends Map { * @param valueMarshaller * */ - public void setValueMarshaller(Marshaller valueMarshaller); + void setValueMarshaller(Marshaller valueMarshaller); /** * @return the id the MapContainer was create with */ - public Object getId(); + Object getId(); /** * @return the number of values in the container */ - public int size(); + int size(); /** * @return true if there are no values stored in the container */ - public boolean isEmpty(); + boolean isEmpty(); /** * @param key * @return true if the container contains the key */ - public boolean containsKey(K key); + boolean containsKey(K key); /** * Get the value associated with the key @@ -90,37 +90,37 @@ public interface MapContainer extends Map { * @param key * @return the value associated with the key from the store */ - public V get(K key); + V get(K key); /** * @param o * @return true if the MapContainer contains the value o */ - public boolean containsValue(K o); + boolean containsValue(K o); /** * Add add entries in the supplied Map * * @param map */ - public void putAll(Map map); + void putAll(Map map); /** * @return a Set of all the keys */ - public Set keySet(); + Set keySet(); /** * @return a collection of all the values - the values will be lazily pulled * out of the store if iterated etc. */ - public Collection values(); + Collection values(); /** * @return a Set of all the Map.Entry instances - the values will be lazily * pulled out of the store if iterated etc. */ - public Set> entrySet(); + Set> entrySet(); /** * Add an entry @@ -129,7 +129,7 @@ public interface MapContainer extends Map { * @param value * @return the old value for the key */ - public V put(K key, V value); + V put(K key, V value); /** * remove an entry associated with the key @@ -137,12 +137,12 @@ public interface MapContainer extends Map { * @param key * @return the old value assocaited with the key or null */ - public V remove(K key); + V remove(K key); /** * empty the container */ - public void clear(); + void clear(); /** * Add an entry to the Store Map @@ -151,14 +151,14 @@ public interface MapContainer extends Map { * @param Value * @return the StoreEntry associated with the entry */ - public StoreEntry place(K key, V Value); + StoreEntry place(K key, V value); /** * Remove an Entry from ther Map * * @param entry */ - public void remove(StoreEntry entry); + void remove(StoreEntry entry); /** * Get the Key object from it's location @@ -166,7 +166,7 @@ public interface MapContainer extends Map { * @param keyLocation * @return the key for the entry */ - public K getKey(StoreEntry keyLocation); + K getKey(StoreEntry keyLocation); /** * Get the value from it's location @@ -174,21 +174,21 @@ public interface MapContainer extends Map { * @param Valuelocation * @return the Object */ - public V getValue(StoreEntry Valuelocation); + V getValue(StoreEntry valueLocation); /** * Get the StoreEntry for the first value in the Map * * @return the first StoreEntry or null if the map is empty */ - public StoreEntry getFirst(); + StoreEntry getFirst(); /** * Get the StoreEntry for the last value item of the Map * * @return the last StoreEntry or null if the list is empty */ - public StoreEntry getLast(); + StoreEntry getLast(); /** * Get the next StoreEntry value from the map @@ -196,7 +196,7 @@ public interface MapContainer extends Map { * @param entry * @return the next StoreEntry or null */ - public StoreEntry getNext(StoreEntry entry); + StoreEntry getNext(StoreEntry entry); /** * Get the previous StoreEntry from the map @@ -204,7 +204,7 @@ public interface MapContainer extends Map { * @param entry * @return the previous store entry or null */ - public StoreEntry getPrevious(StoreEntry entry); + StoreEntry getPrevious(StoreEntry entry); /** * It's possible that a StoreEntry could be come stale this will return an @@ -213,7 +213,7 @@ public interface MapContainer extends Map { * @param entry old entry * @return a refreshed StoreEntry */ - public StoreEntry refresh(StoreEntry entry); + StoreEntry refresh(StoreEntry entry); /** * Get the StoreEntry associated with the key @@ -221,5 +221,5 @@ public interface MapContainer extends Map { * @param key * @return the StoreEntry */ - public StoreEntry getEntry(K key); + StoreEntry getEntry(K key); } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/Marshaller.java b/activemq-core/src/main/java/org/apache/activemq/kaha/Marshaller.java index c98ae2cf41..4883f4086f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/Marshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/Marshaller.java @@ -34,7 +34,7 @@ public interface Marshaller { * @param dataOut * @throws IOException */ - public void writePayload(T object, DataOutput dataOut) throws IOException; + void writePayload(T object, DataOutput dataOut) throws IOException; /** @@ -43,7 +43,7 @@ public interface Marshaller { * @return unmarshalled object * @throws IOException */ - public T readPayload(DataInput dataIn) throws IOException; + T readPayload(DataInput dataIn) throws IOException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/ObjectMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/kaha/ObjectMarshaller.java index 2a6d102a50..a05edd961a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/ObjectMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/ObjectMarshaller.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha; import java.io.ByteArrayInputStream; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/Store.java b/activemq-core/src/main/java/org/apache/activemq/kaha/Store.java index 0c976a99ee..a56a9a0034 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/Store.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/Store.java @@ -28,48 +28,48 @@ public interface Store { /** * Defauly container name */ - public static final String DEFAULT_CONTAINER_NAME = "kaha"; + String DEFAULT_CONTAINER_NAME = "kaha"; /** * Byte Marshaller */ - public final static Marshaller BytesMarshaller = new BytesMarshaller(); + Marshaller BYTES_MARSHALLER = new BytesMarshaller(); /** * Object Marshaller */ - public final static Marshaller ObjectMarshaller = new ObjectMarshaller(); + Marshaller OBJECT_MARSHALLER = new ObjectMarshaller(); /** * String Marshaller */ - public final static Marshaller StringMarshaller = new StringMarshaller(); + Marshaller STRING_MARSHALLER = new StringMarshaller(); /** * Command Marshaller */ - public final static Marshaller CommandMarshaller = new CommandMarshaller(); + Marshaller COMMAND_MARSHALLER = new CommandMarshaller(); /** * close the store * * @throws IOException */ - public void close() throws IOException; + void close() throws IOException; /** * Force all writes to disk * * @throws IOException */ - public void force() throws IOException; + void force() throws IOException; /** * empty all the contents of the store * * @throws IOException */ - public void clear() throws IOException; + void clear() throws IOException; /** * delete the store @@ -77,7 +77,7 @@ public interface Store { * @return true if the delete was successful * @throws IOException */ - public boolean delete() throws IOException; + boolean delete() throws IOException; /** * Checks if a MapContainer exists in the default container @@ -86,7 +86,7 @@ public interface Store { * @return new MapContainer * @throws IOException */ - public boolean doesMapContainerExist(Object id) throws IOException; + boolean doesMapContainerExist(Object id) throws IOException; /** * Checks if a MapContainer exists in the named container @@ -96,7 +96,7 @@ public interface Store { * @return new MapContainer * @throws IOException */ - public boolean doesMapContainerExist(Object id, String containerName) throws IOException; + boolean doesMapContainerExist(Object id, String containerName) throws IOException; /** * Get a MapContainer with the given id - the MapContainer is created if @@ -106,7 +106,7 @@ public interface Store { * @return container for the associated id or null if it doesn't exist * @throws IOException */ - public MapContainer getMapContainer(Object id) throws IOException; + MapContainer getMapContainer(Object id) throws IOException; /** * Get a MapContainer with the given id - the MapContainer is created if @@ -117,7 +117,7 @@ public interface Store { * @return container for the associated id or null if it doesn't exist * @throws IOException */ - public MapContainer getMapContainer(Object id, String containerName) throws IOException; + MapContainer getMapContainer(Object id, String containerName) throws IOException; /** * Get a MapContainer with the given id - the MapContainer is created if @@ -129,8 +129,7 @@ public interface Store { * @return container for the associated id or null if it doesn't exist * @throws IOException */ - public MapContainer getMapContainer(Object id, String containerName, boolean persistentIndex) - throws IOException; + MapContainer getMapContainer(Object id, String containerName, boolean persistentIndex) throws IOException; /** * delete a container from the default container @@ -138,7 +137,7 @@ public interface Store { * @param id * @throws IOException */ - public void deleteMapContainer(Object id) throws IOException; + void deleteMapContainer(Object id) throws IOException; /** * delete a MapContainer from the name container @@ -147,7 +146,7 @@ public interface Store { * @param containerName * @throws IOException */ - public void deleteMapContainer(Object id, String containerName) throws IOException; + void deleteMapContainer(Object id, String containerName) throws IOException; /** * Delete Map container @@ -155,7 +154,7 @@ public interface Store { * @param id * @throws IOException */ - public void deleteMapContainer(ContainerId id) throws IOException; + void deleteMapContainer(ContainerId id) throws IOException; /** * Get a Set of call MapContainer Ids @@ -163,7 +162,7 @@ public interface Store { * @return the set of ids * @throws IOException */ - public Set getMapContainerIds() throws IOException; + Set getMapContainerIds() throws IOException; /** * Checks if a ListContainer exists in the default container @@ -172,7 +171,7 @@ public interface Store { * @return new MapContainer * @throws IOException */ - public boolean doesListContainerExist(Object id) throws IOException; + boolean doesListContainerExist(Object id) throws IOException; /** * Checks if a ListContainer exists in the named container @@ -182,7 +181,7 @@ public interface Store { * @return new MapContainer * @throws IOException */ - public boolean doesListContainerExist(Object id, String containerName) throws IOException; + boolean doesListContainerExist(Object id, String containerName) throws IOException; /** * Get a ListContainer with the given id and creates it if it doesn't exist @@ -191,7 +190,7 @@ public interface Store { * @return container for the associated id or null if it doesn't exist * @throws IOException */ - public ListContainer getListContainer(Object id) throws IOException; + ListContainer getListContainer(Object id) throws IOException; /** * Get a ListContainer with the given id and creates it if it doesn't exist @@ -201,7 +200,7 @@ public interface Store { * @return container for the associated id or null if it doesn't exist * @throws IOException */ - public ListContainer getListContainer(Object id, String containerName) throws IOException; + ListContainer getListContainer(Object id, String containerName) throws IOException; /** * Get a ListContainer with the given id and creates it if it doesn't exist @@ -212,8 +211,7 @@ public interface Store { * @return container for the associated id or null if it doesn't exist * @throws IOException */ - public ListContainer getListContainer(Object id, String containerName, boolean persistentIndex) - throws IOException; + ListContainer getListContainer(Object id, String containerName, boolean persistentIndex) throws IOException; /** * delete a ListContainer from the default container @@ -221,7 +219,7 @@ public interface Store { * @param id * @throws IOException */ - public void deleteListContainer(Object id) throws IOException; + void deleteListContainer(Object id) throws IOException; /** * delete a ListContainer from the named container @@ -230,7 +228,7 @@ public interface Store { * @param containerName * @throws IOException */ - public void deleteListContainer(Object id, String containerName) throws IOException; + void deleteListContainer(Object id, String containerName) throws IOException; /** * delete a list container @@ -238,7 +236,7 @@ public interface Store { * @param id * @throws IOException */ - public void deleteListContainer(ContainerId id) throws IOException; + void deleteListContainer(ContainerId id) throws IOException; /** * Get a Set of call ListContainer Ids @@ -246,23 +244,23 @@ public interface Store { * @return the set of ids * @throws IOException */ - public Set getListContainerIds() throws IOException; + Set getListContainerIds() throws IOException; /** * @return the maxDataFileLength */ - public long getMaxDataFileLength(); + long getMaxDataFileLength(); /** * @param maxDataFileLength the maxDataFileLength to set */ - public void setMaxDataFileLength(long maxDataFileLength); + void setMaxDataFileLength(long maxDataFileLength); /** * @see org.apache.activemq.kaha.IndexTypes * @return the default index type */ - public String getIndexTypeAsString(); + String getIndexTypeAsString(); /** * Set the default index type @@ -270,10 +268,10 @@ public interface Store { * @param type * @see org.apache.activemq.kaha.IndexTypes */ - public void setIndexTypeAsString(String type); + void setIndexTypeAsString(String type); /** * @return true if the store has been initialized */ - public boolean isInitialized(); + boolean isInitialized(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/StoreEntry.java b/activemq-core/src/main/java/org/apache/activemq/kaha/StoreEntry.java index de1db58dae..11901d6114 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/StoreEntry.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/StoreEntry.java @@ -23,36 +23,36 @@ package org.apache.activemq.kaha; */ public interface StoreEntry { - public abstract StoreLocation getKeyDataItem(); + StoreLocation getKeyDataItem(); - public abstract StoreLocation getValueDataItem(); + StoreLocation getValueDataItem(); /** * @return next item */ - public abstract long getNextItem(); + long getNextItem(); /** * @return Returns the keyFile. */ - public abstract int getKeyFile(); + int getKeyFile(); /** * @return Returns the valueFile. */ - public abstract int getValueFile(); + int getValueFile(); /** * @return Returns the valueOffset. */ - public abstract long getValueOffset(); + long getValueOffset(); /** * @return Returns the offset. */ - public abstract long getOffset(); + long getOffset(); - public abstract int getKeySize(); + int getKeySize(); - public abstract int getValueSize(); + int getValueSize(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/StoreLocation.java b/activemq-core/src/main/java/org/apache/activemq/kaha/StoreLocation.java index 0482ea29c1..de02a1f5fe 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/StoreLocation.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/StoreLocation.java @@ -1,21 +1,19 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha; /** @@ -28,15 +26,15 @@ public interface StoreLocation { /** * @return Returns the size. */ - public int getSize(); + int getSize(); /** * @return Returns the offset. */ - public long getOffset(); + long getOffset(); /** * @return Returns the file. */ - public int getFile(); + int getFile(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/DataManager.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/DataManager.java index 0674f61967..9bab29963c 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/DataManager.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/DataManager.java @@ -1,3 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.activemq.kaha.impl; import java.io.IOException; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexRootContainer.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexRootContainer.java index a4a5fca058..55cd390319 100755 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexRootContainer.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexRootContainer.java @@ -40,8 +40,8 @@ import org.apache.commons.logging.LogFactory; */ class IndexRootContainer { - private static final Log log = LogFactory.getLog(IndexRootContainer.class); - protected static final Marshaller rootMarshaller = Store.ObjectMarshaller; + private static final Log LOG = LogFactory.getLog(IndexRootContainer.class); + protected static final Marshaller ROOT_MARSHALLER = Store.OBJECT_MARSHALLER; protected IndexItem root; protected IndexManager indexManager; protected DataManager dataManager; @@ -56,7 +56,7 @@ class IndexRootContainer { while (nextItem != Item.POSITION_NOT_SET) { StoreEntry item = indexManager.getIndex(nextItem); StoreLocation data = item.getKeyDataItem(); - Object key = dataManager.readItem(rootMarshaller, data); + Object key = dataManager.readItem(ROOT_MARSHALLER, data); map.put(key, item); list.add(item); nextItem = item.getNextItem(); @@ -73,7 +73,7 @@ class IndexRootContainer { removeRoot(containerIndexManager, key); } - StoreLocation data = dataManager.storeDataItem(rootMarshaller, key); + StoreLocation data = dataManager.storeDataItem(ROOT_MARSHALLER, key); IndexItem newRoot = indexManager.createNewIndex(); newRoot.setKeyData(data); IndexItem containerRoot = containerIndexManager.createNewIndex(); diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java index 956c7caef3..21a236f303 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java @@ -1,21 +1,19 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl; import java.io.File; @@ -55,11 +53,12 @@ import org.apache.commons.logging.LogFactory; */ public class KahaStore implements Store { - private final static String PROPERTY_PREFIX = "org.apache.activemq.kaha.Store"; - private final static boolean brokenFileLock = "true".equals(System.getProperty(PROPERTY_PREFIX + ".FileLockBroken", "false")); - private final static boolean disableLocking = "true".equals(System.getProperty(PROPERTY_PREFIX + ".DisableLocking", "false")); + private static final String PROPERTY_PREFIX = "org.apache.activemq.kaha.Store"; + private static final boolean BROKEN_FILE_LOCK = "true".equals(System.getProperty(PROPERTY_PREFIX + ".FileLockBroken", "false")); + private static final boolean DISABLE_LOCKING = "true".equals(System.getProperty(PROPERTY_PREFIX + ".DisableLocking", "false")); - private static final Log log = LogFactory.getLog(KahaStore.class); + private static final Log LOG = LogFactory.getLog(KahaStore.class); + private final File directory; private final String mode; private IndexRootContainer mapsContainer; @@ -168,7 +167,7 @@ public class KahaStore implements Store { } } String str = result ? "successfully deleted" : "failed to delete"; - log.info("Kaha Store " + str + " data directory " + directory); + LOG.info("Kaha Store " + str + " data directory " + directory); } return result; } @@ -420,7 +419,7 @@ public class KahaStore implements Store { throw new IOException("Store has been closed."); if (!initialized) { - log.info("Kaha Store using data directory " + directory); + LOG.info("Kaha Store using data directory " + directory); lockFile = new RandomAccessFile(new File(directory, "lock"), "rw"); lock(); @@ -454,16 +453,17 @@ public class KahaStore implements Store { } private synchronized void lock() throws IOException { - if (!disableLocking && directory != null && lock == null) { + if (!DISABLE_LOCKING && directory != null && lock == null) { String key = getPropertyKey(); String property = System.getProperty(key); if (null == property) { - if (!brokenFileLock) { + if (!BROKEN_FILE_LOCK) { lock = lockFile.getChannel().tryLock(); if (lock == null) { throw new StoreLockedExcpetion("Kaha Store " + directory.getName() + " is already opened by another application"); - } else + } else { System.setProperty(key, new Date().toString()); + } } } else { // already locked throw new StoreLockedExcpetion("Kaha Store " + directory.getName() + " is already opened by this application."); @@ -472,7 +472,7 @@ public class KahaStore implements Store { } private synchronized void unlock() throws IOException { - if (!disableLocking && (null != directory) && (null != lock)) { + if (!DISABLE_LOCKING && (null != directory) && (null != lock)) { System.getProperties().remove(getPropertyKey()); if (lock.isValid()) { lock.release(); diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java index 670a16da61..8f8bafcc75 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java @@ -348,7 +348,7 @@ public final class AsyncDataManager { } } - synchronized public void consolidateDataFilesNotIn(Set inUse) throws IOException { + public synchronized void consolidateDataFilesNotIn(Set inUse) throws IOException { // Substract and the difference is the set of files that are no longer // needed :) diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java index 138e9221fa..b30ed4b675 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java @@ -31,9 +31,9 @@ import org.apache.activemq.util.ByteSequence; * * @version $Revision: 1.1 $ */ -final public class ControlFile { +public final class ControlFile { - private final static boolean DISABLE_FILE_LOCK = "true".equals(System.getProperty("java.nio.channels.FileLock.broken", "false")); + private static final boolean DISABLE_FILE_LOCK = "true".equals(System.getProperty("java.nio.channels.FileLock.broken", "false")); private final File file; /** The File that holds the control data. */ @@ -96,7 +96,7 @@ final public class ControlFile { } } - synchronized public ByteSequence load() throws IOException { + public synchronized ByteSequence load() throws IOException { long l = randomAccessFile.length(); if (l < maxRecordSize) { return null; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAccessorPool.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAccessorPool.java index 0da580c83a..6b2aa4c18f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAccessorPool.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAccessorPool.java @@ -32,7 +32,7 @@ public class DataFileAccessorPool { private final HashMap pools = new HashMap(); private boolean closed; - int MAX_OPEN_READERS_PER_FILE = 5; + int maxOpenReadersPerFile = 5; class Pool { @@ -61,7 +61,7 @@ public class DataFileAccessorPool { public void closeDataFileReader(DataFileAccessor reader) { openCounter--; used = true; - if (pool.size() >= MAX_OPEN_READERS_PER_FILE || disposed) { + if (pool.size() >= maxOpenReadersPerFile || disposed) { reader.dispose(); } else { pool.add(reader); @@ -148,7 +148,7 @@ public class DataFileAccessorPool { } } - synchronized public void close() { + public synchronized void close() { if (closed) return; closed = true; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java index 6a206bf8e9..4e55eac3d5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java @@ -37,9 +37,9 @@ class DataFileAppender { protected static final byte[] RESERVED_SPACE = new byte[AsyncDataManager.ITEM_HEAD_RESERVED_SPACE]; protected static final String SHUTDOWN_COMMAND = "SHUTDOWN"; - int MAX_WRITE_BATCH_SIZE = 1024 * 1024 * 4; + int maxWriteBatchSize = 1024 * 1024 * 4; - static public class WriteKey { + public static class WriteKey { private final int file; private final long offset; private final int hash; @@ -80,7 +80,7 @@ class DataFileAppender { public boolean canAppend(DataFile dataFile, WriteCommand write) { if (dataFile != this.dataFile) return false; - if (size + write.location.getSize() >= MAX_WRITE_BATCH_SIZE) + if (size + write.location.getSize() >= maxWriteBatchSize) return false; return true; } @@ -263,7 +263,7 @@ class DataFileAppender { RandomAccessFile file = null; try { - DataByteArrayOutputStream buff = new DataByteArrayOutputStream(MAX_WRITE_BATCH_SIZE); + DataByteArrayOutputStream buff = new DataByteArrayOutputStream(maxWriteBatchSize); while (true) { Object o = null; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataManagerFacade.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataManagerFacade.java index 0107d7cd30..2f70c034d9 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataManagerFacade.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataManagerFacade.java @@ -56,13 +56,13 @@ public final class DataManagerFacade implements org.apache.activemq.kaha.impl.Da } } - static private StoreLocation convertToStoreLocation(Location location) { + private static StoreLocation convertToStoreLocation(Location location) { if (location == null) return null; return new StoreLocationFacade(location); } - static private Location convertFromStoreLocation(StoreLocation location) { + private static Location convertFromStoreLocation(StoreLocation location) { if (location == null) return null; @@ -77,7 +77,7 @@ public final class DataManagerFacade implements org.apache.activemq.kaha.impl.Da return l; } - static final private ByteSequence FORCE_COMMAND = new ByteSequence(new byte[] {'F', 'O', 'R', 'C', 'E'}); + private static final ByteSequence FORCE_COMMAND = new ByteSequence(new byte[] {'F', 'O', 'R', 'C', 'E'}); AsyncDataManager dataManager; private final String name; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/JournalFacade.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/JournalFacade.java index b93aa268ab..2a9d7f9370 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/JournalFacade.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/JournalFacade.java @@ -51,13 +51,13 @@ public final class JournalFacade implements Journal { } } - static private RecordLocation convertToRecordLocation(Location location) { + private static RecordLocation convertToRecordLocation(Location location) { if (location == null) return null; return new RecordLocationFacade(location); } - static private Location convertFromRecordLocation(RecordLocation location) { + private static Location convertFromRecordLocation(RecordLocation location) { if (location == null) return null; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/NIODataFileAppender.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/NIODataFileAppender.java index 3fa96168f9..5ae6843c7f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/NIODataFileAppender.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/NIODataFileAppender.java @@ -52,7 +52,7 @@ class NIODataFileAppender extends DataFileAppender { ByteBuffer header = ByteBuffer.allocateDirect(AsyncDataManager.ITEM_HEAD_SPACE); ByteBuffer footer = ByteBuffer.allocateDirect(AsyncDataManager.ITEM_FOOT_SPACE); - ByteBuffer buffer = ByteBuffer.allocateDirect(MAX_WRITE_BATCH_SIZE); + ByteBuffer buffer = ByteBuffer.allocateDirect(maxWriteBatchSize); // Populate the static parts of the headers and footers.. header.putInt(0); // size diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/BaseContainerImpl.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/BaseContainerImpl.java index c055f01226..34a88f2482 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/BaseContainerImpl.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/BaseContainerImpl.java @@ -1,21 +1,19 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.container; import java.io.IOException; @@ -110,11 +108,11 @@ public abstract class BaseContainerImpl { protected abstract void remove(IndexItem currentItem); - protected synchronized final IndexLinkedList getInternalList() { + protected final synchronized IndexLinkedList getInternalList() { return indexList; } - public synchronized final void close() { + public final synchronized void close() { unload(); closed = true; } @@ -124,7 +122,7 @@ public abstract class BaseContainerImpl { * * @see org.apache.activemq.kaha.ListContainer#isLoaded() */ - public synchronized final boolean isLoaded() { + public final synchronized boolean isLoaded() { checkClosed(); return loaded; } @@ -147,7 +145,7 @@ public abstract class BaseContainerImpl { return indexManager; } - public synchronized final void expressDataInterest() throws IOException { + public final synchronized void expressDataInterest() throws IOException { long nextItem = root.getNextItem(); while (nextItem != Item.POSITION_NOT_SET) { IndexItem item = indexManager.getIndex(nextItem); diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ContainerListIterator.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ContainerListIterator.java index 194b18afb7..9c14e43224 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ContainerListIterator.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ContainerListIterator.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.container; import java.util.ListIterator; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ContainerValueCollectionIterator.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ContainerValueCollectionIterator.java index d3ba3660d0..14fca136c6 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ContainerValueCollectionIterator.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ContainerValueCollectionIterator.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.container; import java.util.Iterator; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ListContainerImpl.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ListContainerImpl.java index 4c98e7987f..d7b2aa19f7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ListContainerImpl.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/ListContainerImpl.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.container; import java.io.IOException; @@ -42,8 +44,8 @@ import org.apache.commons.logging.LogFactory; */ public class ListContainerImpl extends BaseContainerImpl implements ListContainer { - private static final Log log = LogFactory.getLog(ListContainerImpl.class); - protected Marshaller marshaller = Store.ObjectMarshaller; + private static final Log LOG = LogFactory.getLog(ListContainerImpl.class); + protected Marshaller marshaller = Store.OBJECT_MARSHALLER; public ListContainerImpl(ContainerId id, IndexItem root, IndexManager indexManager, DataManager dataManager, boolean persistentIndex) throws IOException { @@ -70,7 +72,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine nextItem = item.getNextItem(); } } catch (IOException e) { - log.error("Failed to load container " + getId(), e); + LOG.error("Failed to load container " + getId(), e); throw new RuntimeStoreException(e); } } @@ -775,7 +777,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine storeIndex(index); } } catch (IOException e) { - log.error("Failed to write " + value, e); + LOG.error("Failed to write " + value, e); throw new RuntimeStoreException(e); } return index; @@ -801,7 +803,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine storeIndex(index); } } catch (IOException e) { - log.error("Failed to write " + value, e); + LOG.error("Failed to write " + value, e); throw new RuntimeStoreException(e); } return index; @@ -838,7 +840,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine storeIndex(index); } } catch (IOException e) { - log.error("Failed to insert " + value, e); + LOG.error("Failed to insert " + value, e); throw new RuntimeStoreException(e); } return index; @@ -851,7 +853,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine StoreLocation data = item.getValueDataItem(); result = dataManager.readItem(marshaller, data); } catch (IOException e) { - log.error("Failed to get value for " + item, e); + LOG.error("Failed to get value for " + item, e); throw new RuntimeStoreException(e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/MapContainerImpl.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/MapContainerImpl.java index acb2edb06e..7e3283e6d5 100755 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/MapContainerImpl.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/container/MapContainerImpl.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.container; import java.io.File; @@ -45,10 +47,10 @@ import org.apache.commons.logging.LogFactory; */ public final class MapContainerImpl extends BaseContainerImpl implements MapContainer { - private static final Log log = LogFactory.getLog(MapContainerImpl.class); + private static final Log LOG = LogFactory.getLog(MapContainerImpl.class); protected Index index; - protected Marshaller keyMarshaller = Store.ObjectMarshaller; - protected Marshaller valueMarshaller = Store.ObjectMarshaller; + protected Marshaller keyMarshaller = Store.OBJECT_MARSHALLER; + protected Marshaller valueMarshaller = Store.OBJECT_MARSHALLER; protected File directory; public MapContainerImpl(File directory, ContainerId id, IndexItem root, IndexManager indexManager, @@ -66,7 +68,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont try { this.index = new HashIndex(directory, name, indexManager); } catch (IOException e) { - log.error("Failed to create HashIndex", e); + LOG.error("Failed to create HashIndex", e); throw new RuntimeException(e); } } else { @@ -101,7 +103,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont nextItem = item.getNextItem(); } } catch (IOException e) { - log.error("Failed to load container " + getId(), e); + LOG.error("Failed to load container " + getId(), e); throw new RuntimeStoreException(e); } } @@ -120,7 +122,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont try { index.unload(); } catch (IOException e) { - log.warn("Failed to unload the index", e); + LOG.warn("Failed to unload the index", e); } indexList.clear(); } @@ -169,7 +171,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont try { return index.containsKey(key); } catch (IOException e) { - log.error("Failed trying to find key: " + key, e); + LOG.error("Failed trying to find key: " + key, e); throw new RuntimeException(e); } } @@ -186,7 +188,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont try { item = index.get(key); } catch (IOException e) { - log.error("Failed trying to get key: " + key, e); + LOG.error("Failed trying to get key: " + key, e); throw new RuntimeException(e); } if (item != null) { @@ -207,7 +209,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont try { item = index.get(key); } catch (IOException e) { - log.error("Failed trying to get key: " + key, e); + LOG.error("Failed trying to get key: " + key, e); throw new RuntimeException(e); } return item; @@ -293,7 +295,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont try { index.store(key, item); } catch (IOException e) { - log.error("Failed trying to insert key: " + key, e); + LOG.error("Failed trying to insert key: " + key, e); throw new RuntimeException(e); } indexList.add(item); @@ -321,7 +323,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont } return result; } catch (IOException e) { - log.error("Failed trying to remove key: " + key, e); + LOG.error("Failed trying to remove key: " + key, e); throw new RuntimeException(e); } } @@ -368,7 +370,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont try { index.clear(); } catch (IOException e) { - log.error("Failed trying clear index", e); + LOG.error("Failed trying clear index", e); throw new RuntimeException(e); } } @@ -392,7 +394,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont indexList.add(item); return item; } catch (IOException e) { - log.error("Failed trying to place key: " + key, e); + LOG.error("Failed trying to place key: " + key, e); throw new RuntimeException(e); } } @@ -411,7 +413,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont try { index.remove(key); } catch (IOException e) { - log.error("Failed trying to remove entry: " + entry, e); + LOG.error("Failed trying to remove entry: " + entry, e); throw new RuntimeException(e); } IndexItem prev = indexList.getPrevEntry(item); @@ -464,7 +466,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont StoreLocation data = item.getValueDataItem(); result = dataManager.readItem(valueMarshaller, data); } catch (IOException e) { - log.error("Failed to get value for " + item, e); + LOG.error("Failed to get value for " + item, e); throw new RuntimeStoreException(e); } } @@ -485,7 +487,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont StoreLocation data = item.getKeyDataItem(); result = dataManager.readItem(keyMarshaller, data); } catch (IOException e) { - log.error("Failed to get key for " + item, e); + LOG.error("Failed to get key for " + item, e); throw new RuntimeStoreException(e); } } @@ -520,7 +522,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont } storeIndex(index); } catch (IOException e) { - log.error("Failed to write " + key + " , " + value, e); + LOG.error("Failed to write " + key + " , " + value, e); throw new RuntimeStoreException(e); } return index; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java index 53df600d17..2d7824d9a7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java @@ -40,9 +40,10 @@ import org.apache.commons.logging.LogFactory; */ public final class DataManagerImpl implements DataManager { - private static final Log log = LogFactory.getLog(DataManagerImpl.class); public static final long MAX_FILE_LENGTH = 1024 * 1024 * 32; + private static final Log LOG = LogFactory.getLog(DataManagerImpl.class); private static final String NAME_PREFIX = "data-"; + private final File directory; private final String name; private SyncDataFileReader reader; @@ -119,7 +120,7 @@ public final class DataManagerImpl implements DataManager { Integer key = Integer.valueOf(item.getFile()); DataFile dataFile = (DataFile)fileMap.get(key); if (dataFile == null) { - log.error("Looking for key " + key + " but not found in fileMap: " + fileMap); + LOG.error("Looking for key " + key + " but not found in fileMap: " + fileMap); throw new IOException("Could not locate data file " + NAME_PREFIX + name + "-" + item.getFile()); } return dataFile; @@ -184,7 +185,7 @@ public final class DataManagerImpl implements DataManager { try { type = getReader().readDataItemSize(item); } catch (IOException ignore) { - log.trace("End of data file reached at (header was invalid): " + item); + LOG.trace("End of data file reached at (header was invalid): " + item); return; } if (type == REDO_ITEM_TYPE) { @@ -193,7 +194,7 @@ public final class DataManagerImpl implements DataManager { try { object = readItem(redoMarshaller, item); } catch (IOException e1) { - log.trace("End of data file reached at (payload was invalid): " + item); + LOG.trace("End of data file reached at (payload was invalid): " + item); return; } try { @@ -325,7 +326,7 @@ public final class DataManagerImpl implements DataManager { writer.force(dataFile); } boolean result = dataFile.delete(); - log.debug("discarding data file " + dataFile + (result ? "successful " : "failed")); + LOG.debug("discarding data file " + dataFile + (result ? "successful " : "failed")); } /* diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/Item.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/Item.java index d308c2ea10..c689d32c27 100755 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/Item.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/Item.java @@ -22,9 +22,9 @@ package org.apache.activemq.kaha.impl.data; * @version $Revision: 1.2 $ */ public interface Item { - static final long POSITION_NOT_SET = -1; - static final short MAGIC = 31317; - static final int ACTIVE = 22; - static final int FREE = 33; - static final int LOCATION_SIZE = 24; + long POSITION_NOT_SET = -1; + short MAGIC = 31317; + int ACTIVE = 22; + int FREE = 33; + int LOCATION_SIZE = 24; } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/SyncDataFileWriter.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/SyncDataFileWriter.java index c6136d8b77..94a56a75c9 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/SyncDataFileWriter.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/SyncDataFileWriter.java @@ -28,7 +28,7 @@ import org.apache.activemq.util.DataByteArrayOutputStream; * * @version $Revision: 1.1.1.1 $ */ -final public class SyncDataFileWriter { +public final class SyncDataFileWriter { private DataByteArrayOutputStream buffer; private DataManagerImpl dataManager; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java index ea74f07473..145b0f4d9a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java @@ -212,8 +212,9 @@ public class DiskIndexLinkedList implements IndexLinkedList { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); IndexItem e = root; - for (int i = 0; i <= index; i++) + for (int i = 0; i <= index; i++) { e = getNextEntry(e); + } if (e != null && last != null && last.equals(e)) { last = e; } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/Index.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/Index.java index 7f50c188a4..5ab736ef1d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/Index.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/Index.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index; import java.io.IOException; @@ -31,14 +33,14 @@ public interface Index { * @throws IOException * */ - public void clear() throws IOException; + void clear() throws IOException; /** * @param key * @return true if it contains the key * @throws IOException */ - public boolean containsKey(Object key) throws IOException; + boolean containsKey(Object key) throws IOException; /** * remove the index key @@ -47,7 +49,7 @@ public interface Index { * @return StoreEntry removed * @throws IOException */ - public StoreEntry remove(Object key) throws IOException; + StoreEntry remove(Object key) throws IOException; /** * store the key, item @@ -56,36 +58,36 @@ public interface Index { * @param entry * @throws IOException */ - public void store(Object key, StoreEntry entry) throws IOException; + void store(Object key, StoreEntry entry) throws IOException; /** * @param key * @return the entry * @throws IOException */ - public StoreEntry get(Object key) throws IOException; + StoreEntry get(Object key) throws IOException; /** * @return true if the index is transient */ - public boolean isTransient(); + boolean isTransient(); /** * load indexes */ - public void load(); + void load(); /** * unload indexes * * @throws IOException */ - public void unload() throws IOException; + void unload() throws IOException; /** * Set the marshaller for key objects * * @param marshaller */ - public void setKeyMarshaller(Marshaller marshaller); + void setKeyMarshaller(Marshaller marshaller); } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexLinkedList.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexLinkedList.java index 7e6b2eec2f..8c58316866 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexLinkedList.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexLinkedList.java @@ -28,42 +28,42 @@ public interface IndexLinkedList { /** * @return the root used by the List */ - public IndexItem getRoot(); + IndexItem getRoot(); /** * Returns the first element in this list. * * @return the first element in this list. */ - public IndexItem getFirst(); + IndexItem getFirst(); /** * Returns the last element in this list. * * @return the last element in this list. */ - public IndexItem getLast(); + IndexItem getLast(); /** * Removes and returns the first element from this list. * * @return the first element from this list. */ - public StoreEntry removeFirst(); + StoreEntry removeFirst(); /** * Removes and returns the last element from this list. * * @return the last element from this list. */ - public Object removeLast(); + Object removeLast(); /** * Inserts the given element at the beginning of this list. * * @param item */ - public void addFirst(IndexItem item); + void addFirst(IndexItem item); /** * Appends the given element to the end of this list. (Identical in function @@ -71,21 +71,21 @@ public interface IndexLinkedList { * * @param item */ - public void addLast(IndexItem item); + void addLast(IndexItem item); /** * Returns the number of elements in this list. * * @return the number of elements in this list. */ - public int size(); + int size(); /** * is the list empty? * * @return true if there are no elements in the list */ - public boolean isEmpty(); + boolean isEmpty(); /** * Appends the specified element to the end of this list. @@ -95,12 +95,12 @@ public interface IndexLinkedList { * @return true (as per the general contract of * Collection.add). */ - public boolean add(IndexItem item); + boolean add(IndexItem item); /** * Removes all of the elements from this list. */ - public void clear(); + void clear(); // Positional Access Operations /** @@ -112,7 +112,7 @@ public interface IndexLinkedList { * @throws IndexOutOfBoundsException if the specified index is is out of * range (index < 0 || index >= size()). */ - public IndexItem get(int index); + IndexItem get(int index); /** * Inserts the specified element at the specified position in this list. @@ -124,7 +124,7 @@ public interface IndexLinkedList { * * @throws IndexOutOfBoundsException if the specified index is out of range (index < 0 || index > size()). */ - public void add(int index, IndexItem element); + void add(int index, IndexItem element); /** * Removes the element at the specified position in this list. Shifts any @@ -136,7 +136,7 @@ public interface IndexLinkedList { * * @throws IndexOutOfBoundsException if the specified index is out of range (index < 0 || index >= size()). */ - public Object remove(int index); + Object remove(int index); // Search Operations /** @@ -150,7 +150,7 @@ public interface IndexLinkedList { * @return the index in this list of the first occurrence of the specified * element, or -1 if the list does not contain this element. */ - public int indexOf(StoreEntry o); + int indexOf(StoreEntry o); /** * Retrieve the next entry after this entry @@ -158,7 +158,7 @@ public interface IndexLinkedList { * @param entry * @return next entry */ - public IndexItem getNextEntry(IndexItem entry); + IndexItem getNextEntry(IndexItem entry); /** * Retrive the prev entry after this entry @@ -166,14 +166,14 @@ public interface IndexLinkedList { * @param entry * @return prev entry */ - public IndexItem getPrevEntry(IndexItem entry); + IndexItem getPrevEntry(IndexItem entry); /** * remove an entry * * @param e */ - public void remove(IndexItem e); + void remove(IndexItem e); /** * Ensure we have the up to date entry @@ -181,7 +181,7 @@ public interface IndexLinkedList { * @param entry * @return the entry */ - public StoreEntry getEntry(StoreEntry entry); + StoreEntry getEntry(StoreEntry entry); /** * Update the indexes of a StoreEntry @@ -189,5 +189,5 @@ public interface IndexLinkedList { * @param current * @return update StoreEntry */ - public StoreEntry refreshEntry(StoreEntry current); + StoreEntry refreshEntry(StoreEntry current); } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java index 98a0b1205a..176f34727c 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index; import java.io.File; @@ -30,7 +32,7 @@ import org.apache.commons.logging.LogFactory; public final class IndexManager { public static final String NAME_PREFIX = "index-"; - private static final Log log = LogFactory.getLog(IndexManager.class); + private static final Log LOG = LogFactory.getLog(IndexManager.class); private final String name; private File directory; private File file; @@ -86,7 +88,7 @@ public final class IndexManager { try { writer.updateIndexes(index); } catch (Throwable e) { - log.error(name + " error updating indexes ", e); + LOG.error(name + " error updating indexes ", e); } dirty = true; } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/VMIndex.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/VMIndex.java index fed0ffc6f8..b32cb283b2 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/VMIndex.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/VMIndex.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index; import java.io.IOException; @@ -29,7 +31,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.2 $ */ public class VMIndex implements Index { - private static final Log log = LogFactory.getLog(VMIndex.class); + private static final Log LOG = LogFactory.getLog(VMIndex.class); private IndexManager indexManager; private Map map = new HashMap(); @@ -65,7 +67,7 @@ public class VMIndex implements Index { try { result = indexManager.refreshIndex((IndexItem)result); } catch (IOException e) { - log.error("Failed to refresh entry", e); + LOG.error("Failed to refresh entry", e); throw new RuntimeException("Failed to refresh entry"); } } @@ -92,7 +94,7 @@ public class VMIndex implements Index { try { result = indexManager.refreshIndex((IndexItem)result); } catch (IOException e) { - log.error("Failed to refresh entry", e); + LOG.error("Failed to refresh entry", e); throw new RuntimeException("Failed to refresh entry"); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/VMIndexLinkedList.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/VMIndexLinkedList.java index df23e1dd2c..9190e5abd7 100755 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/VMIndexLinkedList.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/VMIndexLinkedList.java @@ -183,11 +183,13 @@ public final class VMIndexLinkedList implements Cloneable, IndexLinkedList { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); IndexItem e = root; if (index < size / 2) { - for (int i = 0; i <= index; i++) + for (int i = 0; i <= index; i++) { e = e.next; + } } else { - for (int i = size; i > index; i--) + for (int i = size; i > index; i--) { e = e.prev; + } } return e; } @@ -259,8 +261,9 @@ public final class VMIndexLinkedList implements Cloneable, IndexLinkedList { */ public Object clone() { IndexLinkedList clone = new VMIndexLinkedList(this.root); - for (IndexItem e = root.next; e != root; e = e.next) + for (IndexItem e = root.next; e != root; e = e.next) { clone.add(e); + } return clone; } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashBin.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashBin.java index 200d325737..efea443a34 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashBin.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashBin.java @@ -1,15 +1,18 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.kaha.impl.index.hash; @@ -26,7 +29,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1.1.1 $ */ class HashBin { - private static final transient Log log = LogFactory.getLog(HashBin.class); + private static final transient Log LOG = LogFactory.getLog(HashBin.class); private HashIndex hashIndex; private int id; private int maximumEntries; @@ -141,7 +144,7 @@ class HashBin { } if (!replace) { if (low > size()) { - log.info("SIZE() " + size() + " low = " + low); + LOG.info("SIZE() " + size() + " low = " + low); } addHashEntry(low, newEntry); size++; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashEntry.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashEntry.java index 2b90c6a50f..2da5d067ad 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashEntry.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashEntry.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index.hash; import java.io.DataInput; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java index 69798cfeda..4e048fc16e 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index.hash; import java.io.File; @@ -38,7 +40,7 @@ public class HashIndex implements Index { private static final String NAME_PREFIX = "hash-index-"; private static final int DEFAULT_PAGE_SIZE; private static final int DEFAULT_KEY_SIZE; - private static final Log log = LogFactory.getLog(HashIndex.class); + private static final Log LOG = LogFactory.getLog(HashIndex.class); private final String name; private File directory; private File file; @@ -203,7 +205,7 @@ public class HashIndex implements Index { } length = offset; } catch (IOException e) { - log.error("Failed to load index ", e); + LOG.error("Failed to load index ", e); throw new RuntimeException(e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPage.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPage.java index 1b59c66608..1a9107463f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPage.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPage.java @@ -1,15 +1,18 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.kaha.impl.index.hash; @@ -29,7 +32,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1.1.1 $ */ class HashPage { - private static final transient Log log = LogFactory.getLog(HashPage.class); + private static final transient Log LOG = LogFactory.getLog(HashPage.class); static final int PAGE_HEADER_SIZE = 17; private int maximumEntries; private long id; @@ -232,6 +235,6 @@ class HashPage { str.append(entry); str.append(","); } - log.info(str); + LOG.info(str); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPageInfo.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPageInfo.java index 2984b03c81..f5d474f635 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPageInfo.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPageInfo.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index.hash; import java.io.IOException; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreeEntry.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreeEntry.java index e092927439..c7fd4bcdcb 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreeEntry.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreeEntry.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index.tree; import java.io.DataInput; diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreeIndex.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreeIndex.java index 72b70c28eb..fcc249efc7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreeIndex.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreeIndex.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index.tree; import java.io.File; @@ -38,7 +40,7 @@ public class TreeIndex implements Index { private static final String NAME_PREFIX = "tree-index-"; private static final int DEFAULT_PAGE_SIZE; private static final int DEFAULT_KEY_SIZE; - private static final Log log = LogFactory.getLog(TreeIndex.class); + private static final Log LOG = LogFactory.getLog(TreeIndex.class); private final String name; private File directory; private File file; @@ -193,7 +195,7 @@ public class TreeIndex implements Index { root = createRoot(); } } catch (IOException e) { - log.error("Failed to load index ", e); + LOG.error("Failed to load index ", e); throw new RuntimeException(e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreePage.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreePage.java index 969bf4a09d..da20ed9b02 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreePage.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreePage.java @@ -1,15 +1,18 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.kaha.impl.index.tree; @@ -31,7 +34,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1.1.1 $ */ class TreePage { - private static final transient Log log = LogFactory.getLog(TreePage.class); + private static final transient Log LOG = LogFactory.getLog(TreePage.class); static final int PAGE_HEADER_SIZE = 18; static enum Flavour { @@ -737,11 +740,11 @@ class TreePage { } protected void dump() throws IOException { - log.info(this); + LOG.info(this); Set set = new HashSet(); for (TreeEntry entry : treeEntries) { if (entry != null) { - log.info(entry); + LOG.info(entry); set.add(entry.getPrevPageId()); set.add(entry.getNextPageId()); } diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreePageEntry.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreePageEntry.java index 4515c5f899..8601eb7130 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreePageEntry.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/tree/TreePageEntry.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index.tree; /** diff --git a/activemq-core/src/main/java/org/apache/activemq/management/JMSEndpointStatsImpl.java b/activemq-core/src/main/java/org/apache/activemq/management/JMSEndpointStatsImpl.java index 5b63f2c4f7..3dd56e99fc 100755 --- a/activemq-core/src/main/java/org/apache/activemq/management/JMSEndpointStatsImpl.java +++ b/activemq-core/src/main/java/org/apache/activemq/management/JMSEndpointStatsImpl.java @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.3 $ */ public class JMSEndpointStatsImpl extends StatsImpl { - private static final Log log = LogFactory.getLog(JMSEndpointStatsImpl.class); + private static final Log LOG = LogFactory.getLog(JMSEndpointStatsImpl.class); protected CountStatisticImpl messageCount; protected CountStatisticImpl pendingMessageCount; @@ -158,7 +158,7 @@ public class JMSEndpointStatsImpl extends StatsImpl { CountStatisticImpl c = (CountStatisticImpl)child; c.setParent((CountStatisticImpl)parent); } else { - log.warn("Cannot associate endpoint counters with session level counters as they are not both CountStatisticImpl clases. Endpoint: " + child + " session: " + parent); + LOG.warn("Cannot associate endpoint counters with session level counters as they are not both CountStatisticImpl clases. Endpoint: " + child + " session: " + parent); } } @@ -167,7 +167,7 @@ public class JMSEndpointStatsImpl extends StatsImpl { TimeStatisticImpl c = (TimeStatisticImpl)child; c.setParent((TimeStatisticImpl)parent); } else { - log.warn("Cannot associate endpoint counters with session level counters as they are not both TimeStatisticImpl clases. Endpoint: " + child + " session: " + parent); + LOG.warn("Cannot associate endpoint counters with session level counters as they are not both TimeStatisticImpl clases. Endpoint: " + child + " session: " + parent); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/management/PollCountStatisticImpl.java b/activemq-core/src/main/java/org/apache/activemq/management/PollCountStatisticImpl.java index 9941dfa0ef..89a763783e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/management/PollCountStatisticImpl.java +++ b/activemq-core/src/main/java/org/apache/activemq/management/PollCountStatisticImpl.java @@ -58,18 +58,18 @@ public class PollCountStatisticImpl extends StatisticImpl implements CountStatis } } - synchronized private void removeChild(PollCountStatisticImpl child) { + private synchronized void removeChild(PollCountStatisticImpl child) { if (children != null) children.remove(child); } - synchronized private void addChild(PollCountStatisticImpl child) { + private synchronized void addChild(PollCountStatisticImpl child) { if (children == null) children = new ArrayList(); children.add(child); } - synchronized public long getCount() { + public synchronized long getCount() { if (children == null) return 0; long count = 0; diff --git a/activemq-core/src/main/java/org/apache/activemq/management/Resettable.java b/activemq-core/src/main/java/org/apache/activemq/management/Resettable.java index 2c2533a0a3..b88829ea4c 100755 --- a/activemq-core/src/main/java/org/apache/activemq/management/Resettable.java +++ b/activemq-core/src/main/java/org/apache/activemq/management/Resettable.java @@ -26,5 +26,5 @@ public interface Resettable { /** * Reset the statistic */ - public void reset(); + void reset(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/management/StatsCapable.java b/activemq-core/src/main/java/org/apache/activemq/management/StatsCapable.java index 549baae1b0..10eb969f9b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/management/StatsCapable.java +++ b/activemq-core/src/main/java/org/apache/activemq/management/StatsCapable.java @@ -27,5 +27,5 @@ public interface StatsCapable { /** * @return the Stats for this object */ - public StatsImpl getStats(); + StatsImpl getStats(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/memory/Cache.java b/activemq-core/src/main/java/org/apache/activemq/memory/Cache.java index aec93f999a..f8f234865b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/memory/Cache.java +++ b/activemq-core/src/main/java/org/apache/activemq/memory/Cache.java @@ -30,7 +30,7 @@ public interface Cache { * @return null if the object was not previously put or if the object has * expired out of the cache. */ - public Object get(Object key); + Object get(Object key); /** * Puts an object into the cache. @@ -38,7 +38,7 @@ public interface Cache { * @param messageID * @param message */ - public Object put(Object key, Object value); + Object put(Object key, Object value); /** * Removes an object from the cache. @@ -46,19 +46,19 @@ public interface Cache { * @param messageID * @return the object associated with the key if it was still in the cache. */ - public Object remove(Object key); + Object remove(Object key); /** * Lets a cache know it will not be used any further and that it can release * acquired resources */ - public void close(); + void close(); /** * How big is the cache right now? * * @return */ - public int size(); + int size(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/memory/CacheEvictionUsageListener.java b/activemq-core/src/main/java/org/apache/activemq/memory/CacheEvictionUsageListener.java index 15dc8f9146..3c1cd9a5c5 100755 --- a/activemq-core/src/main/java/org/apache/activemq/memory/CacheEvictionUsageListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/memory/CacheEvictionUsageListener.java @@ -28,7 +28,7 @@ import org.apache.commons.logging.LogFactory; public class CacheEvictionUsageListener implements UsageListener { - private final static Log log = LogFactory.getLog(CacheEvictionUsageListener.class); + private static final Log LOG = LogFactory.getLog(CacheEvictionUsageListener.class); private final CopyOnWriteArrayList evictors = new CopyOnWriteArrayList(); private final int usageHighMark; @@ -52,7 +52,7 @@ public class CacheEvictionUsageListener implements UsageListener { boolean evictMessages() { // Try to take the memory usage down below the low mark. try { - log.debug("Evicting cache memory usage: " + usageManager.getPercentUsage()); + LOG.debug("Evicting cache memory usage: " + usageManager.getPercentUsage()); LinkedList list = new LinkedList(evictors); while (list.size() > 0 && usageManager.getPercentUsage() > usageLowMark) { diff --git a/activemq-core/src/main/java/org/apache/activemq/memory/CacheFilter.java b/activemq-core/src/main/java/org/apache/activemq/memory/CacheFilter.java index f276a78bd8..80239e5895 100755 --- a/activemq-core/src/main/java/org/apache/activemq/memory/CacheFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/memory/CacheFilter.java @@ -1,4 +1,3 @@ - /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/activemq-core/src/main/java/org/apache/activemq/memory/UsageListener.java b/activemq-core/src/main/java/org/apache/activemq/memory/UsageListener.java index bf799c1eab..9e817e6528 100755 --- a/activemq-core/src/main/java/org/apache/activemq/memory/UsageListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/memory/UsageListener.java @@ -17,5 +17,5 @@ package org.apache.activemq.memory; public interface UsageListener { - public void onMemoryUseChanged( UsageManager memoryManager, int oldPercentUsage, int newPercentUsage ); + void onMemoryUseChanged( UsageManager memoryManager, int oldPercentUsage, int newPercentUsage ); } diff --git a/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java b/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java index fdba260873..7d08e1b328 100755 --- a/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java +++ b/activemq-core/src/main/java/org/apache/activemq/memory/UsageManager.java @@ -38,7 +38,7 @@ import org.apache.commons.logging.LogFactory; */ public class UsageManager implements Service { - private static final Log log = LogFactory.getLog(UsageManager.class); + private static final Log LOG = LogFactory.getLog(UsageManager.class); private final UsageManager parent; private long limit; @@ -58,7 +58,7 @@ public class UsageManager implements Service { * manager */ private boolean sendFailIfNoSpaceExplicitySet; - private final boolean debug = log.isDebugEnabled(); + private final boolean debug = LOG.isDebugEnabled(); private String name = ""; private float usagePortion = 1.0f; private List children = new CopyOnWriteArrayList(); @@ -331,7 +331,7 @@ public class UsageManager implements Service { private void fireEvent(int oldPercentUsage, int newPercentUsage) { if (debug) { - log.debug("Memory usage change. from: " + oldPercentUsage + ", to: " + newPercentUsage); + LOG.debug("Memory usage change. from: " + oldPercentUsage + ", to: " + newPercentUsage); } // Switching from being full to not being full.. if (oldPercentUsage >= 100 && newPercentUsage < 100) { diff --git a/activemq-core/src/main/java/org/apache/activemq/memory/buffer/MessageBuffer.java b/activemq-core/src/main/java/org/apache/activemq/memory/buffer/MessageBuffer.java index 0569e9a712..3361a639fe 100644 --- a/activemq-core/src/main/java/org/apache/activemq/memory/buffer/MessageBuffer.java +++ b/activemq-core/src/main/java/org/apache/activemq/memory/buffer/MessageBuffer.java @@ -25,12 +25,12 @@ package org.apache.activemq.memory.buffer; */ public interface MessageBuffer { - public int getSize(); + int getSize(); /** * Creates a new message queue instance */ - public MessageQueue createMessageQueue(); + MessageQueue createMessageQueue(); /** * After a message queue has changed we may need to perform some evictions @@ -38,8 +38,8 @@ public interface MessageBuffer { * @param delta * @param queueSize */ - public void onSizeChanged(MessageQueue queue, int delta, int queueSize); + void onSizeChanged(MessageQueue queue, int delta, int queueSize); - public void clear(); + void clear(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/memory/list/SimpleMessageList.java b/activemq-core/src/main/java/org/apache/activemq/memory/list/SimpleMessageList.java index 3df9db1fff..2ba65e6921 100644 --- a/activemq-core/src/main/java/org/apache/activemq/memory/list/SimpleMessageList.java +++ b/activemq-core/src/main/java/org/apache/activemq/memory/list/SimpleMessageList.java @@ -37,7 +37,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public class SimpleMessageList implements MessageList { - static final private Log log = LogFactory.getLog(SimpleMessageList.class); + private static final Log LOG = LogFactory.getLog(SimpleMessageList.class); private LinkedList list = new LinkedList(); private int maximumSize = 100 * 64 * 1024; private int size; @@ -79,7 +79,7 @@ public class SimpleMessageList implements MessageList { result.add(msg); } } catch (IOException e) { - log.error("Failed to get Message from MessageReference: " + ref, e); + LOG.error("Failed to get Message from MessageReference: " + ref, e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/CompositeDemandForwardingBridge.java b/activemq-core/src/main/java/org/apache/activemq/network/CompositeDemandForwardingBridge.java index 55dfd46bc2..d24da56508 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/CompositeDemandForwardingBridge.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/CompositeDemandForwardingBridge.java @@ -26,6 +26,8 @@ import org.apache.activemq.command.Endpoint; import org.apache.activemq.command.NetworkBridgeFilter; import org.apache.activemq.transport.Transport; import org.apache.activemq.util.ServiceSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * A demand forwarding bridge which works with multicast style transports where @@ -36,6 +38,7 @@ import org.apache.activemq.util.ServiceSupport; * @version $Revision$ */ public class CompositeDemandForwardingBridge extends DemandForwardingBridgeSupport { + private static final Log LOG = LogFactory.getLog(CompositeDemandForwardingBridge.class); protected final BrokerId remoteBrokerPath[] = new BrokerId[] {null}; protected Object brokerInfoMutex = new Object(); @@ -56,13 +59,13 @@ public class CompositeDemandForwardingBridge extends DemandForwardingBridgeSuppo // refer to it later Endpoint from = command.getFrom(); if (from == null) { - log.warn("Incoming command does not have a from endpoint: " + command); + LOG.warn("Incoming command does not have a from endpoint: " + command); } else { from.setBrokerInfo(remoteBrokerInfo); } if (localBrokerId != null) { if (localBrokerId.equals(remoteBrokerId)) { - log.info("Disconnecting loop back connection."); + LOG.info("Disconnecting loop back connection."); // waitStarted(); ServiceSupport.dispose(this); } @@ -84,7 +87,7 @@ public class CompositeDemandForwardingBridge extends DemandForwardingBridgeSuppo BrokerId answer = null; Endpoint from = command.getFrom(); if (from == null) { - log.warn("Incoming command does not have a from endpoint: " + command); + LOG.warn("Incoming command does not have a from endpoint: " + command); } else { answer = from.getBrokerId(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/ConduitBridge.java b/activemq-core/src/main/java/org/apache/activemq/network/ConduitBridge.java index ff82ed9090..1c4ef6f89f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/ConduitBridge.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/ConduitBridge.java @@ -34,7 +34,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public class ConduitBridge extends DemandForwardingBridge { - static final private Log log = LogFactory.getLog(ConduitBridge.class); + private static final Log LOG = LogFactory.getLog(ConduitBridge.class); /** * Constructor @@ -91,8 +91,8 @@ public class ConduitBridge extends DemandForwardingBridge { DemandSubscription ds = (DemandSubscription)i.next(); subscriptionMapByLocalId.remove(ds.getRemoteInfo().getConsumerId()); removeSubscription(ds); - if (log.isTraceEnabled()) - log.trace("removing sub on " + localBroker + " from " + remoteBrokerName + " : " + if (LOG.isTraceEnabled()) + LOG.trace("removing sub on " + localBroker + " from " + remoteBrokerName + " : " + ds.getRemoteInfo()); } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java index 48790b4aff..a17bfc7767 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java @@ -25,6 +25,8 @@ import org.apache.activemq.command.ConsumerInfo; import org.apache.activemq.command.NetworkBridgeFilter; import org.apache.activemq.transport.Transport; import org.apache.activemq.util.ServiceSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * Forwards messages from the local broker to the remote broker based on demand. @@ -34,6 +36,7 @@ import org.apache.activemq.util.ServiceSupport; * @version $Revision$ */ public class DemandForwardingBridge extends DemandForwardingBridgeSupport { + private static final Log LOG = LogFactory.getLog(DemandForwardingBridge.class); protected final BrokerId remoteBrokerPath[] = new BrokerId[] {null}; protected Object brokerInfoMutex = new Object(); @@ -52,7 +55,7 @@ public class DemandForwardingBridge extends DemandForwardingBridgeSupport { remoteBrokerName = remoteBrokerInfo.getBrokerName(); if (localBrokerId != null) { if (localBrokerId.equals(remoteBrokerId)) { - log.info("Disconnecting loop back connection."); + LOG.info("Disconnecting loop back connection."); // waitStarted(); ServiceSupport.dispose(this); } @@ -71,7 +74,7 @@ public class DemandForwardingBridge extends DemandForwardingBridgeSupport { localBrokerPath[0] = localBrokerId; if (remoteBrokerId != null) { if (remoteBrokerId.equals(localBrokerId)) { - log.info("Disconnecting loop back connection."); + LOG.info("Disconnecting loop back connection."); waitStarted(); ServiceSupport.dispose(this); } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java index 556c67864e..47fbbee00b 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java @@ -73,7 +73,9 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { - protected static final Log log = LogFactory.getLog(DemandForwardingBridge.class); + + private static final Log LOG = LogFactory.getLog(DemandForwardingBridge.class); + protected final Transport localBroker; protected final Transport remoteBroker; protected final IdGenerator idGenerator = new IdGenerator(); @@ -153,16 +155,16 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { // clear any subscriptions - to try and prevent the bridge // from stalling the broker if (remoteInterupted.compareAndSet(false, true)) { - log.info("Outbound transport to " + remoteBrokerName + " interrupted."); + LOG.info("Outbound transport to " + remoteBrokerName + " interrupted."); if (localBridgeStarted.get()) { clearDownSubscriptions(); synchronized (DemandForwardingBridgeSupport.this) { try { localBroker.oneway(localConnectionInfo.createRemoveCommand()); } catch (TransportDisposedIOException td) { - log.debug("local broker is now disposed", td); + LOG.debug("local broker is now disposed", td); } catch (IOException e) { - log.warn("Caught exception from local start", e); + LOG.warn("Caught exception from local start", e); } } } @@ -179,7 +181,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { // False connects can occurr if you using SSH tunnels. if (!lastConnectSucceeded.get()) { try { - log.debug("Previous connection was never fully established. Sleeping for second to avoid busy loop."); + LOG.debug("Previous connection was never fully established. Sleeping for second to avoid busy loop."); Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); @@ -190,9 +192,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { startLocalBridge(); remoteBridgeStarted.set(true); startedLatch.countDown(); - log.info("Outbound transport to " + remoteBrokerName + " resumed"); + LOG.info("Outbound transport to " + remoteBrokerName + " resumed"); } catch (Exception e) { - log.error("Caught exception from local start in resume transport", e); + LOG.error("Caught exception from local start in resume transport", e); } } } @@ -203,7 +205,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { try { triggerRemoteStartBridge(); } catch (IOException e) { - log.warn("Caught exception from remote start", e); + LOG.warn("Caught exception from remote start", e); } NetworkBridgeListener l = this.networkBridgeListener; if (l != null) { @@ -255,7 +257,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { localSessionInfo = new SessionInfo(localConnectionInfo, 1); localBroker.oneway(localSessionInfo); - log.info("Network connection between " + localBroker + " and " + remoteBroker + "(" + remoteBrokerName + ") has been established."); + LOG.info("Network connection between " + localBroker + " and " + remoteBroker + "(" + remoteBrokerName + ") has been established."); startedLatch.countDown(); setupStaticDestinations(); @@ -314,7 +316,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { public void stop() throws Exception { if (started.compareAndSet(true, false)) { - log.debug(" stopping " + configuration.getBrokerName() + " bridge to " + remoteBrokerName + " is disposed already ? " + disposed); + LOG.debug(" stopping " + configuration.getBrokerName() + " bridge to " + remoteBrokerName + " is disposed already ? " + disposed); boolean wasDisposedAlready = disposed; if (!disposed) { NetworkBridgeListener l = this.networkBridgeListener; @@ -327,7 +329,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { localBroker.oneway(new ShutdownInfo()); remoteBroker.oneway(new ShutdownInfo()); } catch (IOException e) { - log.debug("Caught exception stopping", e); + LOG.debug("Caught exception stopping", e); } finally { ServiceStopper ss = new ServiceStopper(); ss.stop(localBroker); @@ -340,9 +342,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { } } if (wasDisposedAlready) { - log.debug(configuration.getBrokerName() + " bridge to " + remoteBrokerName + " stopped"); + LOG.debug(configuration.getBrokerName() + " bridge to " + remoteBrokerName + " stopped"); } else { - log.info(configuration.getBrokerName() + " bridge to " + remoteBrokerName + " stopped"); + LOG.info(configuration.getBrokerName() + " bridge to " + remoteBrokerName + " stopped"); } } } @@ -350,11 +352,11 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { public void serviceRemoteException(Throwable error) { if (!disposed) { if (error instanceof SecurityException || error instanceof GeneralSecurityException) { - log.error("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a remote error: " + error); + LOG.error("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a remote error: " + error); } else { - log.warn("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a remote error: " + error); + LOG.warn("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a remote error: " + error); } - log.debug("The remote Exception was: " + error, error); + LOG.debug("The remote Exception was: " + error, error); new Thread() { public void run() { @@ -404,13 +406,13 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { break; case ConsumerInfo.DATA_STRUCTURE_TYPE: if (!addConsumerInfo((ConsumerInfo)command)) { - if (log.isDebugEnabled()) - log.debug("Ignoring ConsumerInfo: " + command); + if (LOG.isDebugEnabled()) + LOG.debug("Ignoring ConsumerInfo: " + command); } break; default: - if (log.isDebugEnabled()) - log.debug("Ignoring remote command: " + command); + if (LOG.isDebugEnabled()) + LOG.debug("Ignoring remote command: " + command); } } } else { @@ -420,7 +422,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { case ShutdownInfo.DATA_STRUCTURE_TYPE: break; default: - log.warn("Unexpected remote command: " + command); + LOG.warn("Unexpected remote command: " + command); } } } @@ -437,29 +439,29 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { ConsumerInfo info = (ConsumerInfo)data; BrokerId[] path = info.getBrokerPath(); if (path != null && path.length >= networkTTL) { - if (log.isDebugEnabled()) - log.debug(configuration.getBrokerName() + " Ignoring Subscription " + info + " restricted to " + networkTTL + " network hops only"); + if (LOG.isDebugEnabled()) + LOG.debug(configuration.getBrokerName() + " Ignoring Subscription " + info + " restricted to " + networkTTL + " network hops only"); return; } if (contains(info.getBrokerPath(), localBrokerPath[0])) { // Ignore this consumer as it's a consumer we locally sent to // the broker. - if (log.isDebugEnabled()) - log.debug(configuration.getBrokerName() + " Ignoring sub " + info + " already routed through this broker once"); + if (LOG.isDebugEnabled()) + LOG.debug(configuration.getBrokerName() + " Ignoring sub " + info + " already routed through this broker once"); return; } if (!isPermissableDestination(info.getDestination())) { // ignore if not in the permited or in the excluded list - if (log.isDebugEnabled()) - log.debug(configuration.getBrokerName() + " Ignoring sub " + info + " destination " + info.getDestination() + " is not permiited"); + if (LOG.isDebugEnabled()) + LOG.debug(configuration.getBrokerName() + " Ignoring sub " + info + " destination " + info.getDestination() + " is not permiited"); return; } if (addConsumerInfo(info)) { - if (log.isDebugEnabled()) - log.debug(configuration.getBrokerName() + " Forwarding sub on " + localBroker + " from " + remoteBrokerName + " : " + info); + if (LOG.isDebugEnabled()) + LOG.debug(configuration.getBrokerName() + " Forwarding sub on " + localBroker + " from " + remoteBrokerName + " : " + info); } else { - if (log.isDebugEnabled()) - log.debug(configuration.getBrokerName() + " Ignoring sub " + info + " already subscribed to matching destination"); + if (LOG.isDebugEnabled()) + LOG.debug(configuration.getBrokerName() + " Ignoring sub " + info + " already subscribed to matching destination"); } } else if (data.getClass() == DestinationInfo.class) { // It's a destination info - we want to pass up @@ -467,16 +469,16 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { DestinationInfo destInfo = (DestinationInfo)data; BrokerId[] path = destInfo.getBrokerPath(); if (path != null && path.length >= networkTTL) { - if (log.isDebugEnabled()) { - log.debug("Ignoring Subscription " + destInfo + " restricted to " + networkTTL + " network hops only"); + if (LOG.isDebugEnabled()) { + LOG.debug("Ignoring Subscription " + destInfo + " restricted to " + networkTTL + " network hops only"); } return; } if (contains(destInfo.getBrokerPath(), localBrokerPath[0])) { // Ignore this consumer as it's a consumer we locally sent to // the broker. - if (log.isDebugEnabled()) { - log.debug("Ignoring sub " + destInfo + " already routed through this broker once"); + if (LOG.isDebugEnabled()) { + LOG.debug("Ignoring sub " + destInfo + " already routed through this broker once"); } return; } @@ -487,7 +489,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { tempDest.setConnectionId(localSessionInfo.getSessionId().getConnectionId()); } destInfo.setBrokerPath(appendToBrokerPath(destInfo.getBrokerPath(), getRemoteBrokerPath())); - log.debug("Replying destination control command: " + destInfo); + LOG.debug("Replying destination control command: " + destInfo); localBroker.oneway(destInfo); } else if (data.getClass() == RemoveInfo.class) { ConsumerId id = (ConsumerId)((RemoveInfo)data).getObjectId(); @@ -497,8 +499,8 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { public void serviceLocalException(Throwable error) { if (!disposed) { - log.info("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a local error: " + error); - log.debug("The local Exception was:" + error, error); + LOG.info("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a local error: " + error); + LOG.debug("The local Exception was:" + error, error); new Thread() { public void run() { @@ -540,7 +542,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { protected void serviceLocalCommand(Command command) { if (!disposed) { - final boolean trace = log.isTraceEnabled(); + final boolean trace = LOG.isTraceEnabled(); try { if (command.isMessageDispatch()) { enqueueCounter.incrementAndGet(); @@ -550,7 +552,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { if (sub != null) { Message message = configureMessage(md); if (trace) - log.trace("bridging " + configuration.getBrokerName() + " -> " + remoteBrokerName + ": " + message); + LOG.trace("bridging " + configuration.getBrokerName() + " -> " + remoteBrokerName + ": " + message); if (!message.isResponseRequired()) { @@ -590,13 +592,13 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { } else { if (trace) - log.trace("No subscription registered with this network bridge for consumerId " + md.getConsumerId() + " for message: " + md.getMessage()); + LOG.trace("No subscription registered with this network bridge for consumerId " + md.getConsumerId() + " for message: " + md.getMessage()); } } else if (command.isBrokerInfo()) { localBrokerInfo = ((BrokerInfo)command); serviceLocalBrokerInfo(command); } else if (command.isShutdownInfo()) { - log.info(configuration.getBrokerName() + " Shutting down"); + LOG.info(configuration.getBrokerName() + " Shutting down"); // Don't shut down the whole connector if the remote side // was interrupted. // the local transport is just shutting down temporarily @@ -613,7 +615,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { case WireFormatInfo.DATA_STRUCTURE_TYPE: break; default: - log.warn("Unexpected local command: " + command); + LOG.warn("Unexpected local command: " + command); } } } catch (Exception e) { @@ -777,10 +779,10 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { try { addSubscription(sub); } catch (IOException e) { - log.error("Failed to add static destination " + dest, e); + LOG.error("Failed to add static destination " + dest, e); } - if (log.isTraceEnabled()) - log.trace("Forwarding messages for static destination: " + dest); + if (LOG.isTraceEnabled()) + LOG.trace("Forwarding messages for static destination: " + dest); } } } @@ -851,8 +853,8 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { DemandSubscription sub = (DemandSubscription)subscriptionMapByRemoteId.remove(id); if (sub != null) { removeSubscription(sub); - if (log.isTraceEnabled()) - log.trace("removing sub on " + localBroker + " from " + remoteBrokerName + " : " + sub.getRemoteInfo()); + if (LOG.isTraceEnabled()) + LOG.trace("removing sub on " + localBroker + " from " + remoteBrokerName + " : " + sub.getRemoteInfo()); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java b/activemq-core/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java index b6bf33ce10..7fbd2d23c3 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java @@ -30,6 +30,8 @@ import org.apache.activemq.transport.discovery.DiscoveryAgentFactory; import org.apache.activemq.transport.discovery.DiscoveryListener; import org.apache.activemq.util.ServiceStopper; import org.apache.activemq.util.ServiceSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * A network connector which uses a discovery agent to detect the remote brokers @@ -40,6 +42,7 @@ import org.apache.activemq.util.ServiceSupport; * @version $Revision$ */ public class DiscoveryNetworkConnector extends NetworkConnector implements DiscoveryListener { + private static final Log LOG = LogFactory.getLog(DiscoveryNetworkConnector.class); private DiscoveryAgent discoveryAgent; private ConcurrentHashMap bridges = new ConcurrentHashMap(); @@ -66,7 +69,7 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco try { uri = new URI(url); } catch (URISyntaxException e) { - log.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e); + LOG.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e); return; } // Should we try to connect to that URI? @@ -74,13 +77,13 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco || (connectionFilter != null && !connectionFilter.connectTo(uri))) return; URI connectUri = uri; - log.info("Establishing network connection between from " + localURIName + " to " + connectUri); + LOG.info("Establishing network connection between from " + localURIName + " to " + connectUri); Transport remoteTransport; try { remoteTransport = TransportFactory.connect(connectUri); } catch (Exception e) { - log.warn("Could not connect to remote URI: " + localURIName + ": " + e.getMessage()); - log.debug("Connection failure exception: " + e, e); + LOG.warn("Could not connect to remote URI: " + localURIName + ": " + e.getMessage()); + LOG.debug("Connection failure exception: " + e, e); return; } Transport localTransport; @@ -88,8 +91,8 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco localTransport = createLocalTransport(); } catch (Exception e) { ServiceSupport.dispose(remoteTransport); - log.warn("Could not connect to local URI: " + localURIName + ": " + e.getMessage()); - log.debug("Connection failure exception: " + e, e); + LOG.warn("Could not connect to local URI: " + localURIName + ": " + e.getMessage()); + LOG.debug("Connection failure exception: " + e, e); return; } NetworkBridge bridge = createBridge(localTransport, remoteTransport, event); @@ -99,9 +102,9 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco } catch (Exception e) { ServiceSupport.dispose(localTransport); ServiceSupport.dispose(remoteTransport); - log.warn("Could not start network bridge between: " + localURIName + " and: " + uri + LOG.warn("Could not start network bridge between: " + localURIName + " and: " + uri + " due to: " + e); - log.debug("Start failure exception: " + e, e); + LOG.debug("Start failure exception: " + e, e); try { discoveryAgent.serviceFailed(event); } catch (IOException e1) { @@ -118,7 +121,7 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco try { uri = new URI(url); } catch (URISyntaxException e) { - log.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e); + LOG.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e); return; } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DurableConduitBridge.java b/activemq-core/src/main/java/org/apache/activemq/network/DurableConduitBridge.java index e6e99c77a6..69bb9d6948 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/DurableConduitBridge.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DurableConduitBridge.java @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public class DurableConduitBridge extends ConduitBridge { - static final private Log log = LogFactory.getLog(DurableConduitBridge.class); + private static final Log LOG = LogFactory.getLog(DurableConduitBridge.class); /** * Constructor @@ -66,10 +66,10 @@ public class DurableConduitBridge extends ConduitBridge { try { addSubscription(sub); } catch (IOException e) { - log.error("Failed to add static destination " + dest, e); + LOG.error("Failed to add static destination " + dest, e); } - if (log.isTraceEnabled()) - log.trace("Forwarding messages for durable destination: " + dest); + if (LOG.isTraceEnabled()) + LOG.trace("Forwarding messages for durable destination: " + dest); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/ForwardingBridge.java b/activemq-core/src/main/java/org/apache/activemq/network/ForwardingBridge.java index ee57739821..88a2a7c80b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/ForwardingBridge.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/ForwardingBridge.java @@ -55,7 +55,7 @@ import org.apache.commons.logging.LogFactory; */ public class ForwardingBridge implements Service { - static final private Log log = LogFactory.getLog(ForwardingBridge.class); + private static final Log LOG = LogFactory.getLog(ForwardingBridge.class); private final Transport localBroker; private final Transport remoteBroker; @@ -88,7 +88,7 @@ public class ForwardingBridge implements Service { } public void start() throws Exception { - log.info("Starting a network connection between " + localBroker + " and " + remoteBroker + LOG.info("Starting a network connection between " + localBroker + " and " + remoteBroker + " has been established."); localBroker.setTransportListener(new DefaultTransportListener() { @@ -123,7 +123,7 @@ public class ForwardingBridge implements Service { try { startBridge(); } catch (IOException e) { - log.error("Failed to start network bridge: " + e, e); + LOG.error("Failed to start network bridge: " + e, e); } } }; @@ -165,7 +165,7 @@ public class ForwardingBridge implements Service { topicConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY); localBroker.oneway(topicConsumerInfo); } - log.info("Network connection between " + localBroker + " and " + remoteBroker + LOG.info("Network connection between " + localBroker + " and " + remoteBroker + " has been established."); } @@ -188,8 +188,8 @@ public class ForwardingBridge implements Service { } public void serviceRemoteException(Throwable error) { - log.info("Unexpected remote exception: " + error); - log.debug("Exception trace: ", error); + LOG.info("Unexpected remote exception: " + error); + LOG.debug("Exception trace: ", error); } protected void serviceRemoteCommand(Command command) { @@ -200,7 +200,7 @@ public class ForwardingBridge implements Service { remoteBrokerId = remoteBrokerInfo.getBrokerId(); if (localBrokerId != null) { if (localBrokerId.equals(remoteBrokerId)) { - log.info("Disconnecting loop back connection."); + LOG.info("Disconnecting loop back connection."); ServiceSupport.dispose(this); } else { triggerStartBridge(); @@ -208,7 +208,7 @@ public class ForwardingBridge implements Service { } } } else { - log.warn("Unexpected remote command: " + command); + LOG.warn("Unexpected remote command: " + command); } } catch (IOException e) { serviceLocalException(e); @@ -216,8 +216,8 @@ public class ForwardingBridge implements Service { } public void serviceLocalException(Throwable error) { - log.info("Unexpected local exception: " + error); - log.debug("Exception trace: ", error); + LOG.info("Unexpected local exception: " + error); + LOG.debug("Exception trace: ", error); fireBridgeFailed(); } @@ -303,7 +303,7 @@ public class ForwardingBridge implements Service { localBrokerId = localBrokerInfo.getBrokerId(); if (remoteBrokerId != null) { if (remoteBrokerId.equals(localBrokerId)) { - log.info("Disconnecting loop back connection."); + LOG.info("Disconnecting loop back connection."); ServiceSupport.dispose(this); } else { triggerStartBridge(); @@ -311,7 +311,7 @@ public class ForwardingBridge implements Service { } } } else { - log.debug("Unexpected local command: " + command); + LOG.debug("Unexpected local command: " + command); } } catch (IOException e) { serviceLocalException(e); diff --git a/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridge.java b/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridge.java index 18c07fb780..1f30d908e5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridge.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridge.java @@ -30,30 +30,30 @@ public interface NetworkBridge extends Service { * Service an exception * @param error */ - public void serviceRemoteException(Throwable error); + void serviceRemoteException(Throwable error); /** * servicee an exception * @param error */ - public void serviceLocalException(Throwable error); + void serviceLocalException(Throwable error); /** * Set the NetworkBridgeFailedListener * @param listener */ - public void setNetworkBridgeListener(NetworkBridgeListener listener); + void setNetworkBridgeListener(NetworkBridgeListener listener); - public String getRemoteAddress(); + String getRemoteAddress(); - public String getRemoteBrokerName(); + String getRemoteBrokerName(); - public String getLocalAddress(); + String getLocalAddress(); - public String getLocalBrokerName(); + String getLocalBrokerName(); - public long getEnqueueCounter(); + long getEnqueueCounter(); - public long getDequeueCounter(); + long getDequeueCounter(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java b/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java index 75c2b49678..f8eeab46cc 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.network; /** diff --git a/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeFactory.java b/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeFactory.java index 2dca2e1934..8b0f5179ea 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeFactory.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.network; import org.apache.activemq.transport.Transport; diff --git a/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeListener.java b/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeListener.java index 9a42d843e7..1aa6ac089a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeListener.java @@ -26,16 +26,16 @@ public interface NetworkBridgeListener { /** * called when the transport fails */ - public void bridgeFailed(); + void bridgeFailed(); /** * called after the bridge is started. */ - public void onStart(NetworkBridge bridge); + void onStart(NetworkBridge bridge); /** * called before the bridge is stopped. */ - public void onStop(NetworkBridge bridge); + void onStop(NetworkBridge bridge); } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/NetworkConnector.java b/activemq-core/src/main/java/org/apache/activemq/network/NetworkConnector.java index f68902341c..3d8b1654fa 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/NetworkConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/NetworkConnector.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.network; import java.net.URI; @@ -43,7 +45,7 @@ import org.apache.commons.logging.LogFactory; */ public abstract class NetworkConnector extends NetworkBridgeConfiguration implements Service { - protected static final Log log = LogFactory.getLog(NetworkConnector.class); + private static final Log LOG = LogFactory.getLog(NetworkConnector.class); protected URI localURI; private Set durableDestinations; private List excludedDestinations = new CopyOnWriteArrayList(); @@ -196,11 +198,11 @@ public abstract class NetworkConnector extends NetworkBridgeConfiguration implem if (localURI == null) { throw new IllegalStateException("You must configure the 'localURI' property"); } - log.info("Network Connector " + getName() + " Started"); + LOG.info("Network Connector " + getName() + " Started"); } protected void handleStop(ServiceStopper stopper) throws Exception { - log.info("Network Connector " + getName() + " Stopped"); + LOG.info("Network Connector " + getName() + " Stopped"); } public ObjectName getObjectName() { @@ -230,7 +232,7 @@ public abstract class NetworkConnector extends NetworkBridgeConfiguration implem ObjectName objectName = createNetworkBridgeObjectName(bridge); mbeanServer.registerMBean(view, objectName); } catch (Throwable e) { - log.debug("Network bridge could not be registered in JMX: " + e.getMessage(), e); + LOG.debug("Network bridge could not be registered in JMX: " + e.getMessage(), e); } } } @@ -245,7 +247,7 @@ public abstract class NetworkConnector extends NetworkBridgeConfiguration implem ObjectName objectName = createNetworkBridgeObjectName(bridge); mbeanServer.unregisterMBean(objectName); } catch (Throwable e) { - log.debug("Network bridge could not be unregistered in JMX: " + e.getMessage(), e); + LOG.debug("Network bridge could not be unregistered in JMX: " + e.getMessage(), e); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java b/activemq-core/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java index c65952c783..12379be6bc 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java @@ -37,7 +37,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1.1.1 $ */ public abstract class DestinationBridge implements Service, MessageListener { - private static final Log log = LogFactory.getLog(DestinationBridge.class); + private static final Log LOG = LogFactory.getLog(DestinationBridge.class); protected MessageConsumer consumer; protected AtomicBoolean started = new AtomicBoolean(false); protected JmsMesageConvertor jmsMessageConvertor; @@ -130,12 +130,12 @@ public abstract class DestinationBridge implements Service, MessageListener { sendMessage(converted); message.acknowledge(); } catch (Exception e) { - log.error("failed to forward message on attempt: " + (++attempt) + " reason: " + e + " message: " + message, e); + LOG.error("failed to forward message on attempt: " + (++attempt) + " reason: " + e + " message: " + message, e); if (maximumRetries > 0 && attempt >= maximumRetries) { try { stop(); } catch (Exception e1) { - log.warn("Failed to stop cleanly", e1); + LOG.warn("Failed to stop cleanly", e1); } } } @@ -170,7 +170,7 @@ public abstract class DestinationBridge implements Service, MessageListener { try { getConnectionForProducer().close(); } catch (Exception e) { - log.debug("Ignoring failure to close producer connection: " + e, e); + LOG.debug("Ignoring failure to close producer connection: " + e, e); } jmsConnector.restartProducerConnection(); createProducer(); diff --git a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java index 91e6d9b66d..2e712ec20a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java @@ -44,7 +44,7 @@ import org.springframework.jndi.JndiTemplate; */ public abstract class JmsConnector implements Service { - private static final Log log = LogFactory.getLog(JmsConnector.class); + private static final Log LOG = LogFactory.getLog(JmsConnector.class); protected JndiTemplate jndiLocalTemplate; protected JndiTemplate jndiOutboundTemplate; protected JmsMesageConvertor inboundMessageConvertor; @@ -63,7 +63,7 @@ public abstract class JmsConnector implements Service { protected LRUCache replyToBridges = createLRUCache(); - static private LRUCache createLRUCache() { + private static LRUCache createLRUCache() { return new LRUCache() { private static final long serialVersionUID = -7446792754185879286L; @@ -75,9 +75,9 @@ public abstract class JmsConnector implements Service { DestinationBridge bridge = (DestinationBridge)lru.getValue(); try { bridge.stop(); - log.info("Expired bridge: " + bridge); + LOG.info("Expired bridge: " + bridge); } catch (Exception e) { - log.warn("stopping expired bridge" + bridge + " caused an exception", e); + LOG.warn("stopping expired bridge" + bridge + " caused an exception", e); } } return false; @@ -118,7 +118,7 @@ public abstract class JmsConnector implements Service { DestinationBridge bridge = (DestinationBridge)outboundBridges.get(i); bridge.start(); } - log.info("JMS Connector " + getName() + " Started"); + LOG.info("JMS Connector " + getName() + " Started"); } } @@ -132,7 +132,7 @@ public abstract class JmsConnector implements Service { DestinationBridge bridge = (DestinationBridge)outboundBridges.get(i); bridge.stop(); } - log.info("JMS Connector " + getName() + " Stopped"); + LOG.info("JMS Connector " + getName() + " Stopped"); } } @@ -300,7 +300,7 @@ public abstract class JmsConnector implements Service { static int nextId; - static private synchronized int getNextId() { + private static synchronized int getNextId() { return nextId++; } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsMesageConvertor.java b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsMesageConvertor.java index adf368c43e..92ebf724fe 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsMesageConvertor.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsMesageConvertor.java @@ -34,10 +34,10 @@ public interface JmsMesageConvertor { * @return the converted message * @throws JMSException */ - public Message convert(Message message) throws JMSException; + Message convert(Message message) throws JMSException; - public Message convert(Message message, Destination replyTo) throws JMSException; + Message convert(Message message, Destination replyTo) throws JMSException; - public void setConnection(Connection connection); + void setConnection(Connection connection); } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java index c62a61d2c5..c2cfdc2393 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java @@ -37,7 +37,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1.1.1 $ */ public class JmsQueueConnector extends JmsConnector { - private static final Log log = LogFactory.getLog(JmsQueueConnector.class); + private static final Log LOG = LogFactory.getLog(JmsQueueConnector.class); private String outboundQueueConnectionFactoryName; private String localConnectionFactoryName; private QueueConnectionFactory outboundQueueConnectionFactory; @@ -58,7 +58,7 @@ public class JmsQueueConnector extends JmsConnector { initializeInboundQueueBridges(); initializeOutboundQueueBridges(); } catch (Exception e) { - log.error("Failed to initialize the JMSConnector", e); + LOG.error("Failed to initialize the JMSConnector", e); } } return result; @@ -336,9 +336,9 @@ public class JmsQueueConnector extends JmsConnector { } bridge.setJmsConnector(this); bridge.start(); - log.info("Created replyTo bridge for " + replyToProducerQueue); + LOG.info("Created replyTo bridge for " + replyToProducerQueue); } catch (Exception e) { - log.error("Failed to create replyTo bridge for queue: " + replyToProducerQueue, e); + LOG.error("Failed to create replyTo bridge for queue: " + replyToProducerQueue, e); return null; } replyToBridges.put(replyToProducerQueue, bridge); @@ -367,9 +367,9 @@ public class JmsQueueConnector extends JmsConnector { } bridge.setJmsConnector(this); bridge.start(); - log.info("Created replyTo bridge for " + replyToProducerQueue); + LOG.info("Created replyTo bridge for " + replyToProducerQueue); } catch (Exception e) { - log.error("Failed to create replyTo bridge for queue: " + replyToProducerQueue, e); + LOG.error("Failed to create replyTo bridge for queue: " + replyToProducerQueue, e); return null; } replyToBridges.put(replyToProducerQueue, bridge); @@ -392,7 +392,7 @@ public class JmsQueueConnector extends JmsConnector { result = (Queue)jndiOutboundTemplate.lookup(queueName, Queue.class); } catch (NamingException e1) { String errStr = "Failed to look-up Queue for name: " + queueName; - log.error(errStr, e); + LOG.error(errStr, e); JMSException jmsEx = new JMSException(errStr); jmsEx.setLinkedException(e1); throw jmsEx; diff --git a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java index b8430db5ba..3eea3b3e3f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java @@ -37,7 +37,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1.1.1 $ */ public class JmsTopicConnector extends JmsConnector { - private static final Log log = LogFactory.getLog(JmsTopicConnector.class); + private static final Log LOG = LogFactory.getLog(JmsTopicConnector.class); private String outboundTopicConnectionFactoryName; private String localConnectionFactoryName; private TopicConnectionFactory outboundTopicConnectionFactory; @@ -58,7 +58,7 @@ public class JmsTopicConnector extends JmsConnector { initializeInboundTopicBridges(); initializeOutboundTopicBridges(); } catch (Exception e) { - log.error("Failed to initialize the JMSConnector", e); + LOG.error("Failed to initialize the JMSConnector", e); } } return result; @@ -336,9 +336,9 @@ public class JmsTopicConnector extends JmsConnector { } bridge.setJmsConnector(this); bridge.start(); - log.info("Created replyTo bridge for " + replyToProducerTopic); + LOG.info("Created replyTo bridge for " + replyToProducerTopic); } catch (Exception e) { - log.error("Failed to create replyTo bridge for topic: " + replyToProducerTopic, e); + LOG.error("Failed to create replyTo bridge for topic: " + replyToProducerTopic, e); return null; } replyToBridges.put(replyToProducerTopic, bridge); @@ -367,9 +367,9 @@ public class JmsTopicConnector extends JmsConnector { } bridge.setJmsConnector(this); bridge.start(); - log.info("Created replyTo bridge for " + replyToProducerTopic); + LOG.info("Created replyTo bridge for " + replyToProducerTopic); } catch (Exception e) { - log.error("Failed to create replyTo bridge for topic: " + replyToProducerTopic, e); + LOG.error("Failed to create replyTo bridge for topic: " + replyToProducerTopic, e); return null; } replyToBridges.put(replyToProducerTopic, bridge); @@ -392,7 +392,7 @@ public class JmsTopicConnector extends JmsConnector { result = (Topic)jndiOutboundTemplate.lookup(topicName, Topic.class); } catch (NamingException e1) { String errStr = "Failed to look-up Topic for name: " + topicName; - log.error(errStr, e); + LOG.error(errStr, e); JMSException jmsEx = new JMSException(errStr); jmsEx.setLinkedException(e1); throw jmsEx; diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/BooleanStream.java b/activemq-core/src/main/java/org/apache/activemq/openwire/BooleanStream.java index 64af4c54ea..ae0820582c 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/BooleanStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/BooleanStream.java @@ -21,7 +21,7 @@ import java.io.DataOutput; import java.io.IOException; import java.nio.ByteBuffer; -final public class BooleanStream { +public final class BooleanStream { byte data[] = new byte[48]; short arrayLimit; diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java b/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java index f9d38f43ca..c786bff926 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java @@ -38,7 +38,7 @@ import org.apache.activemq.wireformat.WireFormat; * * @version $Revision$ */ -final public class OpenWireFormat implements WireFormat { +public final class OpenWireFormat implements WireFormat { public static final int DEFAULT_VERSION = CommandTypes.PROTOCOL_VERSION; diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java index 15ea62a34e..38d6127531 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java @@ -28,9 +28,9 @@ import org.apache.activemq.openwire.OpenWireFormat; import org.apache.activemq.util.ByteSequence; import org.apache.activemq.util.ClassLoading; -abstract public class BaseDataStreamMarshaller implements DataStreamMarshaller { +public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller { - static final public Constructor STACK_TRACE_ELEMENT_CONSTRUCTOR; + public static final Constructor STACK_TRACE_ELEMENT_CONSTRUCTOR; static { Constructor constructor = null; @@ -42,9 +42,9 @@ abstract public class BaseDataStreamMarshaller implements DataStreamMarshaller { STACK_TRACE_ELEMENT_CONSTRUCTOR = constructor; } - abstract public byte getDataStructureType(); + public abstract byte getDataStructureType(); - abstract public DataStructure createObject(); + public abstract DataStructure createObject(); public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { return 0; diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MarshallerFactory.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MarshallerFactory.java index 47ef76c6ef..f75098aaf6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MarshallerFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MarshallerFactory.java @@ -33,7 +33,7 @@ public class MarshallerFactory { /** * Creates a Map of command type -> Marshallers */ - static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256]; + private static final DataStreamMarshaller MARSHALLER[] = new DataStreamMarshaller[256]; static { add(new LocalTransactionIdMarshaller()); @@ -92,11 +92,11 @@ public class MarshallerFactory { } - static private void add(DataStreamMarshaller dsm) { - marshaller[dsm.getDataStructureType()] = dsm; + private static void add(DataStreamMarshaller dsm) { + MARSHALLER[dsm.getDataStructureType()] = dsm; } - static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) { - return marshaller; + public static DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) { + return MARSHALLER; } } diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java index cc1a2c2396..6619b7e0c3 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java @@ -28,9 +28,9 @@ import org.apache.activemq.openwire.OpenWireFormat; import org.apache.activemq.util.ByteSequence; import org.apache.activemq.util.ClassLoading; -abstract public class BaseDataStreamMarshaller implements DataStreamMarshaller { +public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller { - static final public Constructor STACK_TRACE_ELEMENT_CONSTRUCTOR; + public static final Constructor STACK_TRACE_ELEMENT_CONSTRUCTOR; static { Constructor constructor = null; @@ -42,9 +42,9 @@ abstract public class BaseDataStreamMarshaller implements DataStreamMarshaller { STACK_TRACE_ELEMENT_CONSTRUCTOR = constructor; } - abstract public byte getDataStructureType(); + public abstract byte getDataStructureType(); - abstract public DataStructure createObject(); + public abstract DataStructure createObject(); public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { return 0; diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v2/MarshallerFactory.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v2/MarshallerFactory.java index e2c3baefa9..4482f15f84 100644 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v2/MarshallerFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v2/MarshallerFactory.java @@ -36,7 +36,7 @@ public class MarshallerFactory { /** * Creates a Map of command type -> Marshallers */ - static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256]; + private static final DataStreamMarshaller MARSHALLER[] = new DataStreamMarshaller[256]; static { add(new ActiveMQBytesMessageMarshaller()); @@ -96,11 +96,11 @@ public class MarshallerFactory { } - static private void add(DataStreamMarshaller dsm) { - marshaller[dsm.getDataStructureType()] = dsm; + private static void add(DataStreamMarshaller dsm) { + MARSHALLER[dsm.getDataStructureType()] = dsm; } - static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) { - return marshaller; + public static DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) { + return MARSHALLER; } } diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java index 342d2d38db..8970e1066a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -28,9 +28,9 @@ import org.apache.activemq.openwire.OpenWireFormat; import org.apache.activemq.util.ByteSequence; import org.apache.activemq.util.ClassLoading; -abstract public class BaseDataStreamMarshaller implements DataStreamMarshaller { +public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller { - static final public Constructor STACK_TRACE_ELEMENT_CONSTRUCTOR; + public static final Constructor STACK_TRACE_ELEMENT_CONSTRUCTOR; static { Constructor constructor = null; @@ -41,9 +41,9 @@ abstract public class BaseDataStreamMarshaller implements DataStreamMarshaller { STACK_TRACE_ELEMENT_CONSTRUCTOR = constructor; } - abstract public byte getDataStructureType(); + public abstract byte getDataStructureType(); - abstract public DataStructure createObject(); + public abstract DataStructure createObject(); public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { return 0; diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v3/MarshallerFactory.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v3/MarshallerFactory.java index 6f39a2f0c1..772c7a0a2f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v3/MarshallerFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v3/MarshallerFactory.java @@ -36,7 +36,7 @@ public class MarshallerFactory { /** * Creates a Map of command type -> Marshallers */ - static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256]; + private static final DataStreamMarshaller MARSHALLER[] = new DataStreamMarshaller[256]; static { add(new ActiveMQBlobMessageMarshaller()); @@ -98,11 +98,11 @@ public class MarshallerFactory { } - static private void add(DataStreamMarshaller dsm) { - marshaller[dsm.getDataStructureType()] = dsm; + private static void add(DataStreamMarshaller dsm) { + MARSHALLER[dsm.getDataStructureType()] = dsm; } - static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) { - return marshaller; + public static DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) { + return MARSHALLER; } } diff --git a/activemq-core/src/main/java/org/apache/activemq/pool/ConnectionPool.java b/activemq-core/src/main/java/org/apache/activemq/pool/ConnectionPool.java index 499bda7fd2..172aa5a18f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/pool/ConnectionPool.java +++ b/activemq-core/src/main/java/org/apache/activemq/pool/ConnectionPool.java @@ -90,7 +90,7 @@ public class ConnectionPool { } } - synchronized public ActiveMQConnection getConnection() { + public synchronized ActiveMQConnection getConnection() { return connection; } @@ -126,7 +126,7 @@ public class ConnectionPool { } } - synchronized public void close() { + public synchronized void close() { if (connection != null) { try { Iterator i = cache.values().iterator(); @@ -149,12 +149,12 @@ public class ConnectionPool { } } - synchronized public void incrementReferenceCount() { + public synchronized void incrementReferenceCount() { referenceCount++; lastUsed = System.currentTimeMillis(); } - synchronized public void decrementReferenceCount() { + public synchronized void decrementReferenceCount() { referenceCount--; lastUsed = System.currentTimeMillis(); if (referenceCount == 0) { @@ -165,7 +165,7 @@ public class ConnectionPool { /** * @return true if this connection has expired. */ - synchronized public boolean expiredCheck() { + public synchronized boolean expiredCheck() { if (connection == null) { return true; } diff --git a/activemq-core/src/main/java/org/apache/activemq/pool/PooledSession.java b/activemq-core/src/main/java/org/apache/activemq/pool/PooledSession.java index 3dac2a2740..1556138e63 100644 --- a/activemq-core/src/main/java/org/apache/activemq/pool/PooledSession.java +++ b/activemq-core/src/main/java/org/apache/activemq/pool/PooledSession.java @@ -55,7 +55,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public class PooledSession implements TopicSession, QueueSession { - private static final transient Log log = LogFactory.getLog(PooledSession.class); + private static final transient Log LOG = LogFactory.getLog(PooledSession.class); private ActiveMQSession session; private SessionPool sessionPool; @@ -107,14 +107,14 @@ public class PooledSession implements TopicSession, QueueSession { try { getSession().rollback(); } catch (JMSException e) { - log.warn("Caught exception trying rollback() when putting session back into the pool: " + e, e); + LOG.warn("Caught exception trying rollback() when putting session back into the pool: " + e, e); // lets close the session and not put the session back into // the pool try { session.close(); } catch (JMSException e1) { - log.trace("Ignoring exception as discarding session: " + e1, e1); + LOG.trace("Ignoring exception as discarding session: " + e1, e1); } session = null; return; diff --git a/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnection.java b/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnection.java index 4791772acc..74001ce509 100644 --- a/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnection.java +++ b/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnection.java @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; class ProxyConnection implements Service { - static final private Log log = LogFactory.getLog(ProxyConnection.class); + private static final Log LOG = LogFactory.getLog(ProxyConnection.class); private final Transport localTransport; private final Transport remoteTransport; @@ -44,7 +44,7 @@ class ProxyConnection implements Service { public void onFailure(IOException e) { if (!shuttingDown.get()) { - log.debug("Transport error: " + e, e); + LOG.debug("Transport error: " + e, e); try { stop(); } catch (Exception ignore) { diff --git a/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java b/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java index 34ba393bed..dee313cb3d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java @@ -40,7 +40,7 @@ import org.apache.commons.logging.LogFactory; */ public class ProxyConnector implements Service { - private static final Log log = LogFactory.getLog(ProxyConnector.class); + private static final Log LOG = LogFactory.getLog(ProxyConnector.class); private TransportServer server; private URI bind; private URI remote; @@ -64,11 +64,11 @@ public class ProxyConnector implements Service { } public void onAcceptError(Exception error) { - log.error("Could not accept connection: " + error, error); + LOG.error("Could not accept connection: " + error, error); } }); getServer().start(); - log.info("Proxy Connector " + getName() + " Started"); + LOG.info("Proxy Connector " + getName() + " Started"); } @@ -78,11 +78,11 @@ public class ProxyConnector implements Service { ss.stop(this.server); } for (Iterator iter = connections.iterator(); iter.hasNext();) { - log.info("Connector stopped: Stopping proxy."); + LOG.info("Connector stopped: Stopping proxy."); ss.stop((Service)iter.next()); } ss.throwFirstException(); - log.info("Proxy Connector " + getName() + " Stopped"); + LOG.info("Proxy Connector " + getName() + " Stopped"); } // Properties @@ -140,7 +140,7 @@ public class ProxyConnector implements Service { // Add a transport filter so that can track the transport life cycle transport = new TransportFilter(transport) { public void stop() throws Exception { - log.info("Stopping proxy."); + LOG.info("Stopping proxy."); super.stop(); connections.remove(this); } diff --git a/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationMap.java b/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationMap.java index 4ed51657bf..9f7ea266c3 100644 --- a/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationMap.java +++ b/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationMap.java @@ -21,7 +21,6 @@ import java.util.Set; import org.apache.activemq.command.ActiveMQDestination; /** - * * @version $Revision$ */ public interface AuthorizationMap { @@ -30,24 +29,26 @@ public interface AuthorizationMap { * Returns the set of all ACLs capable of administering temp destination */ Set getTempDestinationAdminACLs(); - + /** * Returns the set of all ACLs capable of reading from temp destination */ Set getTempDestinationReadACLs(); - + /** * Returns the set of all ACLs capable of writing to temp destination */ - Set getTempDestinationWriteACLs(); - + Set getTempDestinationWriteACLs(); + /** - * Returns the set of all ACLs capable of administering the given destination + * Returns the set of all ACLs capable of administering the given + * destination */ Set getAdminACLs(ActiveMQDestination destination); /** - * Returns the set of all ACLs capable of reading (consuming from) the given destination + * Returns the set of all ACLs capable of reading (consuming from) the given + * destination */ Set getReadACLs(ActiveMQDestination destination); diff --git a/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java b/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java index 07ba2c9aea..4d25dce64e 100644 --- a/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java +++ b/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java @@ -31,7 +31,6 @@ import org.apache.activemq.filter.DestinationMap; * for each operation. * * @org.apache.xbean.XBean element="authorizationMap" - * * @version $Revision$ */ public class DefaultAuthorizationMap extends DestinationMap implements AuthorizationMap { @@ -48,8 +47,7 @@ public class DefaultAuthorizationMap extends DestinationMap implements Authoriza } - public void setTempDestinationAuthorizationEntry( - TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry) { + public void setTempDestinationAuthorizationEntry(TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry) { this.tempDestinationAuthorizationEntry = tempDestinationAuthorizationEntry; } @@ -58,24 +56,27 @@ public class DefaultAuthorizationMap extends DestinationMap implements Authoriza } public Set getTempDestinationAdminACLs() { - if (tempDestinationAuthorizationEntry != null) + if (tempDestinationAuthorizationEntry != null) { return tempDestinationAuthorizationEntry.getAdminACLs(); - else + } else { return null; + } } public Set getTempDestinationReadACLs() { - if (tempDestinationAuthorizationEntry != null) + if (tempDestinationAuthorizationEntry != null) { return tempDestinationAuthorizationEntry.getReadACLs(); - else + } else { return null; + } } public Set getTempDestinationWriteACLs() { - if (tempDestinationAuthorizationEntry != null) + if (tempDestinationAuthorizationEntry != null) { return tempDestinationAuthorizationEntry.getWriteACLs(); - else + } else { return null; + } } public Set getAdminACLs(ActiveMQDestination destination) { diff --git a/activemq-core/src/main/java/org/apache/activemq/security/SecurityAdminMBean.java b/activemq-core/src/main/java/org/apache/activemq/security/SecurityAdminMBean.java index 8cebd0772c..65327ab3c3 100644 --- a/activemq-core/src/main/java/org/apache/activemq/security/SecurityAdminMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/security/SecurityAdminMBean.java @@ -24,20 +24,20 @@ package org.apache.activemq.security; */ public interface SecurityAdminMBean { - public static final String OPERATION_READ = "read"; - public static final String OPERATION_WRITE = "write"; - public static final String OPERATION_ADMIN = "admin"; + String OPERATION_READ = "read"; + String OPERATION_WRITE = "write"; + String OPERATION_ADMIN = "admin"; - public void addRole(String role); - public void removeRole(String role); + void addRole(String role); + void removeRole(String role); - public void addUserRole(String user, String role); - public void removeUserRole(String user, String role); + void addUserRole(String user, String role); + void removeUserRole(String user, String role); - public void addTopicRole(String topic, String operation, String role); - public void removeTopicRole(String topic, String operation, String role); + void addTopicRole(String topic, String operation, String role); + void removeTopicRole(String topic, String operation, String role); - public void addQueueRole(String queue, String operation, String role); - public void removeQueueRole(String queue, String operation, String role); + void addQueueRole(String queue, String operation, String role); + void removeQueueRole(String queue, String operation, String role); } diff --git a/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java b/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java index 2cb081dbfb..9632c6ce81 100644 --- a/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java +++ b/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java @@ -26,7 +26,7 @@ import java.util.concurrent.ConcurrentHashMap; * * @version $Revision$ */ -abstract public class SecurityContext { +public abstract class SecurityContext { public static final SecurityContext BROKER_SECURITY_CONTEXT = new SecurityContext("ActiveMQBroker") { @Override @@ -54,7 +54,7 @@ abstract public class SecurityContext { return set.size() > 0; } - abstract public Set getPrincipals(); + public abstract Set getPrincipals(); public String getUserName() { return userName; diff --git a/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java b/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java index c58903a3c7..6904af7553 100644 --- a/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java +++ b/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java @@ -64,24 +64,27 @@ public class SimpleAuthorizationMap implements AuthorizationMap { } public Set getTempDestinationAdminACLs() { - if (tempDestinationAuthorizationEntry != null) + if (tempDestinationAuthorizationEntry != null) { return tempDestinationAuthorizationEntry.getAdminACLs(); - else + } else { return null; + } } public Set getTempDestinationReadACLs() { - if (tempDestinationAuthorizationEntry != null) + if (tempDestinationAuthorizationEntry != null) { return tempDestinationAuthorizationEntry.getReadACLs(); - else + } else { return null; + } } public Set getTempDestinationWriteACLs() { - if (tempDestinationAuthorizationEntry != null) + if (tempDestinationAuthorizationEntry != null) { return tempDestinationAuthorizationEntry.getWriteACLs(); - else + } else { return null; + } } public Set getAdminACLs(ActiveMQDestination destination) { diff --git a/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java b/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java index ec3c75fb7c..de2aa311bb 100644 --- a/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java b/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java index 6b51711bbd..8ee2f1b0e3 100644 --- a/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java b/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java index 7584221e39..49a2f32b04 100755 --- a/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java +++ b/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java @@ -45,7 +45,7 @@ import org.apache.activemq.util.IOExceptionSupport; */ public class ConnectionStateTracker extends CommandVisitorAdapter { - private final static Tracked TRACKED_RESPONSE_MARKER = new Tracked(null); + private static final Tracked TRACKED_RESPONSE_MARKER = new Tracked(null); private boolean trackTransactions = false; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/MessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/MessageStore.java index 7fb89004a5..01dd61d124 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/MessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/MessageStore.java @@ -1,20 +1,23 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store; import java.io.IOException; + import org.apache.activemq.Service; import org.apache.activemq.broker.ConnectionContext; import org.apache.activemq.command.ActiveMQDestination; @@ -37,7 +40,7 @@ public interface MessageStore extends Service { * @param message * @throws IOException */ - public void addMessage(ConnectionContext context, Message message) throws IOException; + void addMessage(ConnectionContext context, Message message) throws IOException; /** * Looks up a message using either the String messageID or the @@ -48,7 +51,7 @@ public interface MessageStore extends Service { * @return the message or null if it does not exist * @throws IOException */ - public Message getMessage(MessageId identity) throws IOException; + Message getMessage(MessageId identity) throws IOException; /** * Removes a message from the message store. @@ -59,7 +62,7 @@ public interface MessageStore extends Service { * message that needs to be removed. * @throws IOException */ - public void removeMessage(ConnectionContext context, MessageAck ack) throws IOException; + void removeMessage(ConnectionContext context, MessageAck ack) throws IOException; /** * Removes all the messages from the message store. @@ -67,7 +70,7 @@ public interface MessageStore extends Service { * @param context * @throws IOException */ - public void removeAllMessages(ConnectionContext context) throws IOException; + void removeAllMessages(ConnectionContext context) throws IOException; /** * Recover any messages to be delivered. @@ -75,34 +78,34 @@ public interface MessageStore extends Service { * @param container * @throws Exception */ - public void recover(MessageRecoveryListener container) throws Exception; + void recover(MessageRecoveryListener container) throws Exception; /** * The destination that the message store is holding messages for. * * @return the destination */ - public ActiveMQDestination getDestination(); + ActiveMQDestination getDestination(); /** * @param usageManager The UsageManager that is controlling the * destination's memory usage. */ - public void setUsageManager(UsageManager usageManager); + void setUsageManager(UsageManager usageManager); /** * @return the number of messages ready to deliver * @throws IOException * */ - public int getMessageCount() throws IOException; + int getMessageCount() throws IOException; /** * A hint to the Store to reset any batching state for the Destination * */ - public void resetBatching(); + void resetBatching(); - public void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception; + void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapter.java index 0f87941433..7f9d00aa8f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapter.java @@ -40,7 +40,7 @@ public interface PersistenceAdapter extends Service { * * @return active destinations */ - public Set getDestinations(); + Set getDestinations(); /** * Factory method to create a new queue message store with the given destination name @@ -48,7 +48,7 @@ public interface PersistenceAdapter extends Service { * @return the message store * @throws IOException */ - public MessageStore createQueueMessageStore(ActiveMQQueue destination) throws IOException; + MessageStore createQueueMessageStore(ActiveMQQueue destination) throws IOException; /** * Factory method to create a new topic message store with the given destination name @@ -56,14 +56,14 @@ public interface PersistenceAdapter extends Service { * @return the topic message store * @throws IOException */ - public TopicMessageStore createTopicMessageStore(ActiveMQTopic destination) throws IOException; + TopicMessageStore createTopicMessageStore(ActiveMQTopic destination) throws IOException; /** * Factory method to create a new persistent prepared transaction store for XA recovery * @return transaction store * @throws IOException */ - public TransactionStore createTransactionStore() throws IOException; + TransactionStore createTransactionStore() throws IOException; /** * This method starts a transaction on the persistent storage - which is nothing to @@ -77,7 +77,7 @@ public interface PersistenceAdapter extends Service { * @param context * @throws IOException */ - public void beginTransaction(ConnectionContext context) throws IOException; + void beginTransaction(ConnectionContext context) throws IOException; /** @@ -87,7 +87,7 @@ public interface PersistenceAdapter extends Service { * * @see PersistenceAdapter#beginTransaction(ConnectionContext context) */ - public void commitTransaction(ConnectionContext context) throws IOException; + void commitTransaction(ConnectionContext context) throws IOException; /** * Rollback a persistence transaction @@ -96,38 +96,38 @@ public interface PersistenceAdapter extends Service { * * @see PersistenceAdapter#beginTransaction(ConnectionContext context) */ - public void rollbackTransaction(ConnectionContext context) throws IOException; + void rollbackTransaction(ConnectionContext context) throws IOException; /** * * @return last broker sequence * @throws IOException */ - public long getLastMessageBrokerSequenceId() throws IOException; + long getLastMessageBrokerSequenceId() throws IOException; /** * Delete's all the messages in the persistent store. * * @throws IOException */ - public void deleteAllMessages() throws IOException; + void deleteAllMessages() throws IOException; /** * @param usageManager The UsageManager that is controlling the broker's memory usage. */ - public void setUsageManager(UsageManager usageManager); + void setUsageManager(UsageManager usageManager); /** * Set the name of the broker using the adapter * @param brokerName */ - public void setBrokerName(String brokerName); + void setBrokerName(String brokerName); /** * Set the directory where any data files should be created * @param dir */ - public void setDirectory(File dir); + void setDirectory(File dir); /** * checkpoint any @@ -135,5 +135,5 @@ public interface PersistenceAdapter extends Service { * @throws IOException * */ - public void checkpoint(boolean sync) throws IOException; + void checkpoint(boolean sync) throws IOException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapterFactory.java b/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapterFactory.java index 47e2817573..329b9b63c6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapterFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapterFactory.java @@ -29,6 +29,6 @@ public interface PersistenceAdapterFactory { * Creates a persistence Adapter that can use a given directory to store it's data. * @throws IOException */ - public PersistenceAdapter createPersistenceAdapter() throws IOException; + PersistenceAdapter createPersistenceAdapter() throws IOException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStore.java b/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStore.java index 7c34f62f22..d1ed78a910 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStore.java @@ -67,21 +67,20 @@ public interface ReferenceStore extends MessageStore { /** * Adds a message reference to the message store */ - public void addMessageReference(ConnectionContext context, MessageId messageId, ReferenceData data) - throws IOException; + void addMessageReference(ConnectionContext context, MessageId messageId, ReferenceData data) throws IOException; /** * Looks up a message using either the String messageID or the * messageNumber. Implementations are encouraged to fill in the missing key * if its easy to do so. */ - public ReferenceData getMessageReference(MessageId identity) throws IOException; + ReferenceData getMessageReference(MessageId identity) throws IOException; /** * @return true if it supports external batch control */ - public boolean supportsExternalBatchControl(); + boolean supportsExternalBatchControl(); - public void setBatch(MessageId startAfter); + void setBatch(MessageId startAfter); } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStoreAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStoreAdapter.java index 513c8347c7..c2b0359d4d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStoreAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStoreAdapter.java @@ -40,7 +40,7 @@ public interface ReferenceStoreAdapter extends PersistenceAdapter { * @return the QueueReferenceStore * @throws IOException */ - public ReferenceStore createQueueReferenceStore(ActiveMQQueue destination) throws IOException; + ReferenceStore createQueueReferenceStore(ActiveMQQueue destination) throws IOException; /** * Factory method to create a new topic message store with the given @@ -50,34 +50,34 @@ public interface ReferenceStoreAdapter extends PersistenceAdapter { * @return the TopicRefererenceStore * @throws IOException */ - public TopicReferenceStore createTopicReferenceStore(ActiveMQTopic destination) throws IOException; + TopicReferenceStore createTopicReferenceStore(ActiveMQTopic destination) throws IOException; /** * @return Set of File ids in use * @throws IOException */ - public Set getReferenceFileIdsInUse() throws IOException; + Set getReferenceFileIdsInUse() throws IOException; /** * If the store isn't valid, it can be recoverd at start-up * * @return true if the reference store is in a consistent state */ - public boolean isStoreValid(); + boolean isStoreValid(); /** * called by recover to clear out message references * * @throws IOException */ - public void clearMessages() throws IOException; + void clearMessages() throws IOException; /** * recover any state * * @throws IOException */ - public void recoverState() throws IOException; + void recoverState() throws IOException; /** * Save prepared transactions @@ -85,12 +85,12 @@ public interface ReferenceStoreAdapter extends PersistenceAdapter { * @param map * @throws IOException */ - public void savePreparedState(Map map) throws IOException; + void savePreparedState(Map map) throws IOException; /** * @return saved prepared transactions * @throws IOException */ - public Map retrievePreparedState() throws IOException; + Map retrievePreparedState() throws IOException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/TopicMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/TopicMessageStore.java index 3daefae417..3a101dcabc 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/TopicMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/TopicMessageStore.java @@ -1,15 +1,18 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.store; @@ -37,8 +40,7 @@ public interface TopicMessageStore extends MessageStore { * @param subscriptionPersistentId * @throws IOException */ - public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, - MessageId messageId) throws IOException; + void acknowledge(ConnectionContext context, String clientId, String subscriptionName, MessageId messageId) throws IOException; /** * @param clientId @@ -47,7 +49,7 @@ public interface TopicMessageStore extends MessageStore { * @throws IOException * @throws JMSException */ - public void deleteSubscription(String clientId, String subscriptionName) throws IOException; + void deleteSubscription(String clientId, String subscriptionName) throws IOException; /** * For the new subscription find the last acknowledged message ID and then @@ -60,11 +62,9 @@ public interface TopicMessageStore extends MessageStore { * @param subscriptionName * @param listener * @param subscription - * * @throws Exception */ - public void recoverSubscription(String clientId, String subscriptionName, MessageRecoveryListener listener) - throws Exception; + void recoverSubscription(String clientId, String subscriptionName, MessageRecoveryListener listener) throws Exception; /** * For an active subscription - retrieve messages from the store for the @@ -74,20 +74,17 @@ public interface TopicMessageStore extends MessageStore { * @param subscriptionName * @param maxReturned * @param listener - * * @throws Exception */ - public void recoverNextMessages(String clientId, String subscriptionName, int maxReturned, - MessageRecoveryListener listener) throws Exception; + void recoverNextMessages(String clientId, String subscriptionName, int maxReturned, MessageRecoveryListener listener) throws Exception; /** * A hint to the Store to reset any batching state for a durable subsriber * * @param clientId * @param subscriptionName - * */ - public void resetBatching(String clientId, String subscriptionName); + void resetBatching(String clientId, String subscriptionName); /** * Get the number of messages ready to deliver from the store to a durable @@ -98,7 +95,7 @@ public interface TopicMessageStore extends MessageStore { * @return the outstanding message count * @throws IOException */ - public int getMessageCount(String clientId, String subscriberName) throws IOException; + int getMessageCount(String clientId, String subscriberName) throws IOException; /** * Finds the subscriber entry for the given consumer info @@ -108,7 +105,7 @@ public interface TopicMessageStore extends MessageStore { * @return the SubscriptionInfo * @throws IOException */ - public SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException; + SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException; /** * Lists all the durable subscriptions for a given destination. @@ -116,7 +113,7 @@ public interface TopicMessageStore extends MessageStore { * @return an array SubscriptionInfos * @throws IOException */ - public SubscriptionInfo[] getAllSubscriptions() throws IOException; + SubscriptionInfo[] getAllSubscriptions() throws IOException; /** * Inserts the subscriber info due to a subscription change

If this is @@ -131,7 +128,6 @@ public interface TopicMessageStore extends MessageStore { * @param selector * @param retroactive * @throws IOException - * */ - public void addSubsciption(SubscriptionInfo subscriptionInfo, boolean retroactive) throws IOException; + void addSubsciption(SubscriptionInfo subscriptionInfo, boolean retroactive) throws IOException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/TopicReferenceStore.java b/activemq-core/src/main/java/org/apache/activemq/store/TopicReferenceStore.java index c820d426cb..1e382e7aa7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/TopicReferenceStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/TopicReferenceStore.java @@ -41,8 +41,7 @@ public interface TopicReferenceStore extends ReferenceStore, TopicMessageStore { * @param subscriptionPersistentId * @throws IOException */ - public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, - MessageId messageId) throws IOException; + void acknowledge(ConnectionContext context, String clientId, String subscriptionName, MessageId messageId) throws IOException; /** * @param clientId @@ -51,7 +50,7 @@ public interface TopicReferenceStore extends ReferenceStore, TopicMessageStore { * @throws IOException * @throws JMSException */ - public void deleteSubscription(String clientId, String subscriptionName) throws IOException; + void deleteSubscription(String clientId, String subscriptionName) throws IOException; /** * For the new subscription find the last acknowledged message ID and then @@ -64,11 +63,9 @@ public interface TopicReferenceStore extends ReferenceStore, TopicMessageStore { * @param subscriptionName * @param listener * @param subscription - * * @throws Exception */ - public void recoverSubscription(String clientId, String subscriptionName, MessageRecoveryListener listener) - throws Exception; + void recoverSubscription(String clientId, String subscriptionName, MessageRecoveryListener listener) throws Exception; /** * For an active subscription - retrieve messages from the store for the @@ -78,20 +75,17 @@ public interface TopicReferenceStore extends ReferenceStore, TopicMessageStore { * @param subscriptionName * @param maxReturned * @param listener - * * @throws Exception */ - public void recoverNextMessages(String clientId, String subscriptionName, int maxReturned, - MessageRecoveryListener listener) throws Exception; + void recoverNextMessages(String clientId, String subscriptionName, int maxReturned, MessageRecoveryListener listener) throws Exception; /** * A hint to the Store to reset any batching state for a durable subsriber * * @param clientId * @param subscriptionName - * */ - public void resetBatching(String clientId, String subscriptionName); + void resetBatching(String clientId, String subscriptionName); /** * Get the number of messages ready to deliver from the store to a durable @@ -102,7 +96,7 @@ public interface TopicReferenceStore extends ReferenceStore, TopicMessageStore { * @return the outstanding message count * @throws IOException */ - public int getMessageCount(String clientId, String subscriberName) throws IOException; + int getMessageCount(String clientId, String subscriberName) throws IOException; /** * Finds the subscriber entry for the given consumer info @@ -112,7 +106,7 @@ public interface TopicReferenceStore extends ReferenceStore, TopicMessageStore { * @return the SubscriptionInfo * @throws IOException */ - public SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException; + SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException; /** * Lists all the durable subscirptions for a given destination. @@ -120,7 +114,7 @@ public interface TopicReferenceStore extends ReferenceStore, TopicMessageStore { * @return an array SubscriptionInfos * @throws IOException */ - public SubscriptionInfo[] getAllSubscriptions() throws IOException; + SubscriptionInfo[] getAllSubscriptions() throws IOException; /** * Inserts the subscriber info due to a subscription change

If this is @@ -135,7 +129,6 @@ public interface TopicReferenceStore extends ReferenceStore, TopicMessageStore { * @param selector * @param retroactive * @throws IOException - * */ - public void addSubsciption(SubscriptionInfo subscriptionInfo, boolean retroactive) throws IOException; + void addSubsciption(SubscriptionInfo subscriptionInfo, boolean retroactive) throws IOException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/TransactionRecoveryListener.java b/activemq-core/src/main/java/org/apache/activemq/store/TransactionRecoveryListener.java index 18dbafc799..be84ffb7cc 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/TransactionRecoveryListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/TransactionRecoveryListener.java @@ -21,5 +21,5 @@ import org.apache.activemq.command.MessageAck; import org.apache.activemq.command.XATransactionId; public interface TransactionRecoveryListener { - public void recover(XATransactionId xid, Message[] addedMessages, MessageAck aks[]); + void recover(XATransactionId xid, Message[] addedMessages, MessageAck aks[]); } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/TransactionStore.java b/activemq-core/src/main/java/org/apache/activemq/store/TransactionStore.java index e166b1b976..6b1ec7cd86 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/TransactionStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/TransactionStore.java @@ -21,18 +21,20 @@ import java.io.IOException; import org.apache.activemq.Service; import org.apache.activemq.command.TransactionId; - /** - * Represents the durable store of the commit/rollback operations taken against the - * broker. - * + * Represents the durable store of the commit/rollback operations taken against + * the broker. + * * @version $Revision: 1.2 $ */ public interface TransactionStore extends Service { - public void prepare(TransactionId txid) throws IOException; - public void commit(TransactionId txid, boolean wasPrepared) throws IOException; - public void rollback(TransactionId txid) throws IOException; - public void recover(TransactionRecoveryListener listener) throws IOException; - + void prepare(TransactionId txid) throws IOException; + + void commit(TransactionId txid, boolean wasPrepared) throws IOException; + + void rollback(TransactionId txid) throws IOException; + + void recover(TransactionRecoveryListener listener) throws IOException; + } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java index 53bea9f035..1839b89c3b 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.amq; import java.io.IOException; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java index b8325bdc6c..b8e8df3421 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java @@ -1,15 +1,18 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.store.amq; @@ -70,7 +73,7 @@ import org.apache.commons.logging.LogFactory; */ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, BrokerServiceAware { - private static final Log log = LogFactory.getLog(AMQPersistenceAdapter.class); + private static final Log LOG = LogFactory.getLog(AMQPersistenceAdapter.class); private final ConcurrentHashMap queues = new ConcurrentHashMap(); private final ConcurrentHashMap topics = new ConcurrentHashMap(); private AsyncDataManager asyncDataManager; @@ -125,7 +128,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, this.directory = new File(directory, "amqstore"); } } - log.info("AMQStore starting using directory: " + directory); + LOG.info("AMQStore starting using directory: " + directory); this.directory.mkdirs(); if (this.usageManager != null) { @@ -151,7 +154,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, trace.setMessage("DELETED " + new Date()); Location location = asyncDataManager.write(wireFormat.marshal(trace), false); asyncDataManager.setMark(location, true); - log.info("Journal deleted: "); + LOG.info("Journal deleted: "); deleteAllMessages = false; } catch (IOException e) { throw e; @@ -162,7 +165,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, } referenceStoreAdapter.start(); Set files = referenceStoreAdapter.getReferenceFileIdsInUse(); - log.info("Active data files: " + files); + LOG.info("Active data files: " + files); checkpointTask = taskRunnerFactory.createTaskRunner(new Task() { public boolean iterate() { @@ -182,9 +185,9 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, // need to be recovered when the broker starts up. if (!referenceStoreAdapter.isStoreValid()) { - log.warn("The ReferenceStore is not valid - recovering ..."); + LOG.warn("The ReferenceStore is not valid - recovering ..."); recover(); - log.info("Finished recovering the ReferenceStore"); + LOG.info("Finished recovering the ReferenceStore"); } else { Location location = writeTraceMessage("RECOVERED " + new Date(), true); asyncDataManager.setMark(location, true); @@ -240,7 +243,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, IOException firstException = null; referenceStoreAdapter.stop(); try { - log.debug("Journal close"); + LOG.debug("Journal close"); asyncDataManager.close(); } catch (Exception e) { firstException = IOExceptionSupport.create("Failed to close journals: " + e, e); @@ -266,17 +269,17 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, checkpointTask.wakeup(); } if (sync) { - if (log.isDebugEnabled()) { - log.debug("Waitng for checkpoint to complete."); + if (LOG.isDebugEnabled()) { + LOG.debug("Waitng for checkpoint to complete."); } latch.await(); } referenceStoreAdapter.checkpoint(sync); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - log.warn("Request to start checkpoint failed: " + e, e); + LOG.warn("Request to start checkpoint failed: " + e, e); } catch (IOException e) { - log.error("checkpoint failed: " + e, e); + LOG.error("checkpoint failed: " + e, e); } } @@ -292,8 +295,8 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, nextCheckpointCountDownLatch = new CountDownLatch(1); } try { - if (log.isDebugEnabled()) { - log.debug("Checkpoint started."); + if (LOG.isDebugEnabled()) { + LOG.debug("Checkpoint started."); } Location newMark = null; @@ -315,17 +318,17 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, } try { if (newMark != null) { - if (log.isDebugEnabled()) { - log.debug("Marking journal at: " + newMark); + if (LOG.isDebugEnabled()) { + LOG.debug("Marking journal at: " + newMark); } asyncDataManager.setMark(newMark, false); writeTraceMessage("CHECKPOINT " + new Date(), true); } } catch (Exception e) { - log.error("Failed to mark the Journal: " + e, e); + LOG.error("Failed to mark the Journal: " + e, e); } - if (log.isDebugEnabled()) { - log.debug("Checkpoint done."); + if (LOG.isDebugEnabled()) { + LOG.debug("Checkpoint done."); } } finally { latch.countDown(); @@ -344,7 +347,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, Set inUse = referenceStoreAdapter.getReferenceFileIdsInUse(); asyncDataManager.consolidateDataFilesNotIn(inUse); } catch (IOException e) { - log.error("Could not cleanup data files: " + e, e); + LOG.error("Could not cleanup data files: " + e, e); } } @@ -441,7 +444,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, referenceStoreAdapter.recoverState(); Location pos = null; int redoCounter = 0; - log.info("Journal Recovery Started from: " + asyncDataManager); + LOG.info("Journal Recovery Started from: " + asyncDataManager); long start = System.currentTimeMillis(); ConnectionContext context = new ConnectionContext(); // While we have records in the journal. @@ -517,23 +520,23 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, throw new IOException("Invalid journal command type: " + command.getType()); } } catch (IOException e) { - log.error("Recovery Failure: Could not replay: " + c + ", reason: " + e, e); + LOG.error("Recovery Failure: Could not replay: " + c + ", reason: " + e, e); } } break; case JournalTrace.DATA_STRUCTURE_TYPE: JournalTrace trace = (JournalTrace)c; - log.debug("TRACE Entry: " + trace.getMessage()); + LOG.debug("TRACE Entry: " + trace.getMessage()); break; default: - log.error("Unknown type of record in transaction log which will be discarded: " + c); + LOG.error("Unknown type of record in transaction log which will be discarded: " + c); } } } Location location = writeTraceMessage("RECOVERED " + new Date(), true); asyncDataManager.setMark(location, true); long end = System.currentTimeMillis(); - log.info("Recovered " + redoCounter + " operations from redo log in " + ((end - start) / 1000.0f) + " seconds."); + LOG.info("Recovered " + redoCounter + " operations from redo log in " + ((end - start) / 1000.0f) + " seconds."); } private IOException createReadException(Location location, Exception e) { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapterFactory.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapterFactory.java index ff8b956fa6..cb11b27bb7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapterFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapterFactory.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.amq; import java.io.File; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java index 31a047a57c..bcdf528581 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.amq; import java.io.IOException; @@ -41,7 +43,7 @@ import org.apache.commons.logging.LogFactory; */ public class AMQTopicMessageStore extends AMQMessageStore implements TopicMessageStore { - private static final Log log = LogFactory.getLog(AMQTopicMessageStore.class); + private static final Log LOG = LogFactory.getLog(AMQTopicMessageStore.class); private TopicReferenceStore topicReferenceStore; private HashMap ackedLastAckLocations = new HashMap(); @@ -75,7 +77,7 @@ public class AMQTopicMessageStore extends AMQMessageStore implements TopicMessag /** */ public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, final MessageId messageId) throws IOException { - final boolean debug = log.isDebugEnabled(); + final boolean debug = LOG.isDebugEnabled(); JournalTopicAck ack = new JournalTopicAck(); ack.setDestination(destination); ack.setMessageId(messageId); @@ -87,12 +89,12 @@ public class AMQTopicMessageStore extends AMQMessageStore implements TopicMessag final SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName); if (!context.isInTransaction()) { if (debug) { - log.debug("Journalled acknowledge for: " + messageId + ", at: " + location); + LOG.debug("Journalled acknowledge for: " + messageId + ", at: " + location); } acknowledge(messageId, location, key); } else { if (debug) { - log.debug("Journalled transacted acknowledge for: " + messageId + ", at: " + location); + LOG.debug("Journalled transacted acknowledge for: " + messageId + ", at: " + location); } synchronized (this) { inFlightTxLocations.add(location); @@ -102,7 +104,7 @@ public class AMQTopicMessageStore extends AMQMessageStore implements TopicMessag public void afterCommit() throws Exception { if (debug) { - log.debug("Transacted acknowledge commit for: " + messageId + ", at: " + location); + LOG.debug("Transacted acknowledge commit for: " + messageId + ", at: " + location); } synchronized (AMQTopicMessageStore.this) { inFlightTxLocations.remove(location); @@ -112,7 +114,7 @@ public class AMQTopicMessageStore extends AMQMessageStore implements TopicMessag public void afterRollback() throws Exception { if (debug) { - log.debug("Transacted acknowledge rollback for: " + messageId + ", at: " + location); + LOG.debug("Transacted acknowledge rollback for: " + messageId + ", at: " + location); } synchronized (AMQTopicMessageStore.this) { inFlightTxLocations.remove(location); @@ -130,7 +132,7 @@ public class AMQTopicMessageStore extends AMQMessageStore implements TopicMessag return true; } } catch (Throwable e) { - log.debug("Could not replay acknowledge for message '" + messageId + "'. Message may have already been acknowledged. reason: " + e); + LOG.debug("Could not replay acknowledge for message '" + messageId + "'. Message may have already been acknowledged. reason: " + e); } return false; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTransactionStore.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTransactionStore.java index a1d061c4c9..e7d383514a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTransactionStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTransactionStore.java @@ -178,7 +178,7 @@ public class AMQTransactionStore implements TransactionStore { public void stop() throws Exception { } - synchronized public void recover(TransactionRecoveryListener listener) throws IOException { + public synchronized void recover(TransactionRecoveryListener listener) throws IOException { // All the in-flight transactions get rolled back.. synchronized (inflightTransactions) { inflightTransactions.clear(); diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/RecoveryListenerAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/RecoveryListenerAdapter.java index 97a21168f1..4a5edd2eb2 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/RecoveryListenerAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/RecoveryListenerAdapter.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.amq; import org.apache.activemq.command.Message; @@ -23,7 +25,7 @@ import org.apache.commons.logging.LogFactory; final class RecoveryListenerAdapter implements MessageRecoveryListener { - static final private Log log = LogFactory.getLog(RecoveryListenerAdapter.class); + private static final Log LOG = LogFactory.getLog(RecoveryListenerAdapter.class); private final MessageStore store; private final MessageRecoveryListener listener; private int count = 0; @@ -53,7 +55,7 @@ final class RecoveryListenerAdapter implements MessageRecoveryListener { if (message != null) { return recoverMessage(message); } else { - log.error("Message id " + ref + " could not be recovered from the data store!"); + LOG.error("Message id " + ref + " could not be recovered from the data store!"); } return false; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DatabaseLocker.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DatabaseLocker.java index 975cb0d2cc..d58bd4f6c7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DatabaseLocker.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DatabaseLocker.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -29,6 +29,6 @@ public interface DatabaseLocker extends Service { * Used by a timer to keep alive the lock. * If the method returns false the broker should be terminated */ - public boolean keepAlive(); + boolean keepAlive(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java index 2d1de6449c..3f8abc5dcc 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: $ */ public class DefaultDatabaseLocker implements DatabaseLocker { - private static final Log log = LogFactory.getLog(DefaultDatabaseLocker.class); + private static final Log LOG = LogFactory.getLog(DefaultDatabaseLocker.class); private final DataSource dataSource; private final Statements statements; private long sleepTime = 1000; @@ -48,7 +48,7 @@ public class DefaultDatabaseLocker implements DatabaseLocker { public void start() throws Exception { stopping = false; - log.info("Attempting to acquire the exclusive lock to become the Master broker"); + LOG.info("Attempting to acquire the exclusive lock to become the Master broker"); while (true) { try { @@ -62,12 +62,12 @@ public class DefaultDatabaseLocker implements DatabaseLocker { if (stopping) { throw new Exception("Cannot start broker as being asked to shut down. Interrupted attempt to acquire lock: " + e, e); } - log.error("Failed to acquire lock: " + e, e); + LOG.error("Failed to acquire lock: " + e, e); if (null != statement) { try { statement.close(); } catch (SQLException e1) { - log.warn("Caught while closing statement: " + e1, e1); + LOG.warn("Caught while closing statement: " + e1, e1); } statement = null; } @@ -75,17 +75,17 @@ public class DefaultDatabaseLocker implements DatabaseLocker { try { connection.close(); } catch (SQLException e1) { - log.warn("Caught while closing connection: " + e1, e1); + LOG.warn("Caught while closing connection: " + e1, e1); } connection = null; } } - log.debug("Sleeping for " + sleepTime + " milli(s) before trying again to get the lock..."); + LOG.debug("Sleeping for " + sleepTime + " milli(s) before trying again to get the lock..."); Thread.sleep(sleepTime); } - log.info("Becoming the master on dataSource: " + dataSource); + LOG.info("Becoming the master on dataSource: " + dataSource); } public void stop() throws Exception { @@ -105,7 +105,7 @@ public class DefaultDatabaseLocker implements DatabaseLocker { return true; } } catch (Exception e) { - log.error("Failed to update database lock: " + e, e); + LOG.error("Failed to update database lock: " + e, e); } return false; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java index f52764882f..a93c316353 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.jdbc; import java.io.IOException; @@ -26,85 +28,57 @@ import org.apache.activemq.command.SubscriptionInfo; */ public interface JDBCAdapter { - public void setStatements(Statements statementProvider); + void setStatements(Statements statementProvider); - public abstract void doCreateTables(TransactionContext c) throws SQLException, IOException; + void doCreateTables(TransactionContext c) throws SQLException, IOException; - public abstract void doDropTables(TransactionContext c) throws SQLException, IOException; + void doDropTables(TransactionContext c) throws SQLException, IOException; - public abstract void doAddMessage(TransactionContext c, MessageId messageID, - ActiveMQDestination destination, byte[] data, long expiration) - throws SQLException, IOException; + void doAddMessage(TransactionContext c, MessageId messageID, ActiveMQDestination destination, byte[] data, long expiration) throws SQLException, IOException; - public abstract void doAddMessageReference(TransactionContext c, MessageId messageId, - ActiveMQDestination destination, long expirationTime, - String messageRef) throws SQLException, IOException; + void doAddMessageReference(TransactionContext c, MessageId messageId, ActiveMQDestination destination, long expirationTime, String messageRef) throws SQLException, IOException; - public abstract byte[] doGetMessage(TransactionContext c, long seq) throws SQLException, IOException; + byte[] doGetMessage(TransactionContext c, long seq) throws SQLException, IOException; - public abstract String doGetMessageReference(TransactionContext c, long id) throws SQLException, - IOException; + String doGetMessageReference(TransactionContext c, long id) throws SQLException, IOException; - public abstract void doRemoveMessage(TransactionContext c, long seq) throws SQLException, IOException; + void doRemoveMessage(TransactionContext c, long seq) throws SQLException, IOException; - public abstract void doRecover(TransactionContext c, ActiveMQDestination destination, - JDBCMessageRecoveryListener listener) throws Exception; + void doRecover(TransactionContext c, ActiveMQDestination destination, JDBCMessageRecoveryListener listener) throws Exception; - public abstract void doSetLastAck(TransactionContext c, ActiveMQDestination destination, String clientId, - String subscriptionName, long seq) throws SQLException, IOException; + void doSetLastAck(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName, long seq) throws SQLException, IOException; - public abstract void doRecoverSubscription(TransactionContext c, ActiveMQDestination destination, - String clientId, String subscriptionName, - JDBCMessageRecoveryListener listener) throws Exception; - - public abstract void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, - String clientId, String subscriptionName, long seq, - int maxReturned, JDBCMessageRecoveryListener listener) + void doRecoverSubscription(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName, JDBCMessageRecoveryListener listener) throws Exception; - public abstract void doSetSubscriberEntry(TransactionContext c, SubscriptionInfo subscriptionInfo, - boolean retroactive) throws SQLException, IOException; + void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName, long seq, int maxReturned, + JDBCMessageRecoveryListener listener) throws Exception; - public abstract SubscriptionInfo doGetSubscriberEntry(TransactionContext c, - ActiveMQDestination destination, String clientId, - String subscriptionName) throws SQLException, - IOException; + void doSetSubscriberEntry(TransactionContext c, SubscriptionInfo subscriptionInfo, boolean retroactive) throws SQLException, IOException; - public abstract long getBrokerSequenceId(TransactionContext c, MessageId messageID) throws SQLException, - IOException; + SubscriptionInfo doGetSubscriberEntry(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName) throws SQLException, IOException; - public abstract void doRemoveAllMessages(TransactionContext c, ActiveMQDestination destinationName) - throws SQLException, IOException; + long getBrokerSequenceId(TransactionContext c, MessageId messageID) throws SQLException, IOException; - public abstract void doDeleteSubscription(TransactionContext c, ActiveMQDestination destinationName, - String clientId, String subscriptionName) throws SQLException, - IOException; + void doRemoveAllMessages(TransactionContext c, ActiveMQDestination destinationName) throws SQLException, IOException; - public abstract void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException; + void doDeleteSubscription(TransactionContext c, ActiveMQDestination destinationName, String clientId, String subscriptionName) throws SQLException, IOException; - public abstract long doGetLastMessageBrokerSequenceId(TransactionContext c) throws SQLException, - IOException; + void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException; - public abstract Set doGetDestinations(TransactionContext c) throws SQLException, IOException; + long doGetLastMessageBrokerSequenceId(TransactionContext c) throws SQLException, IOException; - public abstract void setUseExternalMessageReferences(boolean useExternalMessageReferences); + Set doGetDestinations(TransactionContext c) throws SQLException, IOException; - public abstract SubscriptionInfo[] doGetAllSubscriptions(TransactionContext c, - ActiveMQDestination destination) - throws SQLException, IOException; + void setUseExternalMessageReferences(boolean useExternalMessageReferences); - public int doGetDurableSubscriberMessageCount(TransactionContext c, ActiveMQDestination destination, - String clientId, String subscriptionName) - throws SQLException, IOException; + SubscriptionInfo[] doGetAllSubscriptions(TransactionContext c, ActiveMQDestination destination) throws SQLException, IOException; - public int doGetMessageCount(TransactionContext c, ActiveMQDestination destination) throws SQLException, - IOException; + int doGetDurableSubscriberMessageCount(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName) throws SQLException, IOException; - public void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, long nextSeq, - int maxReturned, JDBCMessageRecoveryListener listener) throws Exception; + int doGetMessageCount(TransactionContext c, ActiveMQDestination destination) throws SQLException, IOException; - public long doGetLastAckedDurableSubscriberMessageId(TransactionContext c, - ActiveMQDestination destination, String clientId, - String subscriberName) throws SQLException, - IOException; + void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, long nextSeq, int maxReturned, JDBCMessageRecoveryListener listener) throws Exception; + + long doGetLastAckedDurableSubscriberMessageId(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriberName) throws SQLException, IOException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java index 6ac529a42c..e10f91ec92 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java @@ -62,7 +62,7 @@ import org.apache.commons.logging.LogFactory; public class JDBCPersistenceAdapter extends DataSourceSupport implements PersistenceAdapter, BrokerServiceAware { - private static final Log log = LogFactory.getLog(JDBCPersistenceAdapter.class); + private static final Log LOG = LogFactory.getLog(JDBCPersistenceAdapter.class); private static FactoryFinder factoryFinder = new FactoryFinder( "META-INF/services/org/apache/activemq/store/jdbc/"); @@ -155,7 +155,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist try { getAdapter().doCreateTables(transactionContext); } catch (SQLException e) { - log.warn("Cannot create tables due to: " + e); + LOG.warn("Cannot create tables due to: " + e); JDBCPersistenceAdapter.log("Failure Details: ", e); } } finally { @@ -166,7 +166,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist if (isUseDatabaseLock()) { DatabaseLocker service = getDatabaseLocker(); if (service == null) { - log.warn("No databaseLocker configured for the JDBC Persistence Adapter"); + LOG.warn("No databaseLocker configured for the JDBC Persistence Adapter"); } else { service.start(); } @@ -202,13 +202,13 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist public void cleanup() { TransactionContext c = null; try { - log.debug("Cleaning up old messages."); + LOG.debug("Cleaning up old messages."); c = getTransactionContext(); getAdapter().doDeleteOldMessages(c); } catch (IOException e) { - log.warn("Old message cleanup failed due to: " + e, e); + LOG.warn("Old message cleanup failed due to: " + e, e); } catch (SQLException e) { - log.warn("Old message cleanup failed due to: " + e); + LOG.warn("Old message cleanup failed due to: " + e); JDBCPersistenceAdapter.log("Failure Details: ", e); } finally { if (c != null) { @@ -217,7 +217,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist } catch (Throwable e) { } } - log.debug("Cleanup done."); + LOG.debug("Cleanup done."); } } @@ -290,14 +290,14 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist try { adapter = (DefaultJDBCAdapter)factoryFinder.newInstance(dirverName); - log.info("Database driver recognized: [" + dirverName + "]"); + LOG.info("Database driver recognized: [" + dirverName + "]"); } catch (Throwable e) { - log.warn("Database driver NOT recognized: [" + dirverName + LOG.warn("Database driver NOT recognized: [" + dirverName + "]. Will use default JDBC implementation."); } } catch (SQLException e) { - log + LOG .warn("JDBC error occurred while trying to detect database type. Will use default JDBC implementation: " + e.getMessage()); JDBCPersistenceAdapter.log("Failure Details: ", e); @@ -417,13 +417,13 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist this.useDatabaseLock = useDatabaseLock; } - static public void log(String msg, SQLException e) { + public static void log(String msg, SQLException e) { String s = msg + e.getMessage(); while (e.getNextException() != null) { e = e.getNextException(); s += ", due to: " + e.getMessage(); } - log.debug(s, e); + LOG.debug(s, e); } public Statements getStatements() { @@ -454,7 +454,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist } } } catch (IOException e) { - log.error("Failed to get database when trying keepalive: " + e, e); + LOG.error("Failed to get database when trying keepalive: " + e, e); } if (stop) { stopBroker(); @@ -463,11 +463,11 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist protected void stopBroker() { // we can no longer keep the lock so lets fail - log.info("No longer able to keep the exclusive lock so giving up being a master"); + LOG.info("No longer able to keep the exclusive lock so giving up being a master"); try { brokerService.stop(); } catch (Exception e) { - log.warn("Failed to stop broker"); + LOG.warn("Failed to stop broker"); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java index cbe4d3dea7..564ed4f82f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java @@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory; */ public class TransactionContext { - private static final Log log = LogFactory.getLog(TransactionContext.class); + private static final Log LOG = LogFactory.getLog(TransactionContext.class); private final DataSource dataSource; private Connection connection; @@ -134,7 +134,7 @@ public class TransactionContext { connection.close(); } } catch (Throwable e) { - log.warn("Close failed: " + e.getMessage(), e); + LOG.warn("Close failed: " + e.getMessage(), e); } finally { connection = null; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/BytesJDBCAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/BytesJDBCAdapter.java index e13dce406f..4225e59a53 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/BytesJDBCAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/BytesJDBCAdapter.java @@ -21,30 +21,29 @@ import java.sql.ResultSet; import java.sql.SQLException; /** - * This JDBCAdapter inserts and extracts BLOB data using the - * setBytes()/getBytes() operations. - * - * The databases/JDBC drivers that use this adapter are: + * This JDBCAdapter inserts and extracts BLOB data using the + * setBytes()/getBytes() operations. The databases/JDBC drivers that use this + * adapter are: * * @org.apache.xbean.XBean element="bytesJDBCAdapter" - * * @version $Revision: 1.2 $ */ public class BytesJDBCAdapter extends DefaultJDBCAdapter { - /** - * @see org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter#getBinaryData(java.sql.ResultSet, int) + * @see org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter#getBinaryData(java.sql.ResultSet, + * int) */ protected byte[] getBinaryData(ResultSet rs, int index) throws SQLException { return rs.getBytes(index); } - + /** - * @see org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter#setBinaryData(java.sql.PreparedStatement, int, byte[]) + * @see org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter#setBinaryData(java.sql.PreparedStatement, + * int, byte[]) */ protected void setBinaryData(PreparedStatement s, int index, byte[] data) throws SQLException { s.setBytes(index, data); } - + } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java index 0b1726b8d6..c2eae01d16 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.jdbc.adapter; import java.io.IOException; @@ -50,7 +52,7 @@ import org.apache.commons.logging.LogFactory; */ public class DefaultJDBCAdapter implements JDBCAdapter { - private static final Log log = LogFactory.getLog(DefaultJDBCAdapter.class); + private static final Log LOG = LogFactory.getLog(DefaultJDBCAdapter.class); protected Statements statements; protected boolean batchStatments = true; @@ -87,15 +89,15 @@ public class DefaultJDBCAdapter implements JDBCAdapter { // This will fail usually since the tables will be // created already. try { - log.debug("Executing SQL: " + createStatments[i]); + LOG.debug("Executing SQL: " + createStatments[i]); boolean rc = s.execute(createStatments[i]); } catch (SQLException e) { if (alreadyExists) { - log.debug("Could not create JDBC tables; The message table already existed." + LOG.debug("Could not create JDBC tables; The message table already existed." + " Failure was: " + createStatments[i] + " Message: " + e.getMessage() + " SQLState: " + e.getSQLState() + " Vendor code: " + e.getErrorCode()); } else { - log.warn("Could not create JDBC tables; they could already exist." + " Failure was: " + LOG.warn("Could not create JDBC tables; they could already exist." + " Failure was: " + createStatments[i] + " Message: " + e.getMessage() + " SQLState: " + e.getSQLState() + " Vendor code: " + e.getErrorCode()); JDBCPersistenceAdapter.log("Failure details: ", e); @@ -122,7 +124,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter { try { boolean rc = s.execute(dropStatments[i]); } catch (SQLException e) { - log.warn("Could not drop JDBC tables; they may not exist." + " Failure was: " + LOG.warn("Could not drop JDBC tables; they may not exist." + " Failure was: " + dropStatments[i] + " Message: " + e.getMessage() + " SQLState: " + e.getSQLState() + " Vendor code: " + e.getErrorCode()); JDBCPersistenceAdapter.log("Failure details: ", e); @@ -564,11 +566,11 @@ public class DefaultJDBCAdapter implements JDBCAdapter { public void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException { PreparedStatement s = null; try { - log.debug("Executing SQL: " + statements.getDeleteOldMessagesStatement()); + LOG.debug("Executing SQL: " + statements.getDeleteOldMessagesStatement()); s = c.getConnection().prepareStatement(statements.getDeleteOldMessagesStatement()); s.setLong(1, System.currentTimeMillis()); int i = s.executeUpdate(); - log.debug("Deleted " + i + " old message(s)."); + LOG.debug("Deleted " + i + " old message(s)."); } finally { close(s); } @@ -600,14 +602,14 @@ public class DefaultJDBCAdapter implements JDBCAdapter { return result; } - static private void close(PreparedStatement s) { + private static void close(PreparedStatement s) { try { s.close(); } catch (Throwable e) { } } - static private void close(ResultSet rs) { + private static void close(ResultSet rs) { try { rs.close(); } catch (Throwable e) { @@ -710,7 +712,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter { if (listener.recoverMessageReference(rs.getString(1))) { count++; } else { - log.debug("Stopped recover next messages"); + LOG.debug("Stopped recover next messages"); } } } else { @@ -718,7 +720,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter { if (listener.recoverMessage(rs.getLong(1), getBinaryData(rs, 2))) { count++; } else { - log.debug("Stopped recover next messages"); + LOG.debug("Stopped recover next messages"); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/HsqldbJDBCAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/HsqldbJDBCAdapter.java index 2ada3e5b93..a104dc0c81 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/HsqldbJDBCAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/HsqldbJDBCAdapter.java @@ -19,14 +19,13 @@ package org.apache.activemq.store.jdbc.adapter; import org.apache.activemq.store.jdbc.Statements; /** - * * @version $Revision: 1.2 $ */ public class HsqldbJDBCAdapter extends BytesJDBCAdapter { - + public void setStatements(Statements statements) { statements.setBinaryDataType("OTHER"); super.setStatements(statements); } - + } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalMessageStore.java index 6d013520cc..22c83ac17d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalMessageStore.java @@ -66,8 +66,7 @@ public class JournalMessageStore implements MessageStore { private UsageManager usageManager; - public JournalMessageStore(JournalPersistenceAdapter adapter, MessageStore checkpointStore, - ActiveMQDestination destination) { + public JournalMessageStore(JournalPersistenceAdapter adapter, MessageStore checkpointStore, ActiveMQDestination destination) { this.peristenceAdapter = adapter; this.transactionStore = adapter.getTransactionStore(); this.longTermStore = checkpointStore; @@ -93,20 +92,23 @@ public class JournalMessageStore implements MessageStore { final RecordLocation location = peristenceAdapter.writeCommand(message, message.isResponseRequired()); if (!context.isInTransaction()) { - if (debug) + if (debug) { log.debug("Journalled message add for: " + id + ", at: " + location); + } addMessage(message, location); } else { - if (debug) + if (debug) { log.debug("Journalled transacted message add for: " + id + ", at: " + location); + } synchronized (this) { inFlightTxLocations.add(location); } transactionStore.addMessage(this, message, location); context.getTransaction().addSynchronization(new Synchronization() { public void afterCommit() throws Exception { - if (debug) + if (debug) { log.debug("Transacted message add commit for: " + id + ", at: " + location); + } synchronized (JournalMessageStore.this) { inFlightTxLocations.remove(location); addMessage(message, location); @@ -114,8 +116,9 @@ public class JournalMessageStore implements MessageStore { } public void afterRollback() throws Exception { - if (debug) + if (debug) { log.debug("Transacted message add rollback for: " + id + ", at: " + location); + } synchronized (JournalMessageStore.this) { inFlightTxLocations.remove(location); } @@ -141,8 +144,7 @@ public class JournalMessageStore implements MessageStore { longTermStore.addMessage(context, message); } } catch (Throwable e) { - log.warn("Could not replay add for message '" + message.getMessageId() - + "'. Message may have already been added. reason: " + e); + log.warn("Could not replay add for message '" + message.getMessageId() + "'. Message may have already been added. reason: " + e); } } @@ -156,22 +158,25 @@ public class JournalMessageStore implements MessageStore { final RecordLocation location = peristenceAdapter.writeCommand(remove, ack.isResponseRequired()); if (!context.isInTransaction()) { - if (debug) + if (debug) { log.debug("Journalled message remove for: " + ack.getLastMessageId() + ", at: " + location); + } removeMessage(ack, location); } else { - if (debug) + if (debug) { log.debug("Journalled transacted message remove for: " + ack.getLastMessageId() + ", at: " + location); + } synchronized (this) { inFlightTxLocations.add(location); } transactionStore.removeMessage(this, ack, location); context.getTransaction().addSynchronization(new Synchronization() { public void afterCommit() throws Exception { - if (debug) + if (debug) { log.debug("Transacted message remove commit for: " + ack.getLastMessageId() + ", at: " + location); + } synchronized (JournalMessageStore.this) { inFlightTxLocations.remove(location); removeMessage(ack, location); @@ -212,8 +217,7 @@ public class JournalMessageStore implements MessageStore { longTermStore.removeMessage(context, messageAck); } } catch (Throwable e) { - log.warn("Could not replay acknowledge for message '" + messageAck.getLastMessageId() - + "'. Message may have already been acknowledged. reason: " + e); + log.warn("Could not replay acknowledge for message '" + messageAck.getLastMessageId() + "'. Message may have already been acknowledged. reason: " + e); } } @@ -375,8 +379,7 @@ public class JournalMessageStore implements MessageStore { return destination; } - public void addMessageReference(ConnectionContext context, MessageId messageId, long expirationTime, - String messageRef) throws IOException { + public void addMessageReference(ConnectionContext context, MessageId messageId, long expirationTime, String messageRef) throws IOException { throw new IOException("The journal does not support message references."); } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java index de81fea6d4..5afc168a9e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java @@ -79,7 +79,7 @@ import org.apache.commons.logging.LogFactory; */ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEventListener, UsageListener { - private static final Log log = LogFactory.getLog(JournalPersistenceAdapter.class); + private static final Log LOG = LogFactory.getLog(JournalPersistenceAdapter.class); private final Journal journal; private final PersistenceAdapter longTermPersistence; @@ -233,8 +233,9 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve public void stop() throws Exception { this.usageManager.removeUsageListener(this); - if (!started.compareAndSet(true, false)) + if (!started.compareAndSet(true, false)) { return; + } Scheduler.cancel(periodicCheckpointTask); @@ -293,8 +294,9 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve */ public void checkpoint(boolean sync, boolean fullCheckpoint) { try { - if (journal == null) + if (journal == null) { throw new IllegalStateException("Journal is closed."); + } long now = System.currentTimeMillis(); CountDownLatch latch = null; @@ -309,12 +311,12 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve checkpointTask.wakeup(); if (sync) { - log.debug("Waking for checkpoint to complete."); + LOG.debug("Waking for checkpoint to complete."); latch.await(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); - log.warn("Request to start checkpoint failed: " + e, e); + LOG.warn("Request to start checkpoint failed: " + e, e); } } @@ -338,7 +340,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve } try { - log.debug("Checkpoint started."); + LOG.debug("Checkpoint started."); RecordLocation newMark = null; ArrayList futureTasks = new ArrayList(queues.size() + topics.size()); @@ -367,7 +369,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve futureTasks.add(task); checkpointExecutor.execute(task); } catch (Exception e) { - log.error("Failed to checkpoint a message store: " + e, e); + LOG.error("Failed to checkpoint a message store: " + e, e); } } } @@ -384,7 +386,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve futureTasks.add(task); checkpointExecutor.execute(task); } catch (Exception e) { - log.error("Failed to checkpoint a message store: " + e, e); + LOG.error("Failed to checkpoint a message store: " + e, e); } } @@ -400,17 +402,17 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve } } } catch (Throwable e) { - log.error("Failed to checkpoint a message store: " + e, e); + LOG.error("Failed to checkpoint a message store: " + e, e); } if (fullCheckpoint) { try { if (newMark != null) { - log.debug("Marking journal at: " + newMark); + LOG.debug("Marking journal at: " + newMark); journal.setMark(newMark, true); } } catch (Exception e) { - log.error("Failed to mark the Journal: " + e, e); + LOG.error("Failed to mark the Journal: " + e, e); } if (longTermPersistence instanceof JDBCPersistenceAdapter) { @@ -425,7 +427,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve } } - log.debug("Checkpoint done."); + LOG.debug("Checkpoint done."); } finally { latch.countDown(); } @@ -465,7 +467,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve RecordLocation pos = null; int transactionCounter = 0; - log.info("Journal Recovery Started from: " + journal); + LOG.info("Journal Recovery Started from: " + journal); ConnectionContext context = new ConnectionContext(); // While we have records in the journal. @@ -517,8 +519,9 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve case JournalTransaction.XA_COMMIT: case JournalTransaction.LOCAL_COMMIT: Tx tx = transactionStore.replayCommit(command.getTransactionId(), command.getWasPrepared()); - if (tx == null) + if (tx == null) { break; // We may be trying to replay a commit + } // that // was already committed. @@ -547,16 +550,16 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve throw new IOException("Invalid journal command type: " + command.getType()); } } catch (IOException e) { - log.error("Recovery Failure: Could not replay: " + c + ", reason: " + e, e); + LOG.error("Recovery Failure: Could not replay: " + c + ", reason: " + e, e); } } break; case JournalTrace.DATA_STRUCTURE_TYPE: JournalTrace trace = (JournalTrace)c; - log.debug("TRACE Entry: " + trace.getMessage()); + LOG.debug("TRACE Entry: " + trace.getMessage()); break; default: - log.error("Unknown type of record in transaction log which will be discarded: " + c); + LOG.error("Unknown type of record in transaction log which will be discarded: " + c); } } } @@ -564,7 +567,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve RecordLocation location = writeTraceMessage("RECOVERED", true); journal.setMark(location, true); - log.info("Journal Recovered: " + transactionCounter + " message(s) in transactions recovered."); + LOG.info("Journal Recovered: " + transactionCounter + " message(s) in transactions recovered."); } private IOException createReadException(RecordLocation location, Exception e) { @@ -590,8 +593,9 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve * @throws IOException */ public RecordLocation writeCommand(DataStructure command, boolean sync) throws IOException { - if (started.get()) + if (started.get()) { return journal.write(toPacket(wireFormat.marshal(command)), sync); + } throw new IOException("closed"); } @@ -620,7 +624,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve trace.setMessage("DELETED"); RecordLocation location = journal.write(toPacket(wireFormat.marshal(trace)), false); journal.setMark(location, true); - log.info("Journal deleted: "); + LOG.info("Journal deleted: "); } catch (IOException e) { throw e; } catch (Throwable e) { @@ -654,8 +658,9 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve } public void setUseExternalMessageReferences(boolean enable) { - if (enable) + if (enable) { throw new IllegalArgumentException("The journal does not support message references."); + } } public Packet toPacket(ByteSequence sequence) { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapterFactory.java b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapterFactory.java index ad45fd3f6b..62f30eddb9 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapterFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapterFactory.java @@ -41,7 +41,7 @@ public class JournalPersistenceAdapterFactory extends DataSourceSupport implemen private static final int JOURNAL_LOCKED_WAIT_DELAY = 10 * 1000; - private static final Log log = LogFactory.getLog(JournalPersistenceAdapterFactory.class); + private static final Log LOG = LogFactory.getLog(JournalPersistenceAdapterFactory.class); private int journalLogFileSize = 1024 * 1024 * 20; private int journalLogFiles = 2; @@ -222,7 +222,7 @@ public class JournalPersistenceAdapterFactory extends DataSourceSupport implemen getJournalArchiveDirectory()); break; } catch (JournalLockedException e) { - log.info("Journal is locked... waiting " + (JOURNAL_LOCKED_WAIT_DELAY / 1000) + LOG.info("Journal is locked... waiting " + (JOURNAL_LOCKED_WAIT_DELAY / 1000) + " seconds for the journal to be unlocked."); try { Thread.sleep(JOURNAL_LOCKED_WAIT_DELAY); diff --git a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalTopicMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalTopicMessageStore.java index 426dd3cb08..f4a4822439 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalTopicMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalTopicMessageStore.java @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; */ public class JournalTopicMessageStore extends JournalMessageStore implements TopicMessageStore { - private static final Log log = LogFactory.getLog(JournalTopicMessageStore.class); + private static final Log LOG = LogFactory.getLog(JournalTopicMessageStore.class); private TopicMessageStore longTermStore; private HashMap ackedLastAckLocations = new HashMap(); @@ -83,7 +83,7 @@ public class JournalTopicMessageStore extends JournalMessageStore implements Top */ public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, final MessageId messageId) throws IOException { - final boolean debug = log.isDebugEnabled(); + final boolean debug = LOG.isDebugEnabled(); JournalTopicAck ack = new JournalTopicAck(); ack.setDestination(destination); @@ -97,20 +97,23 @@ public class JournalTopicMessageStore extends JournalMessageStore implements Top final SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName); if (!context.isInTransaction()) { - if (debug) - log.debug("Journalled acknowledge for: " + messageId + ", at: " + location); + if (debug) { + LOG.debug("Journalled acknowledge for: " + messageId + ", at: " + location); + } acknowledge(messageId, location, key); } else { - if (debug) - log.debug("Journalled transacted acknowledge for: " + messageId + ", at: " + location); + if (debug) { + LOG.debug("Journalled transacted acknowledge for: " + messageId + ", at: " + location); + } synchronized (this) { inFlightTxLocations.add(location); } transactionStore.acknowledge(this, ack, location); context.getTransaction().addSynchronization(new Synchronization() { public void afterCommit() throws Exception { - if (debug) - log.debug("Transacted acknowledge commit for: " + messageId + ", at: " + location); + if (debug) { + LOG.debug("Transacted acknowledge commit for: " + messageId + ", at: " + location); + } synchronized (JournalTopicMessageStore.this) { inFlightTxLocations.remove(location); acknowledge(messageId, location, key); @@ -118,8 +121,9 @@ public class JournalTopicMessageStore extends JournalMessageStore implements Top } public void afterRollback() throws Exception { - if (debug) - log.debug("Transacted acknowledge rollback for: " + messageId + ", at: " + location); + if (debug) { + LOG.debug("Transacted acknowledge rollback for: " + messageId + ", at: " + location); + } synchronized (JournalTopicMessageStore.this) { inFlightTxLocations.remove(location); } @@ -137,7 +141,7 @@ public class JournalTopicMessageStore extends JournalMessageStore implements Top longTermStore.acknowledge(context, clientId, subscritionName, messageId); } } catch (Throwable e) { - log.debug("Could not replay acknowledge for message '" + messageId + LOG.debug("Could not replay acknowledge for message '" + messageId + "'. Message may have already been acknowledged. reason: " + e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalTransactionStore.java b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalTransactionStore.java index 2d7a305036..6f61881853 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalTransactionStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalTransactionStore.java @@ -133,8 +133,9 @@ public class JournalTransactionStore implements TransactionStore { synchronized (inflightTransactions) { tx = (Tx)inflightTransactions.remove(txid); } - if (tx == null) + if (tx == null) { return; + } peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.XA_PREPARE, txid, false), true); synchronized (preparedTransactions) { @@ -151,8 +152,9 @@ public class JournalTransactionStore implements TransactionStore { synchronized (inflightTransactions) { tx = (Tx)inflightTransactions.remove(txid); } - if (tx == null) + if (tx == null) { return; + } synchronized (preparedTransactions) { preparedTransactions.put(txid, tx); } @@ -185,8 +187,9 @@ public class JournalTransactionStore implements TransactionStore { tx = (Tx)inflightTransactions.remove(txid); } } - if (tx == null) + if (tx == null) { return; + } if (txid.isXATransaction()) { peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.XA_COMMIT, txid, wasPrepared), true); @@ -221,10 +224,11 @@ public class JournalTransactionStore implements TransactionStore { synchronized (inflightTransactions) { tx = (Tx)inflightTransactions.remove(txid); } - if (tx != null) + if (tx != null) { synchronized (preparedTransactions) { tx = (Tx)preparedTransactions.remove(txid); } + } if (tx != null) { if (txid.isXATransaction()) { peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.XA_ROLLBACK, txid, @@ -258,7 +262,7 @@ public class JournalTransactionStore implements TransactionStore { public void stop() throws Exception { } - synchronized public void recover(TransactionRecoveryListener listener) throws IOException { + public synchronized void recover(TransactionRecoveryListener listener) throws IOException { // All the in-flight transactions get rolled back.. synchronized (inflightTransactions) { inflightTransactions.clear(); diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ConsumerMessageRef.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ConsumerMessageRef.java index e2ba5b881a..5ec93004d7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ConsumerMessageRef.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ConsumerMessageRef.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.kahadaptor; import org.apache.activemq.command.MessageId; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaMessageStore.java index dca86cade9..c0037bad47 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaMessageStore.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.kahadaptor; import java.io.IOException; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java index d3fd13ab37..629cdcaea3 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.kahadaptor; import java.io.File; @@ -54,7 +56,7 @@ import org.apache.commons.logging.LogFactory; public class KahaPersistenceAdapter implements PersistenceAdapter { private static final int STORE_LOCKED_WAIT_DELAY = 10 * 1000; - private static final Log log = LogFactory.getLog(KahaPersistenceAdapter.class); + private static final Log LOG = LogFactory.getLog(KahaPersistenceAdapter.class); static final String PREPARED_TRANSACTIONS_NAME = "PreparedTransactions"; KahaTransactionStore transactionStore; ConcurrentHashMap topics = new ConcurrentHashMap(); @@ -79,7 +81,7 @@ public class KahaPersistenceAdapter implements PersistenceAdapter { } } } catch (IOException e) { - log.error("Failed to get destinations ", e); + LOG.error("Failed to get destinations ", e); } return rc; } @@ -136,7 +138,7 @@ public class KahaPersistenceAdapter implements PersistenceAdapter { transactionStore = new KahaTransactionStore(this, container); break; } catch (StoreLockedExcpetion e) { - log.info("Store is locked... waiting " + (STORE_LOCKED_WAIT_DELAY / 1000) + LOG.info("Store is locked... waiting " + (STORE_LOCKED_WAIT_DELAY / 1000) + " seconds for the Store to be unlocked."); try { Thread.sleep(STORE_LOCKED_WAIT_DELAY); @@ -200,7 +202,7 @@ public class KahaPersistenceAdapter implements PersistenceAdapter { throws IOException { Store store = getStore(); MapContainer container = store.getMapContainer(id, containerName); - container.setKeyMarshaller(Store.StringMarshaller); + container.setKeyMarshaller(Store.STRING_MARSHALLER); container.setValueMarshaller(createMessageMarshaller()); container.load(); return container; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStore.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStore.java index 12bc3eb834..338cfdbbb6 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStore.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.kahadaptor; import java.io.IOException; @@ -115,8 +117,9 @@ public class KahaReferenceStore implements ReferenceStore { public synchronized ReferenceData getMessageReference(MessageId identity) throws IOException { ReferenceRecord result = messageContainer.get(identity); - if (result == null) + if (result == null) { return null; + } return result.getData(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java index 0cd58da673..99c9e350cc 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java @@ -48,7 +48,7 @@ import org.apache.commons.logging.LogFactory; public class KahaReferenceStoreAdapter extends KahaPersistenceAdapter implements ReferenceStoreAdapter { - private static final Log log = LogFactory.getLog(KahaPersistenceAdapter.class); + private static final Log LOG = LogFactory.getLog(KahaPersistenceAdapter.class); private static final String STORE_STATE = "store-state"; private static final String RECORD_REFERENCES = "record-references"; private static final String TRANSACTIONS = "transactions-state"; @@ -91,7 +91,7 @@ public class KahaReferenceStoreAdapter extends KahaPersistenceAdapter implements durableSubscribers.setMarshaller(new CommandMarshaller()); preparedTransactions = store.getMapContainer("transactions", TRANSACTIONS, false); // need to set the Marshallers here - preparedTransactions.setKeyMarshaller(Store.CommandMarshaller); + preparedTransactions.setKeyMarshaller(Store.COMMAND_MARSHALLER); preparedTransactions.setValueMarshaller(new AMQTxMarshaller(wireFormat)); } @@ -274,7 +274,7 @@ public class KahaReferenceStoreAdapter extends KahaPersistenceAdapter implements try { return StoreFactory.open(stateDirectory.getAbsolutePath(), "rw"); } catch (IOException e) { - log.error("Failed to create the state store", e); + LOG.error("Failed to create the state store", e); } return null; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicMessageStore.java index a4fcdc2553..ce477657d8 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicMessageStore.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.kahadaptor; import java.io.IOException; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java index 4379ff5d13..5af8420aa4 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.kahadaptor; import java.io.IOException; @@ -90,8 +92,9 @@ public class KahaTopicReferenceStore extends KahaReferenceStore implements Topic public ReferenceData getMessageReference(final MessageId identity) throws IOException { final ReferenceRecord result = messageContainer.get(identity); - if (result == null) + if (result == null) { return null; + } return result.getData(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTransaction.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTransaction.java index 62c7f42899..28116dd3e6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTransaction.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTransaction.java @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.4 $ */ class KahaTransaction { - private static final Log log = LogFactory.getLog(KahaTransaction.class); + private static final Log LOG = LogFactory.getLog(KahaTransaction.class); protected List list = new ArrayList(); void add(KahaMessageStore store, BaseCommand command) { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTransactionStore.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTransactionStore.java index c2387d56ed..04fac2bfc7 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTransactionStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTransactionStore.java @@ -116,7 +116,7 @@ public class KahaTransactionStore implements TransactionStore { public void stop() throws Exception { } - synchronized public void recover(TransactionRecoveryListener listener) throws IOException { + public synchronized void recover(TransactionRecoveryListener listener) throws IOException { for (Iterator i = prepared.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Entry)i.next(); XATransactionId xid = (XATransactionId)entry.getKey(); diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ReferenceRecord.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ReferenceRecord.java index 645400ceae..cbe5e21316 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ReferenceRecord.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ReferenceRecord.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.kahadaptor; import org.apache.activemq.store.ReferenceStore.ReferenceData; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ReferenceRecordMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ReferenceRecordMarshaller.java index c8aca03629..9a2857baa2 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ReferenceRecordMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/ReferenceRecordMarshaller.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.kahadaptor; import java.io.DataInput; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubAck.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubAck.java index 403e49b369..b97faa303b 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubAck.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubAck.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.kahadaptor; import org.apache.activemq.kaha.StoreEntry; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubContainer.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubContainer.java index f764738258..dc394479a0 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubContainer.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubContainer.java @@ -1,15 +1,18 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.store.kahadaptor; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryMessageStore.java index 2aa3cd2c59..8a7541b342 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryMessageStore.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.memory; import java.io.IOException; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java index 9996bb8bdc..42284d1324 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java @@ -39,7 +39,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.4 $ */ public class MemoryPersistenceAdapter implements PersistenceAdapter { - private static final Log log = LogFactory.getLog(MemoryPersistenceAdapter.class); + private static final Log LOG = LogFactory.getLog(MemoryPersistenceAdapter.class); MemoryTransactionStore transactionStore; ConcurrentHashMap topics = new ConcurrentHashMap(); @@ -142,7 +142,7 @@ public class MemoryPersistenceAdapter implements PersistenceAdapter { if (value instanceof MemoryMessageStore) { return (MemoryMessageStore)value; } - log.warn("Expected an instance of MemoryMessageStore but was: " + value); + LOG.warn("Expected an instance of MemoryMessageStore but was: " + value); return null; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTopicMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTopicMessageStore.java index 9f9dd3680c..cca1f3f9e0 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTopicMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTopicMessageStore.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.memory; import java.io.IOException; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTopicSub.java b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTopicSub.java index df5ba42583..ab8860921c 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTopicSub.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTopicSub.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.store.memory; import java.util.Iterator; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTransactionStore.java b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTransactionStore.java index 46a1bd7cf1..f7a82dfaed 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTransactionStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryTransactionStore.java @@ -140,8 +140,9 @@ public class MemoryTransactionStore implements TransactionStore { */ public void prepare(TransactionId txid) { Tx tx = (Tx)inflightTransactions.remove(txid); - if (tx == null) + if (tx == null) { return; + } preparedTransactions.put(txid, tx); } @@ -167,8 +168,9 @@ public class MemoryTransactionStore implements TransactionStore { tx = (Tx)inflightTransactions.remove(txid); } - if (tx == null) + if (tx == null) { return; + } tx.commit(); } @@ -187,7 +189,7 @@ public class MemoryTransactionStore implements TransactionStore { public void stop() throws Exception { } - synchronized public void recover(TransactionRecoveryListener listener) throws IOException { + public synchronized void recover(TransactionRecoveryListener listener) throws IOException { // All the inflight transactions get rolled back.. inflightTransactions.clear(); this.doingRecover = true; @@ -208,8 +210,9 @@ public class MemoryTransactionStore implements TransactionStore { */ void addMessage(final MessageStore destination, final Message message) throws IOException { - if (doingRecover) + if (doingRecover) { return; + } if (message.getTransactionId() != null) { Tx tx = getTx(message.getTransactionId()); @@ -232,8 +235,9 @@ public class MemoryTransactionStore implements TransactionStore { * @throws IOException */ final void removeMessage(final MessageStore destination, final MessageAck ack) throws IOException { - if (doingRecover) + if (doingRecover) { return; + } if (ack.isInTransaction()) { Tx tx = getTx(ack.getTransactionId()); diff --git a/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java b/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java index f035216068..ed6d26b2fd 100644 --- a/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java +++ b/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java @@ -46,8 +46,9 @@ class DedicatedTaskRunner implements TaskRunner { */ public void wakeup() throws InterruptedException { synchronized (mutex) { - if (shutdown) + if (shutdown) { return; + } pending = true; mutex.notifyAll(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/thread/DefaultThreadPools.java b/activemq-core/src/main/java/org/apache/activemq/thread/DefaultThreadPools.java index 1e1b2089e2..1ed747f63d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/thread/DefaultThreadPools.java +++ b/activemq-core/src/main/java/org/apache/activemq/thread/DefaultThreadPools.java @@ -26,9 +26,9 @@ import java.util.concurrent.ThreadFactory; */ public class DefaultThreadPools { - private static final Executor defaultPool; + private static final Executor DEFAULT_POOL; static { - defaultPool = new ScheduledThreadPoolExecutor(5, new ThreadFactory() { + DEFAULT_POOL = new ScheduledThreadPoolExecutor(5, new ThreadFactory() { public Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable, "ActiveMQ Default Thread Pool Thread"); thread.setDaemon(true); @@ -37,14 +37,14 @@ public class DefaultThreadPools { }); } - private static final TaskRunnerFactory defaultTaskRunnerFactory = new TaskRunnerFactory(); + private static final TaskRunnerFactory DEFAULT_TASK_RUNNER_FACTORY = new TaskRunnerFactory(); public static Executor getDefaultPool() { - return defaultPool; + return DEFAULT_POOL; } public static TaskRunnerFactory getDefaultTaskRunnerFactory() { - return defaultTaskRunnerFactory; + return DEFAULT_TASK_RUNNER_FACTORY; } } diff --git a/activemq-core/src/main/java/org/apache/activemq/thread/PooledTaskRunner.java b/activemq-core/src/main/java/org/apache/activemq/thread/PooledTaskRunner.java index ae159c92d2..1f22e56237 100644 --- a/activemq-core/src/main/java/org/apache/activemq/thread/PooledTaskRunner.java +++ b/activemq-core/src/main/java/org/apache/activemq/thread/PooledTaskRunner.java @@ -61,8 +61,9 @@ class PooledTaskRunner implements TaskRunner { // queued=true, iterating=true : wakeup() called after task // execution was started. - if (queued || shutdown) + if (queued || shutdown) { return; + } queued = true; @@ -130,8 +131,9 @@ class PooledTaskRunner implements TaskRunner { // If we could not iterate all the items // then we need to re-queue. - if (!done) + if (!done) { queued = true; + } if (queued) { executor.execute(runable); diff --git a/activemq-core/src/main/java/org/apache/activemq/thread/Scheduler.java b/activemq-core/src/main/java/org/apache/activemq/thread/Scheduler.java index 91368c99be..d94c55b59b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/thread/Scheduler.java +++ b/activemq-core/src/main/java/org/apache/activemq/thread/Scheduler.java @@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit; */ public class Scheduler { - public static final ScheduledThreadPoolExecutor clockDaemon = new ScheduledThreadPoolExecutor(5, new ThreadFactory() { + public static final ScheduledThreadPoolExecutor CLOCK_DAEMON = new ScheduledThreadPoolExecutor(5, new ThreadFactory() { public Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable, "ActiveMQ Scheduler"); thread.setDaemon(true); @@ -36,27 +36,27 @@ public class Scheduler { } }); static { - clockDaemon.setKeepAliveTime(5, TimeUnit.SECONDS); + CLOCK_DAEMON.setKeepAliveTime(5, TimeUnit.SECONDS); } - static HashMap clockTickets = new HashMap(); + private static final HashMap CLOCK_TICKETS = new HashMap(); - synchronized static public void executePeriodically(final Runnable task, long period) { - ScheduledFuture ticket = clockDaemon.scheduleAtFixedRate(task, period, period, TimeUnit.MILLISECONDS); - clockTickets.put(task, ticket); + public static synchronized void executePeriodically(final Runnable task, long period) { + ScheduledFuture ticket = CLOCK_DAEMON.scheduleAtFixedRate(task, period, period, TimeUnit.MILLISECONDS); + CLOCK_TICKETS.put(task, ticket); } - synchronized static public void cancel(Runnable task) { - ScheduledFuture ticket = (ScheduledFuture)clockTickets.remove(task); + public static synchronized void cancel(Runnable task) { + ScheduledFuture ticket = (ScheduledFuture)CLOCK_TICKETS.remove(task); if (ticket != null) { ticket.cancel(false); - - if (ticket instanceof Runnable) - clockDaemon.remove((Runnable)ticket); + if (ticket instanceof Runnable) { + CLOCK_DAEMON.remove((Runnable)ticket); + } } } public static void executeAfterDelay(final Runnable task, long redeliveryDelay) { - clockDaemon.schedule(task, redeliveryDelay, TimeUnit.MILLISECONDS); + CLOCK_DAEMON.schedule(task, redeliveryDelay, TimeUnit.MILLISECONDS); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/thread/Task.java b/activemq-core/src/main/java/org/apache/activemq/thread/Task.java index 7ffeda2a46..0626eff3c0 100755 --- a/activemq-core/src/main/java/org/apache/activemq/thread/Task.java +++ b/activemq-core/src/main/java/org/apache/activemq/thread/Task.java @@ -22,5 +22,5 @@ package org.apache.activemq.thread; * @version $Revision: 1.3 $ */ public interface Task { - public boolean iterate(); + boolean iterate(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/thread/TaskRunner.java b/activemq-core/src/main/java/org/apache/activemq/thread/TaskRunner.java index fa4c88846f..fc97872f68 100755 --- a/activemq-core/src/main/java/org/apache/activemq/thread/TaskRunner.java +++ b/activemq-core/src/main/java/org/apache/activemq/thread/TaskRunner.java @@ -22,7 +22,7 @@ package org.apache.activemq.thread; * @version $Revision: 1.3 $ */ public interface TaskRunner { - public abstract void wakeup() throws InterruptedException; - public abstract void shutdown() throws InterruptedException; - public abstract void shutdown(long timeout) throws InterruptedException; + void wakeup() throws InterruptedException; + void shutdown() throws InterruptedException; + void shutdown(long timeout) throws InterruptedException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/thread/Valve.java b/activemq-core/src/main/java/org/apache/activemq/thread/Valve.java index 492dbccce8..d3139c6364 100755 --- a/activemq-core/src/main/java/org/apache/activemq/thread/Valve.java +++ b/activemq-core/src/main/java/org/apache/activemq/thread/Valve.java @@ -22,7 +22,7 @@ package org.apache.activemq.thread; * * @version $Revision: 1.2 $ */ -final public class Valve { +public final class Valve { private final Object mutex = new Object(); private boolean on; diff --git a/activemq-core/src/main/java/org/apache/activemq/transaction/LocalTransaction.java b/activemq-core/src/main/java/org/apache/activemq/transaction/LocalTransaction.java index 610bbea09e..f5c548c074 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transaction/LocalTransaction.java +++ b/activemq-core/src/main/java/org/apache/activemq/transaction/LocalTransaction.java @@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory; */ public class LocalTransaction extends Transaction { - private static final Log log = LogFactory.getLog(LocalTransaction.class); + private static final Log LOG = LogFactory.getLog(LocalTransaction.class); private final TransactionStore transactionStore; private final LocalTransactionId xid; @@ -51,7 +51,7 @@ public class LocalTransaction extends Transaction { } catch (XAException e) { throw e; } catch (Throwable e) { - log.warn("COMMIT FAILED: ", e); + LOG.warn("COMMIT FAILED: ", e); rollback(); // Let them know we rolled back. XAException xae = new XAException("COMMIT FAILED: Transaction rolled back."); @@ -69,7 +69,7 @@ public class LocalTransaction extends Transaction { } catch (Throwable e) { // I guess this could happen. Post commit task failed // to execute properly. - log.warn("POST COMMIT FAILED: ", e); + LOG.warn("POST COMMIT FAILED: ", e); XAException xae = new XAException("POST COMMIT FAILED"); xae.errorCode = XAException.XAER_RMERR; xae.initCause(e); @@ -86,7 +86,7 @@ public class LocalTransaction extends Transaction { try { fireAfterRollback(); } catch (Throwable e) { - log.warn("POST ROLLBACK FAILED: ", e); + LOG.warn("POST ROLLBACK FAILED: ", e); XAException xae = new XAException("POST ROLLBACK FAILED"); xae.errorCode = XAException.XAER_RMERR; xae.initCause(e); diff --git a/activemq-core/src/main/java/org/apache/activemq/transaction/Transaction.java b/activemq-core/src/main/java/org/apache/activemq/transaction/Transaction.java index 5460483061..b57532eccd 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transaction/Transaction.java +++ b/activemq-core/src/main/java/org/apache/activemq/transaction/Transaction.java @@ -32,10 +32,10 @@ import org.apache.activemq.command.TransactionId; */ public abstract class Transaction { - static final public byte START_STATE = 0; // can go to: 1,2,3 - static final public byte IN_USE_STATE = 1; // can go to: 2,3 - static final public byte PREPARED_STATE = 2; // can go to: 3 - static final public byte FINISHED_STATE = 3; + public static final byte START_STATE = 0; // can go to: 1,2,3 + public static final byte IN_USE_STATE = 1; // can go to: 2,3 + public static final byte PREPARED_STATE = 2; // can go to: 3 + public static final byte FINISHED_STATE = 3; private ArrayList synchronizations = new ArrayList(); private byte state = START_STATE; @@ -98,13 +98,13 @@ public abstract class Transaction { return super.toString() + "[synchronizations=" + synchronizations + "]"; } - abstract public void commit(boolean onePhase) throws XAException, IOException; + public abstract void commit(boolean onePhase) throws XAException, IOException; - abstract public void rollback() throws XAException, IOException; + public abstract void rollback() throws XAException, IOException; - abstract public int prepare() throws XAException, IOException; + public abstract int prepare() throws XAException, IOException; - abstract public TransactionId getTransactionId(); + public abstract TransactionId getTransactionId(); public boolean isPrepared() { return getState() == PREPARED_STATE; diff --git a/activemq-core/src/main/java/org/apache/activemq/transaction/XATransaction.java b/activemq-core/src/main/java/org/apache/activemq/transaction/XATransaction.java index d629fd2100..c9feebee95 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transaction/XATransaction.java +++ b/activemq-core/src/main/java/org/apache/activemq/transaction/XATransaction.java @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; */ public class XATransaction extends Transaction { - private static final Log log = LogFactory.getLog(XATransaction.class); + private static final Log LOG = LogFactory.getLog(XATransaction.class); private final TransactionStore transactionStore; private final XATransactionId xid; @@ -46,8 +46,9 @@ public class XATransaction extends Transaction { } public void commit(boolean onePhase) throws XAException, IOException { - if (log.isDebugEnabled()) - log.debug("XA Transaction commit: " + xid); + if (LOG.isDebugEnabled()) { + LOG.debug("XA Transaction commit: " + xid); + } switch (getState()) { case START_STATE: @@ -95,7 +96,7 @@ public class XATransaction extends Transaction { } catch (XAException e) { throw e; } catch (Throwable e) { - log.warn("PRE-PREPARE FAILED: ", e); + LOG.warn("PRE-PREPARE FAILED: ", e); rollback(); XAException xae = new XAException("PRE-PREPARE FAILED: Transaction rolled back."); xae.errorCode = XAException.XA_RBOTHER; @@ -110,7 +111,7 @@ public class XATransaction extends Transaction { } catch (Throwable e) { // I guess this could happen. Post commit task failed // to execute properly. - log.warn("POST COMMIT FAILED: ", e); + LOG.warn("POST COMMIT FAILED: ", e); XAException xae = new XAException("POST COMMIT FAILED"); xae.errorCode = XAException.XAER_RMERR; xae.initCause(e); @@ -120,8 +121,9 @@ public class XATransaction extends Transaction { public void rollback() throws XAException, IOException { - if (log.isDebugEnabled()) - log.debug("XA Transaction rollback: " + xid); + if (LOG.isDebugEnabled()) { + LOG.debug("XA Transaction rollback: " + xid); + } switch (getState()) { case START_STATE: @@ -152,7 +154,7 @@ public class XATransaction extends Transaction { } catch (Throwable e) { // I guess this could happen. Post commit task failed // to execute properly. - log.warn("POST ROLLBACK FAILED: ", e); + LOG.warn("POST ROLLBACK FAILED: ", e); XAException xae = new XAException("POST ROLLBACK FAILED"); xae.errorCode = XAException.XAER_RMERR; xae.initCause(e); @@ -161,8 +163,9 @@ public class XATransaction extends Transaction { } public int prepare() throws XAException, IOException { - if (log.isDebugEnabled()) - log.debug("XA Transaction prepare: " + xid); + if (LOG.isDebugEnabled()) { + LOG.debug("XA Transaction prepare: " + xid); + } switch (getState()) { case START_STATE: diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/CommandJoiner.java b/activemq-core/src/main/java/org/apache/activemq/transport/CommandJoiner.java index 00faaeb2c0..7d5a6208b5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/CommandJoiner.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/CommandJoiner.java @@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class CommandJoiner extends TransportFilter { - private static final Log log = LogFactory.getLog(CommandJoiner.class); + private static final Log LOG = LogFactory.getLog(CommandJoiner.class); private ByteArrayOutputStream out = new ByteArrayOutputStream(); private OpenWireFormat wireFormat; @@ -68,7 +68,7 @@ public class CommandJoiner extends TransportFilter { getTransportListener().onCommand(completeCommand); } catch (IOException e) { - log.warn("Failed to unmarshal partial command: " + command); + LOG.warn("Failed to unmarshal partial command: " + command); getTransportListener().onException(e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/CompositeTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/CompositeTransport.java index 7fcad68538..06d4146204 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/CompositeTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/CompositeTransport.java @@ -19,6 +19,6 @@ package org.apache.activemq.transport; import java.net.URI; public interface CompositeTransport extends Transport { - public void add(URI[] uris); - public void remove(URI[] uris); + void add(URI[] uris); + void remove(URI[] uris); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java b/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java index ffc23247be..d16ff1ee9d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java @@ -26,7 +26,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class FutureResponse { - private static final Log log = LogFactory.getLog(FutureResponse.class); + private static final Log LOG = LogFactory.getLog(FutureResponse.class); private final ResponseCallback responseCallback; private final ArrayBlockingQueue responseSlot = new ArrayBlockingQueue(1); @@ -40,8 +40,8 @@ public class FutureResponse { return (Response)responseSlot.take(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - if (log.isDebugEnabled()) { - log.debug("Operation interupted: " + e, e); + if (LOG.isDebugEnabled()) { + LOG.debug("Operation interupted: " + e, e); } throw new InterruptedIOException("Interrupted."); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java b/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java index 7d3e5518ee..c64503de4c 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; */ public class InactivityMonitor extends TransportFilter { - private final Log LOG = LogFactory.getLog(InactivityMonitor.class); + private static final Log LOG = LogFactory.getLog(InactivityMonitor.class); private WireFormatInfo localWireFormatInfo; private WireFormatInfo remoteWireFormatInfo; @@ -155,13 +155,16 @@ public class InactivityMonitor extends TransportFilter { getTransportListener().onException(error); } - synchronized private void startMonitorThreads() throws IOException { - if (monitorStarted.get()) + private synchronized void startMonitorThreads() throws IOException { + if (monitorStarted.get()) { return; - if (localWireFormatInfo == null) + } + if (localWireFormatInfo == null) { return; - if (remoteWireFormatInfo == null) + } + if (remoteWireFormatInfo == null) { return; + } long l = Math.min(localWireFormatInfo.getMaxInactivityDuration(), remoteWireFormatInfo.getMaxInactivityDuration()); if (l > 0) { @@ -174,7 +177,7 @@ public class InactivityMonitor extends TransportFilter { /** * */ - synchronized private void stopMonitorThreads() { + private synchronized void stopMonitorThreads() { if (monitorStarted.compareAndSet(true, false)) { Scheduler.cancel(readChecker); Scheduler.cancel(writeChecker); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java b/activemq-core/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java index c131e84c26..51ada4e955 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.transport; import java.io.IOException; @@ -90,8 +92,9 @@ public class ResponseCorrelator extends TransportFilter { if (future != null) { future.set(response); } else { - if (debug) + if (debug) { LOG.debug("Received unexpected response for command id: " + response.getCorrelationId()); + } } } else { getTransportListener().onCommand(command); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/Transport.java b/activemq-core/src/main/java/org/apache/activemq/transport/Transport.java index eb62663723..01c51c64ce 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/Transport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/Transport.java @@ -34,7 +34,7 @@ public interface Transport extends Service { * @param command * @throws IOException */ - public void oneway(Object command) throws IOException; + void oneway(Object command) throws IOException; /** * An asynchronous request response where the Receipt will be returned in @@ -46,7 +46,7 @@ public interface Transport extends Service { * @return the FutureResponse * @throws IOException */ - public FutureResponse asyncRequest(Object command, ResponseCallback responseCallback) throws IOException; + FutureResponse asyncRequest(Object command, ResponseCallback responseCallback) throws IOException; /** * A synchronous request response @@ -55,7 +55,7 @@ public interface Transport extends Service { * @return the response * @throws IOException */ - public Object request(Object command) throws IOException; + Object request(Object command) throws IOException; /** * A synchronous request response @@ -65,14 +65,14 @@ public interface Transport extends Service { * @return the repsonse or null if timeout * @throws IOException */ - public Object request(Object command, int timeout) throws IOException; + Object request(Object command, int timeout) throws IOException; // /** // * A one way asynchronous send // * @param command // * @throws IOException // */ - // public void oneway(Command command) throws IOException; + // void oneway(Command command) throws IOException; // // /** // * An asynchronous request response where the Receipt will be returned @@ -84,7 +84,7 @@ public interface Transport extends Service { // * @return the FutureResponse // * @throws IOException // */ - // public FutureResponse asyncRequest(Command command, ResponseCallback + // FutureResponse asyncRequest(Command command, ResponseCallback // responseCallback) throws IOException; // // /** @@ -93,7 +93,7 @@ public interface Transport extends Service { // * @return the response // * @throws IOException // */ - // public Response request(Command command) throws IOException; + // Response request(Command command) throws IOException; // // /** // * A synchronous request response @@ -102,38 +102,38 @@ public interface Transport extends Service { // * @return the repsonse or null if timeout // * @throws IOException // */ - // public Response request(Command command, int timeout) throws IOException; + // Response request(Command command, int timeout) throws IOException; /** * Returns the current transport listener * * @return */ - public TransportListener getTransportListener(); + TransportListener getTransportListener(); /** * Registers an inbound command listener * * @param commandListener */ - public void setTransportListener(TransportListener commandListener); + void setTransportListener(TransportListener commandListener); /** * @param target * @return the target */ - public Object narrow(Class target); + Object narrow(Class target); /** * @return the remote address for this connection */ - public String getRemoteAddress(); + String getRemoteAddress(); /** * Indicates if the transport can handle faults * * @return tru if fault tolerant */ - public boolean isFaultTolerant(); + boolean isFaultTolerant(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java index f284ea6582..eff627cd68 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java @@ -45,10 +45,10 @@ public abstract class TransportFactory { return doCompositeConnect(location); } - static final private FactoryFinder transportFactoryFinder = new FactoryFinder("META-INF/services/org/apache/activemq/transport/"); - static final private FactoryFinder wireFormatFactoryFinder = new FactoryFinder("META-INF/services/org/apache/activemq/wireformat/"); + private static final FactoryFinder TRANSPORT_FACTORY_FINDER = new FactoryFinder("META-INF/services/org/apache/activemq/transport/"); + private static final FactoryFinder WIREFORMAT_FACTORY_FINDER = new FactoryFinder("META-INF/services/org/apache/activemq/wireformat/"); - static final private ConcurrentHashMap transportFactorys = new ConcurrentHashMap(); + private static final ConcurrentHashMap TRANSPORT_FACTORYS = new ConcurrentHashMap(); /** * Creates a normal transport. @@ -155,14 +155,15 @@ public abstract class TransportFactory { */ private static TransportFactory findTransportFactory(URI location) throws IOException { String scheme = location.getScheme(); - if (scheme == null) + if (scheme == null) { throw new IOException("Transport not scheme specified: [" + location + "]"); - TransportFactory tf = (TransportFactory)transportFactorys.get(scheme); + } + TransportFactory tf = (TransportFactory)TRANSPORT_FACTORYS.get(scheme); if (tf == null) { // Try to load if from a META-INF property. try { - tf = (TransportFactory)transportFactoryFinder.newInstance(scheme); - transportFactorys.put(scheme, tf); + tf = (TransportFactory)TRANSPORT_FACTORY_FINDER.newInstance(scheme); + TRANSPORT_FACTORYS.put(scheme, tf); } catch (Throwable e) { throw IOExceptionSupport.create("Transport scheme NOT recognized: [" + scheme + "]", e); } @@ -178,11 +179,12 @@ public abstract class TransportFactory { protected WireFormatFactory createWireFormatFactory(Map options) throws IOException { String wireFormat = (String)options.get("wireFormat"); - if (wireFormat == null) + if (wireFormat == null) { wireFormat = getDefaultWireFormatType(); + } try { - WireFormatFactory wff = (WireFormatFactory)wireFormatFactoryFinder.newInstance(wireFormat); + WireFormatFactory wff = (WireFormatFactory)WIREFORMAT_FACTORY_FINDER.newInstance(wireFormat); IntrospectionSupport.setProperties(wff, options, "wireFormat."); return wff; } catch (Throwable e) { diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/TransportFilter.java b/activemq-core/src/main/java/org/apache/activemq/transport/TransportFilter.java index 444e8a9533..8330a980bd 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/TransportFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/TransportFilter.java @@ -22,7 +22,7 @@ import java.io.IOException; * @version $Revision: 1.5 $ */ public class TransportFilter implements TransportListener, Transport { - final protected Transport next; + protected final Transport next; protected TransportListener transportListener; public TransportFilter(Transport next) { @@ -35,10 +35,11 @@ public class TransportFilter implements TransportListener, Transport { public void setTransportListener(TransportListener channelListener) { this.transportListener = channelListener; - if (channelListener == null) + if (channelListener == null) { next.setTransportListener(null); - else + } else { next.setTransportListener(this); + } } /** @@ -46,10 +47,12 @@ public class TransportFilter implements TransportListener, Transport { * @throws IOException if the next channel has not been set. */ public void start() throws Exception { - if (next == null) + if (next == null) { throw new IOException("The next channel has not been set."); - if (transportListener == null) + } + if (transportListener == null) { throw new IOException("The command listener has not been set."); + } next.start(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/TransportListener.java b/activemq-core/src/main/java/org/apache/activemq/transport/TransportListener.java index 462f6fec8b..f76c89e16b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/TransportListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/TransportListener.java @@ -30,24 +30,24 @@ public interface TransportListener { * called to process a command * @param command */ - public void onCommand(Object command); + void onCommand(Object command); /** * An unrecoverable exception has occured on the transport * @param error */ - public void onException(IOException error); + void onException(IOException error); /** * The transport has suffered an interuption from which it hopes to recover * */ - public void transportInterupted(); + void transportInterupted(); /** * The transport has resumed after an interuption * */ - public void transportResumed(); + void transportResumed(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java b/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java index 6fb243852b..af8900ad60 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java @@ -33,7 +33,7 @@ public class TransportLogger extends TransportFilter { this(next, LogFactory.getLog(TransportLogger.class.getName() + ".Connection:" + getNextId())); } - synchronized private static int getNextId() { + private static synchronized int getNextId() { return ++lastId; } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/TransportServer.java b/activemq-core/src/main/java/org/apache/activemq/transport/TransportServer.java index cd6634f5f3..cb70776f26 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/TransportServer.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/TransportServer.java @@ -36,7 +36,7 @@ public interface TransportServer extends Service { * * @param acceptListener */ - public void setAcceptListener(TransportAcceptListener acceptListener); + void setAcceptListener(TransportAcceptListener acceptListener); /** * Associates a broker info with the transport server so that the transport @@ -44,15 +44,15 @@ public interface TransportServer extends Service { * * @param brokerInfo */ - public void setBrokerInfo(BrokerInfo brokerInfo); + void setBrokerInfo(BrokerInfo brokerInfo); - public URI getConnectURI(); + URI getConnectURI(); /** * @return The socket address that this transport is accepting connections * on or null if this does not or is not currently accepting * connections on a socket. */ - public InetSocketAddress getSocketAddress(); + InetSocketAddress getSocketAddress(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/TransportServerThreadSupport.java b/activemq-core/src/main/java/org/apache/activemq/transport/TransportServerThreadSupport.java index 523b47b88a..5cc34a9930 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/TransportServerThreadSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/TransportServerThreadSupport.java @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public abstract class TransportServerThreadSupport extends TransportServerSupport implements Runnable { - private static final Log log = LogFactory.getLog(TransportServerThreadSupport.class); + private static final Log LOG = LogFactory.getLog(TransportServerThreadSupport.class); private boolean daemon = true; private boolean joinOnStop = true; @@ -69,7 +69,7 @@ public abstract class TransportServerThreadSupport extends TransportServerSuppor } protected void doStart() throws Exception { - log.info("Listening for connections at: " + getConnectURI()); + LOG.info("Listening for connections at: " + getConnectURI()); runner = new Thread(null, this, "ActiveMQ Transport Server: " + toString(), stackSize); runner.setDaemon(daemon); runner.setPriority(ThreadPriorities.BROKER_MANAGEMENT); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/TransportSupport.java b/activemq-core/src/main/java/org/apache/activemq/transport/TransportSupport.java index d52441c758..aaed6f3362 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/TransportSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/TransportSupport.java @@ -28,7 +28,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public abstract class TransportSupport extends ServiceSupport implements Transport { - private static final Log log = LogFactory.getLog(TransportSupport.class); + private static final Log LOG = LogFactory.getLog(TransportSupport.class); TransportListener transportListener; @@ -82,7 +82,7 @@ public abstract class TransportSupport extends ServiceSupport implements Transpo if (transportListener != null) { transportListener.onCommand(command); } else { - log.error("No transportListener available to process inbound command: " + command); + LOG.error("No transportListener available to process inbound command: " + command); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java b/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java index 3ddf8ad39c..1f9ca710dc 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java @@ -80,8 +80,9 @@ public class WireFormatNegotiator extends TransportFilter { public void oneway(Object command) throws IOException { try { - if (!readyCountDownLatch.await(negotiateTimeout, TimeUnit.MILLISECONDS)) + if (!readyCountDownLatch.await(negotiateTimeout, TimeUnit.MILLISECONDS)) { throw new IOException("Wire format negotiation timeout: peer did not send his wire format."); + } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new InterruptedIOException(); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java index b1526481fd..22aed81c16 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java @@ -36,7 +36,7 @@ public interface DiscoveryAgent extends Service { * Sets the discovery listener * @param listener */ - public void setDiscoveryListener(DiscoveryListener listener); + void setDiscoveryListener(DiscoveryListener listener); /** * register a service @@ -57,6 +57,6 @@ public interface DiscoveryAgent extends Service { void setGroup(String group); - public void setBrokerName(String brokerName); + void setBrokerName(String brokerName); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgentFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgentFactory.java index 06c5b548f1..7e0a803e2b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgentFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgentFactory.java @@ -25,8 +25,8 @@ import org.apache.activemq.util.IOExceptionSupport; public abstract class DiscoveryAgentFactory { - static final private FactoryFinder discoveryAgentFinder = new FactoryFinder("META-INF/services/org/apache/activemq/transport/discoveryagent/"); - static final private ConcurrentHashMap discoveryAgentFactorys = new ConcurrentHashMap(); + private static final FactoryFinder DISCOVERY_AGENT_FINDER = new FactoryFinder("META-INF/services/org/apache/activemq/transport/discoveryagent/"); + private static final ConcurrentHashMap DISCOVERY_AGENT_FACTORYS = new ConcurrentHashMap(); /** * @param uri @@ -35,14 +35,15 @@ public abstract class DiscoveryAgentFactory { */ private static DiscoveryAgentFactory findDiscoveryAgentFactory(URI uri) throws IOException { String scheme = uri.getScheme(); - if (scheme == null) + if (scheme == null) { throw new IOException("DiscoveryAgent scheme not specified: [" + uri + "]"); - DiscoveryAgentFactory daf = (DiscoveryAgentFactory)discoveryAgentFactorys.get(scheme); + } + DiscoveryAgentFactory daf = (DiscoveryAgentFactory)DISCOVERY_AGENT_FACTORYS.get(scheme); if (daf == null) { // Try to load if from a META-INF property. try { - daf = (DiscoveryAgentFactory)discoveryAgentFinder.newInstance(scheme); - discoveryAgentFactorys.put(scheme, daf); + daf = (DiscoveryAgentFactory)DISCOVERY_AGENT_FINDER.newInstance(scheme); + DISCOVERY_AGENT_FACTORYS.put(scheme, daf); } catch (Throwable e) { throw IOExceptionSupport.create("DiscoveryAgent scheme NOT recognized: [" + scheme + "]", e); } @@ -56,7 +57,7 @@ public abstract class DiscoveryAgentFactory { } - abstract protected DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException; + protected abstract DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException; // { // try { // String type = ( uri.getScheme() == null ) ? uri.getPath() : diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryListener.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryListener.java index c417cab115..ce2daccdfa 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryListener.java @@ -20,12 +20,13 @@ import org.apache.activemq.command.DiscoveryEvent; /** * A listener of services being added or removed from a network - * + * * @version $Revision$ */ public interface DiscoveryListener { - - public void onServiceAdd(DiscoveryEvent event); - public void onServiceRemove(DiscoveryEvent event); - + + void onServiceAdd(DiscoveryEvent event); + + void onServiceRemove(DiscoveryEvent event); + } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java index b3d198fc0d..b771fc31da 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java @@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory; */ public class DiscoveryTransport extends TransportFilter implements DiscoveryListener { - private static final Log log = LogFactory.getLog(DiscoveryTransport.class); + private static final Log LOG = LogFactory.getLog(DiscoveryTransport.class); private final CompositeTransport next; private DiscoveryAgent discoveryAgent; @@ -58,10 +58,10 @@ public class DiscoveryTransport extends TransportFilter implements DiscoveryList } public void stop() throws Exception { - ServiceStopper ss = new ServiceStopper(); - ss.stop(discoveryAgent); - ss.stop(next); - ss.throwFirstException(); + ServiceStopper ss = new ServiceStopper(); + ss.stop(discoveryAgent); + ss.stop(next); + ss.throwFirstException(); } public void onServiceAdd(DiscoveryEvent event) { @@ -70,18 +70,18 @@ public class DiscoveryTransport extends TransportFilter implements DiscoveryList try { URI uri = new URI(url); serviceURIs.put(event.getServiceName(), uri); - log.info("Adding new broker connection URL: " + uri ); - next.add(new URI[]{uri}); + LOG.info("Adding new broker connection URL: " + uri); + next.add(new URI[] {uri}); } catch (URISyntaxException e) { - log.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e); + LOG.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e); } } } public void onServiceRemove(DiscoveryEvent event) { - URI uri = (URI) serviceURIs.get(event.getServiceName()); + URI uri = (URI)serviceURIs.get(event.getServiceName()); if (uri != null) { - next.remove(new URI[]{uri}); + next.remove(new URI[] {uri}); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java index cd05273c5b..18a74f2f33 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java @@ -47,7 +47,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { - private static final Log log = LogFactory.getLog(MulticastDiscoveryAgent.class); + private static final Log LOG = LogFactory.getLog(MulticastDiscoveryAgent.class); public static final String DEFAULT_DISCOVERY_URI_STRING = "multicast://239.255.2.3:6155"; private static final String TYPE_SUFFIX = "ActiveMQ-4."; private static final String ALIVE = "alive."; @@ -77,24 +77,25 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { this.lastHeartBeat = System.currentTimeMillis(); } - synchronized public void updateHeartBeat() { + public synchronized void updateHeartBeat() { lastHeartBeat = System.currentTimeMillis(); // Consider that the broker recovery has succeeded if it has not // failed in 60 seconds. if (!failed && failureCount > 0 && (lastHeartBeat - recoveryTime) > 1000 * 60) { - if (log.isDebugEnabled()) - log.debug("I now think that the " + service + " service has recovered."); + if (LOG.isDebugEnabled()) { + LOG.debug("I now think that the " + service + " service has recovered."); + } failureCount = 0; recoveryTime = 0; } } - synchronized public long getLastHeartBeat() { + public synchronized long getLastHeartBeat() { return lastHeartBeat; } - synchronized public boolean markFailed() { + public synchronized boolean markFailed() { if (!failed) { failed = true; failureCount++; @@ -104,16 +105,15 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { reconnectDelay = initialReconnectDelay; } else { reconnectDelay = (long)Math.pow(backOffMultiplier, failureCount); - if (reconnectDelay > maxReconnectDelay) + if (reconnectDelay > maxReconnectDelay) { reconnectDelay = maxReconnectDelay; + } } - if (log.isDebugEnabled()) - log - .debug("Remote failure of " - + service - + " while still receiving multicast advertisements. Advertising events will be suppressed for " - + reconnectDelay + " ms, the current failure count is: " + failureCount); + if (LOG.isDebugEnabled()) { + LOG.debug("Remote failure of " + service + " while still receiving multicast advertisements. Advertising events will be suppressed for " + reconnectDelay + + " ms, the current failure count is: " + failureCount); + } recoveryTime = System.currentTimeMillis() + reconnectDelay; return true; @@ -125,24 +125,27 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { * @return true if this broker is marked failed and it is now the right * time to start recovery. */ - synchronized public boolean doRecovery() { - if (!failed) + public synchronized boolean doRecovery() { + if (!failed) { return false; + } // Are we done trying to recover this guy? if (maxReconnectAttempts > 0 && failureCount > maxReconnectAttempts) { - if (log.isDebugEnabled()) - log.debug("Max reconnect attempts of the " + service + " service has been reached."); + if (LOG.isDebugEnabled()) { + LOG.debug("Max reconnect attempts of the " + service + " service has been reached."); + } return false; } // Is it not yet time? - if (System.currentTimeMillis() < recoveryTime) + if (System.currentTimeMillis() < recoveryTime) { return false; + } - if (log.isDebugEnabled()) - log.debug("Resuming event advertisement of the " + service + " service."); - + if (LOG.isDebugEnabled()) { + LOG.debug("Resuming event advertisement of the " + service + " service."); + } failed = false; return true; } @@ -169,15 +172,13 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { private AtomicBoolean started = new AtomicBoolean(false); private boolean reportAdvertizeFailed = true; - private final Executor executor = new ThreadPoolExecutor(1, 1, 30, TimeUnit.SECONDS, - new LinkedBlockingQueue(), new ThreadFactory() { - public Thread newThread(Runnable runable) { - Thread t = new Thread(runable, - "Multicast Discovery Agent Notifier"); - t.setDaemon(true); - return t; - } - }); + private final Executor executor = new ThreadPoolExecutor(1, 1, 30, TimeUnit.SECONDS, new LinkedBlockingQueue(), new ThreadFactory() { + public Thread newThread(Runnable runable) { + Thread t = new Thread(runable, "Multicast Discovery Agent Notifier"); + t.setDaemon(true); + return t; + } + }); /** * Set the discovery listener @@ -298,11 +299,11 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { throw new IOException("You must specify a group to discover"); } if (brokerName == null || brokerName.length() == 0) { - log.warn("brokerName not set"); + LOG.warn("brokerName not set"); } String type = getType(); if (!type.endsWith(".")) { - log.warn("The type '" + type + "' should end with '.' to be a valid Discovery type"); + LOG.warn("The type '" + type + "' should end with '.' to be a valid Discovery type"); type += "."; } if (discoveryURI == null) { @@ -354,7 +355,7 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { // ignore } catch (IOException e) { if (started.get()) { - log.error("failed to process packet: " + e); + LOG.error("failed to process packet: " + e); } } } @@ -408,9 +409,9 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { // same error over and over. if (reportAdvertizeFailed) { reportAdvertizeFailed = false; - log.error("Failed to advertise our service: " + payload, e); + LOG.error("Failed to advertise our service: " + payload, e); if ("Operation not permitted".equals(e.getMessage())) { - log.error("The 'Operation not permitted' error has been know to be caused by improper firewall/network setup. " + LOG.error("The 'Operation not permitted' error has been know to be caused by improper firewall/network setup. " + "Please make sure that the OS is properly configured to allow multicast traffic over: " + mcast.getLocalAddress()); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java index 388c72bc84..1affd54eb7 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java @@ -44,7 +44,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class RendezvousDiscoveryAgent implements DiscoveryAgent, ServiceListener { - private static final Log log = LogFactory.getLog(RendezvousDiscoveryAgent.class); + private static final Log LOG = LogFactory.getLog(RendezvousDiscoveryAgent.class); private static final String TYPE_SUFFIX = "ActiveMQ-4."; @@ -66,14 +66,14 @@ public class RendezvousDiscoveryAgent implements DiscoveryAgent, ServiceListener } String type = getType(); if (!type.endsWith(".")) { - log.warn("The type '" + type + "' should end with '.' to be a valid Rendezvous type"); + LOG.warn("The type '" + type + "' should end with '.' to be a valid Rendezvous type"); type += "."; } try { // force lazy construction getJmdns(); if (listener != null) { - log.info("Discovering service of type: " + type); + LOG.info("Discovering service of type: " + type); jmdns.addServiceListener(type, this); } } catch (IOException e) { @@ -112,20 +112,22 @@ public class RendezvousDiscoveryAgent implements DiscoveryAgent, ServiceListener // ServiceListener interface // ------------------------------------------------------------------------- public void addService(JmDNS jmDNS, String type, String name) { - if (log.isDebugEnabled()) { - log.debug("addService with type: " + type + " name: " + name); + if (LOG.isDebugEnabled()) { + LOG.debug("addService with type: " + type + " name: " + name); } - if (listener != null) + if (listener != null) { listener.onServiceAdd(new DiscoveryEvent(name)); + } jmDNS.requestServiceInfo(type, name); } public void removeService(JmDNS jmDNS, String type, String name) { - if (log.isDebugEnabled()) { - log.debug("removeService with type: " + type + " name: " + name); + if (LOG.isDebugEnabled()) { + LOG.debug("removeService with type: " + type + " name: " + name); } - if (listener != null) + if (listener != null) { listener.onServiceRemove(new DiscoveryEvent(name)); + } } public void serviceAdded(ServiceEvent event) { @@ -195,8 +197,8 @@ public class RendezvousDiscoveryAgent implements DiscoveryAgent, ServiceListener String type = getType(); - if (log.isDebugEnabled()) { - log.debug("Registering service type: " + type + " name: " + name + " details: " + map); + if (LOG.isDebugEnabled()) { + LOG.debug("Registering service type: " + type + " name: " + name + " details: " + map); } return new ServiceInfo(type, name + "." + type, port, weight, priority, ""); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java index 46e4d79c4e..389d00dab6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java @@ -132,8 +132,9 @@ public class SimpleDiscoveryAgent implements DiscoveryAgent { synchronized (sleepMutex) { try { - if (!running.get()) + if (!running.get()) { return; + } sleepMutex.wait(event.reconnectDelay); } catch (InterruptedException ie) { @@ -147,8 +148,9 @@ public class SimpleDiscoveryAgent implements DiscoveryAgent { } else { // Exponential increment of reconnect delay. event.reconnectDelay *= backOffMultiplier; - if (event.reconnectDelay > maxReconnectDelay) + if (event.reconnectDelay > maxReconnectDelay) { event.reconnectDelay = maxReconnectDelay; + } } } else { @@ -156,8 +158,9 @@ public class SimpleDiscoveryAgent implements DiscoveryAgent { event.reconnectDelay = initialReconnectDelay; } - if (!running.get()) + if (!running.get()) { return; + } event.connectTime = System.currentTimeMillis(); event.failed.set(false); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java index 2a306ebbc1..2f90eb3cb6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java @@ -52,7 +52,7 @@ import org.apache.commons.logging.LogFactory; */ public class FailoverTransport implements CompositeTransport { - private static final Log log = LogFactory.getLog(FailoverTransport.class); + private static final Log LOG = LogFactory.getLog(FailoverTransport.class); private TransportListener transportListener; private boolean disposed; @@ -166,7 +166,7 @@ public class FailoverTransport implements CompositeTransport { for (int i = 0; iter.hasNext() && connectedTransport == null && !disposed; i++) { URI uri = (URI)iter.next(); try { - log.debug("Attempting connect to: " + uri); + LOG.debug("Attempting connect to: " + uri); Transport t = TransportFactory.compositeConnect(uri); t.setTransportListener(myTransportListener); t.start(); @@ -175,7 +175,7 @@ public class FailoverTransport implements CompositeTransport { restoreTransport(t); } - log.debug("Connection established"); + LOG.debug("Connection established"); reconnectDelay = initialReconnectDelay; connectedTransportURI = uri; connectedTransport = t; @@ -184,18 +184,18 @@ public class FailoverTransport implements CompositeTransport { if (transportListener != null) { transportListener.transportResumed(); } - log.info("Successfully reconnected to " + uri); + LOG.info("Successfully reconnected to " + uri); return false; } catch (Exception e) { failure = e; - log.debug("Connect fail to: " + uri + ", reason: " + e); + LOG.debug("Connect fail to: " + uri + ", reason: " + e); } } } } if (maxReconnectAttempts > 0 && ++connectFailures >= maxReconnectAttempts) { - log.error("Failed to connect to transport after: " + connectFailures + " attempt(s)"); + LOG.error("Failed to connect to transport after: " + connectFailures + " attempt(s)"); connectionFailure = failure; reconnectMutex.notifyAll(); return false; @@ -204,7 +204,7 @@ public class FailoverTransport implements CompositeTransport { if (!disposed) { - log.debug("Waiting " + reconnectDelay + " ms before attempting connection. "); + LOG.debug("Waiting " + reconnectDelay + " ms before attempting connection. "); synchronized (sleepMutex) { try { sleepMutex.wait(reconnectDelay); @@ -216,8 +216,9 @@ public class FailoverTransport implements CompositeTransport { if (useExponentialBackOff) { // Exponential increment of reconnect delay. reconnectDelay *= backOffMultiplier; - if (reconnectDelay > maxReconnectDelay) + if (reconnectDelay > maxReconnectDelay) { reconnectDelay = maxReconnectDelay; + } } } return !disposed; @@ -231,7 +232,7 @@ public class FailoverTransport implements CompositeTransport { transportListener.transportInterupted(); } synchronized (reconnectMutex) { - log.warn("Transport failed, attempting to automatically reconnect due to: " + e, e); + LOG.warn("Transport failed, attempting to automatically reconnect due to: " + e, e); if (connectedTransport != null) { initialized = false; ServiceSupport.dispose(connectedTransport); @@ -244,9 +245,10 @@ public class FailoverTransport implements CompositeTransport { public void start() throws Exception { synchronized (reconnectMutex) { - log.debug("Started."); - if (started) + LOG.debug("Started."); + if (started) { return; + } started = true; if (connectedTransport != null) { stateTracker.restore(connectedTransport); @@ -256,9 +258,10 @@ public class FailoverTransport implements CompositeTransport { public void stop() throws Exception { synchronized (reconnectMutex) { - log.debug("Stopped."); - if (!started) + LOG.debug("Stopped."); + if (!started) { return; + } started = false; disposed = true; @@ -348,12 +351,12 @@ public class FailoverTransport implements CompositeTransport { // Wait for transport to be connected. while (connectedTransport == null && !disposed && connectionFailure == null) { - log.trace("Waiting for transport to reconnect."); + LOG.trace("Waiting for transport to reconnect."); try { reconnectMutex.wait(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - log.debug("Interupted: " + e, e); + LOG.debug("Interupted: " + e, e); } } @@ -408,7 +411,7 @@ public class FailoverTransport implements CompositeTransport { return; } catch (IOException e) { - log.debug("Send oneway attempt: " + i + " failed."); + LOG.debug("Send oneway attempt: " + i + " failed."); handleTransportFailure(e); } } @@ -420,8 +423,9 @@ public class FailoverTransport implements CompositeTransport { } if (!disposed) { if (error != null) { - if (error instanceof IOException) + if (error instanceof IOException) { throw (IOException)error; + } throw IOExceptionSupport.create(error); } } @@ -441,8 +445,9 @@ public class FailoverTransport implements CompositeTransport { public void add(URI u[]) { for (int i = 0; i < u.length; i++) { - if (!uris.contains(u[i])) + if (!uris.contains(u[i])) { uris.add(u[i]); + } } reconnect(); } @@ -457,17 +462,18 @@ public class FailoverTransport implements CompositeTransport { public void add(String u) { try { URI uri = new URI(u); - if (!uris.contains(uri)) + if (!uris.contains(uri)) { uris.add(uri); + } reconnect(); } catch (Exception e) { - log.error("Failed to parse URI: " + u); + LOG.error("Failed to parse URI: " + u); } } public void reconnect() { - log.debug("Waking up reconnect task"); + LOG.debug("Waking up reconnect task"); try { reconnectTask.wakeup(); } catch (InterruptedException e) { diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java index f35369dc18..d19e139e51 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java @@ -52,7 +52,7 @@ import org.apache.commons.logging.LogFactory; */ public class FanoutTransport implements CompositeTransport { - private static final Log log = LogFactory.getLog(FanoutTransport.class); + private static final Log LOG = LogFactory.getLog(FanoutTransport.class); private TransportListener transportListener; private boolean disposed; @@ -126,10 +126,11 @@ public class FanoutTransport implements CompositeTransport { public void onException(IOException error) { try { synchronized (reconnectMutex) { - if (transport == null) + if (transport == null) { return; + } - log.debug("Transport failed, starting up reconnect task", error); + LOG.debug("Transport failed, starting up reconnect task", error); ServiceSupport.dispose(transport); transport = null; @@ -198,10 +199,10 @@ public class FanoutTransport implements CompositeTransport { URI uri = fanoutHandler.uri; try { - log.debug("Stopped: " + this); - log.debug("Attempting connect to: " + uri); + LOG.debug("Stopped: " + this); + LOG.debug("Attempting connect to: " + uri); Transport t = TransportFactory.compositeConnect(uri); - log.debug("Connection established"); + LOG.debug("Connection established"); fanoutHandler.transport = t; fanoutHandler.reconnectDelay = 10; fanoutHandler.connectFailures = 0; @@ -214,10 +215,10 @@ public class FanoutTransport implements CompositeTransport { restoreTransport(fanoutHandler); } } catch (Exception e) { - log.debug("Connect fail to: " + uri + ", reason: " + e); + LOG.debug("Connect fail to: " + uri + ", reason: " + e); if (maxReconnectAttempts > 0 && ++fanoutHandler.connectFailures >= maxReconnectAttempts) { - log.error("Failed to connect to transport after: " + fanoutHandler.connectFailures + " attempt(s)"); + LOG.error("Failed to connect to transport after: " + fanoutHandler.connectFailures + " attempt(s)"); connectionFailure = e; reconnectMutex.notifyAll(); return false; @@ -226,8 +227,9 @@ public class FanoutTransport implements CompositeTransport { if (useExponentialBackOff) { // Exponential increment of reconnect delay. fanoutHandler.reconnectDelay *= backOffMultiplier; - if (fanoutHandler.reconnectDelay > maxReconnectDelay) + if (fanoutHandler.reconnectDelay > maxReconnectDelay) { fanoutHandler.reconnectDelay = maxReconnectDelay; + } } fanoutHandler.reconnectDate = now + fanoutHandler.reconnectDelay; @@ -251,7 +253,7 @@ public class FanoutTransport implements CompositeTransport { try { long reconnectDelay = closestReconnectDate - System.currentTimeMillis(); if (reconnectDelay > 0) { - log.debug("Waiting " + reconnectDelay + " ms before attempting connection. "); + LOG.debug("Waiting " + reconnectDelay + " ms before attempting connection. "); Thread.sleep(reconnectDelay); } } catch (InterruptedException e1) { @@ -262,9 +264,10 @@ public class FanoutTransport implements CompositeTransport { public void start() throws Exception { synchronized (reconnectMutex) { - log.debug("Started."); - if (started) + LOG.debug("Started."); + if (started) { return; + } started = true; for (Iterator iter = transports.iterator(); iter.hasNext();) { FanoutTransportHandler th = (FanoutTransportHandler)iter.next(); @@ -279,8 +282,9 @@ public class FanoutTransport implements CompositeTransport { synchronized (reconnectMutex) { ServiceStopper ss = new ServiceStopper(); - if (!started) + if (!started) { return; + } started = false; disposed = true; @@ -291,7 +295,7 @@ public class FanoutTransport implements CompositeTransport { } } - log.debug("Stopped: " + this); + LOG.debug("Stopped: " + this); ss.throwFirstException(); } reconnectTask.shutdown(); @@ -346,7 +350,7 @@ public class FanoutTransport implements CompositeTransport { // Wait for transport to be connected. while (connectedCount != minAckCount && !disposed && connectionFailure == null) { - log.debug("Waiting for at least " + minAckCount + " transports to be connected."); + LOG.debug("Waiting for at least " + minAckCount + " transports to be connected."); reconnectMutex.wait(1000); } @@ -364,8 +368,9 @@ public class FanoutTransport implements CompositeTransport { error = new IOException("Unexpected failure."); } - if (error instanceof IOException) + if (error instanceof IOException) { throw (IOException)error; + } throw IOExceptionSupport.create(error); } @@ -377,7 +382,7 @@ public class FanoutTransport implements CompositeTransport { try { th.transport.oneway(command); } catch (IOException e) { - log.debug("Send attempt: failed."); + LOG.debug("Send attempt: failed."); th.onException(e); } } @@ -386,7 +391,7 @@ public class FanoutTransport implements CompositeTransport { try { primary.transport.oneway(command); } catch (IOException e) { - log.debug("Send attempt: failed."); + LOG.debug("Send attempt: failed."); primary.onException(e); } } @@ -426,7 +431,7 @@ public class FanoutTransport implements CompositeTransport { } public void reconnect() { - log.debug("Waking up reconnect task"); + LOG.debug("Waking up reconnect task"); try { reconnectTask.wakeup(); } catch (InterruptedException e) { @@ -453,8 +458,9 @@ public class FanoutTransport implements CompositeTransport { FanoutTransportHandler th = (FanoutTransportHandler)iter.next(); if (th.transport != null) { Object rc = th.transport.narrow(target); - if (rc != null) + if (rc != null) { return rc; + } } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java index 49e48d604b..ea2edd35c9 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java @@ -39,12 +39,13 @@ public class MockTransport extends DefaultTransportListener implements Transport /** */ - synchronized public void setTransportListener(TransportListener channelListener) { + public synchronized void setTransportListener(TransportListener channelListener) { this.transportListener = channelListener; - if (channelListener == null) + if (channelListener == null) { getNext().setTransportListener(null); - else + } else { getNext().setTransportListener(this); + } } /** @@ -52,10 +53,12 @@ public class MockTransport extends DefaultTransportListener implements Transport * @throws IOException if the next channel has not been set. */ public void start() throws Exception { - if (getNext() == null) + if (getNext() == null) { throw new IOException("The next channel has not been set."); - if (transportListener == null) + } + if (transportListener == null) { throw new IOException("The command listener has not been set."); + } getNext().start(); } @@ -73,14 +76,14 @@ public class MockTransport extends DefaultTransportListener implements Transport /** * @return Returns the getNext(). */ - synchronized public Transport getNext() { + public synchronized Transport getNext() { return next; } /** * @return Returns the packetListener. */ - synchronized public TransportListener getTransportListener() { + public synchronized TransportListener getTransportListener() { return transportListener; } @@ -115,7 +118,7 @@ public class MockTransport extends DefaultTransportListener implements Transport return getNext().narrow(target); } - synchronized public void setNext(Transport next) { + public synchronized void setNext(Transport next) { this.next = next; } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastTransport.java index 05b745e664..ff262eed96 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastTransport.java @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; */ public class MulticastTransport extends UdpTransport { - private static final Log log = LogFactory.getLog(MulticastTransport.class); + private static final Log LOG = LogFactory.getLog(MulticastTransport.class); private static final int DEFAULT_IDLE_TIME = 5000; @@ -109,7 +109,7 @@ public class MulticastTransport extends UdpTransport { socket.setLoopbackMode(loopBackMode); socket.setTimeToLive(timeToLive); - log.debug("Joining multicast address: " + getMulticastAddress()); + LOG.debug("Joining multicast address: " + getMulticastAddress()); socket.joinGroup(getMulticastAddress()); socket.setSoTimeout((int)keepAliveInterval); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java b/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java index ce622a6a2c..d77c4aea24 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java @@ -31,7 +31,7 @@ import java.nio.channels.WritableByteChannel; public class NIOOutputStream extends OutputStream { - private final static int BUFFER_SIZE = 8192; + private static final int BUFFER_SIZE = 8192; private final WritableByteChannel out; private final byte[] buffer; diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOTransport.java index 61bd4de2fe..6da18592fb 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOTransport.java @@ -101,8 +101,9 @@ public class NIOTransport extends TcpTransport { break; } - if (currentBuffer.hasRemaining()) + if (currentBuffer.hasRemaining()) { continue; + } // Are we trying to figure out the size of the next frame? if (nextFrameSize == -1) { diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java b/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java index 4bae4586d5..c16e70ef4a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java @@ -32,19 +32,9 @@ import java.util.concurrent.ThreadFactory; * * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $ */ -final public class SelectorManager { +public final class SelectorManager { - static final public SelectorManager singleton = new SelectorManager(); - - static SelectorManager getInstance() { - return singleton; - } - - public interface Listener { - public void onSelect(SelectorSelection selector); - - public void onError(SelectorSelection selection, Throwable error); - } + public static final SelectorManager SINGLETON = new SelectorManager(); private Executor selectorExecutor = Executors.newCachedThreadPool(new ThreadFactory() { public Thread newThread(Runnable r) { @@ -56,6 +46,17 @@ final public class SelectorManager { private Executor channelExecutor = selectorExecutor; private LinkedList freeWorkers = new LinkedList(); private int maxChannelsPerWorker = 64; + + static SelectorManager getInstance() { + return SINGLETON; + } + + public interface Listener { + void onSelect(SelectorSelection selector); + + void onError(SelectorSelection selection, Throwable error); + } + public synchronized SelectorSelection register(SocketChannel socketChannel, Listener listener) throws IOException { @@ -76,11 +77,11 @@ final public class SelectorManager { freeWorkers.remove(worker); } - synchronized public void onWorkerEmptyEvent(SelectorWorker worker) { + public synchronized void onWorkerEmptyEvent(SelectorWorker worker) { freeWorkers.remove(worker); } - synchronized public void onWorkerNotFullEvent(SelectorWorker worker) { + public synchronized void onWorkerNotFullEvent(SelectorWorker worker) { freeWorkers.add(worker); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorSelection.java b/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorSelection.java index 0e00bf18d9..1e8b9b6032 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorSelection.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorSelection.java @@ -25,7 +25,7 @@ import org.apache.activemq.transport.nio.SelectorManager.Listener; /** * @author chirino */ -final public class SelectorSelection { +public final class SelectorSelection { private final SelectorWorker worker; private final SelectionKey key; diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorWorker.java b/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorWorker.java index 3741308756..1429f8f00a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorWorker.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorWorker.java @@ -25,13 +25,13 @@ import java.util.concurrent.atomic.AtomicInteger; public class SelectorWorker implements Runnable { - private final static AtomicInteger NEXT_ID = new AtomicInteger(); + private static final AtomicInteger NEXT_ID = new AtomicInteger(); final SelectorManager manager; final Selector selector; final int id = NEXT_ID.getAndIncrement(); final AtomicInteger useCounter = new AtomicInteger(); - final private int maxChannelsPerWorker; + private final int maxChannelsPerWorker; public SelectorWorker(SelectorManager manager) throws IOException { this.manager = manager; @@ -69,11 +69,13 @@ public class SelectorWorker implements Runnable { while (isRunning()) { int count = selector.select(10); - if (count == 0) + if (count == 0) { continue; + } - if (!isRunning()) + if (!isRunning()) { return; + } // Get a java.util.Set containing the SelectionKey objects // for all channels that are ready for I/O. diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java index e0e37ded3b..c243b60366 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java @@ -37,13 +37,10 @@ import org.apache.activemq.util.URISupport; public class PeerTransportFactory extends TransportFactory { - final public static ConcurrentHashMap brokers = new ConcurrentHashMap(); - - final public static ConcurrentHashMap connectors = new ConcurrentHashMap(); - - final public static ConcurrentHashMap servers = new ConcurrentHashMap(); - - private IdGenerator idGenerator = new IdGenerator("peer-"); + public static final ConcurrentHashMap BROKERS = new ConcurrentHashMap(); + public static final ConcurrentHashMap CONNECTORS = new ConcurrentHashMap(); + public static final ConcurrentHashMap SERVERS = new ConcurrentHashMap(); + private static final IdGenerator ID_GENERATOR = new IdGenerator("peer-"); public Transport doConnect(URI location) throws Exception { VMTransportFactory vmTransportFactory = createTransportFactory(location); @@ -69,7 +66,7 @@ public class PeerTransportFactory extends TransportFactory { group = "default"; } if (broker == null || broker.length() == 0) { - broker = idGenerator.generateSanitizedId(); + broker = ID_GENERATOR.generateSanitizedId(); } final Map brokerOptions = new HashMap(URISupport.parseParamters(location)); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java b/activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java index 6c30af2a10..6ae7568295 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java @@ -29,7 +29,7 @@ import org.apache.commons.logging.LogFactory; */ public class DefaultReplayBuffer implements ReplayBuffer { - private static final Log log = LogFactory.getLog(DefaultReplayBuffer.class); + private static final Log LOG = LogFactory.getLog(DefaultReplayBuffer.class); private final int size; private ReplayBufferListener listener; @@ -43,8 +43,8 @@ public class DefaultReplayBuffer implements ReplayBuffer { } public void addBuffer(int commandId, Object buffer) { - if (log.isDebugEnabled()) { - log.debug("Adding command ID: " + commandId + " to replay buffer: " + this + " object: " + buffer); + if (LOG.isDebugEnabled()) { + LOG.debug("Adding command ID: " + commandId + " to replay buffer: " + this + " object: " + buffer); } synchronized (lock) { int max = size - 1; @@ -65,8 +65,8 @@ public class DefaultReplayBuffer implements ReplayBuffer { if (replayer == null) { throw new IllegalArgumentException("No Replayer parameter specified"); } - if (log.isDebugEnabled()) { - log.debug("Buffer: " + this + " replaying messages from: " + fromCommandId + " to: " + toCommandId); + if (LOG.isDebugEnabled()) { + LOG.debug("Buffer: " + this + " replaying messages from: " + fromCommandId + " to: " + toCommandId); } for (int i = fromCommandId; i <= toCommandId; i++) { Object buffer = null; diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReliableTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReliableTransport.java index 983ed5bba0..f484edaf54 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReliableTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReliableTransport.java @@ -38,7 +38,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class ReliableTransport extends ResponseCorrelator { - private static final Log log = LogFactory.getLog(ReliableTransport.class); + private static final Log LOG = LogFactory.getLog(ReliableTransport.class); private ReplayStrategy replayStrategy; private SortedSet commands = new TreeSet(new CommandIdComparator()); @@ -132,8 +132,8 @@ public class ReliableTransport extends ResponseCorrelator { if (keep) { // lets add it to the list for later on - if (log.isDebugEnabled()) { - log.debug("Received out of order command which is being buffered for later: " + command); + if (LOG.isDebugEnabled()) { + LOG.debug("Received out of order command which is being buffered for later: " + command); } commands.add(command); } @@ -261,7 +261,7 @@ public class ReliableTransport extends ResponseCorrelator { * Lets attempt to replay the request as a command may have disappeared */ protected void onMissingResponse(Command command, FutureResponse response) { - log.debug("Still waiting for response on: " + this + " to command: " + command + " sending replay message"); + LOG.debug("Still waiting for response on: " + this + " to command: " + command + " sending replay message"); int commandId = command.getCommandId(); requestReplay(commandId, commandId); @@ -276,8 +276,8 @@ public class ReliableTransport extends ResponseCorrelator { if (replayer == null) { onException(new IOException("Cannot replay commands. No replayer property configured")); } - if (log.isDebugEnabled()) { - log.debug("Processing replay command: " + command); + if (LOG.isDebugEnabled()) { + LOG.debug("Processing replay command: " + command); } getReplayBuffer().replayMessages(command.getFirstNakNumber(), command.getLastNakNumber(), replayer); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReplayBuffer.java b/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReplayBuffer.java index 7602d8654b..8b0d91b4e5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReplayBuffer.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReplayBuffer.java @@ -31,9 +31,9 @@ public interface ReplayBuffer { * Submit a buffer for caching around for a period of time, during which time it can be replayed * to users interested in it. */ - public void addBuffer(int commandId, Object buffer); + void addBuffer(int commandId, Object buffer); - public void setReplayBufferListener(ReplayBufferListener bufferPoolAdapter); + void setReplayBufferListener(ReplayBufferListener bufferPoolAdapter); - public void replayMessages(int fromCommandId, int toCommandId, Replayer replayer) throws IOException; + void replayMessages(int fromCommandId, int toCommandId, Replayer replayer) throws IOException; } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReplayBufferListener.java b/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReplayBufferListener.java index c17df3c379..7f8275eb95 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReplayBufferListener.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReplayBufferListener.java @@ -27,5 +27,5 @@ public interface ReplayBufferListener { * Indications that the buffer has been discarded and so could be * re-introduced into some pool */ - public void onBufferDiscarded(int commandId, Object buffer); + void onBufferDiscarded(int commandId, Object buffer); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java index 26997e7745..72a84ecddb 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java @@ -1,3 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.activemq.transport.stomp; import java.io.IOException; @@ -17,19 +33,23 @@ import org.apache.activemq.command.ActiveMQMessage; * from one to the other */ public interface FrameTranslator { - public ActiveMQMessage convertFrame(StompFrame frame) throws JMSException, ProtocolException; + ActiveMQMessage convertFrame(StompFrame frame) throws JMSException, ProtocolException; - public StompFrame convertMessage(ActiveMQMessage message) throws IOException, JMSException; + StompFrame convertMessage(ActiveMQMessage message) throws IOException, JMSException; - public String convertDestination(Destination d); + String convertDestination(Destination d); - public ActiveMQDestination convertDestination(String name) throws ProtocolException; + ActiveMQDestination convertDestination(String name) throws ProtocolException; /** * Helper class which holds commonly needed functions used when implementing * FrameTranslators */ - public final static class Helper { + static final class Helper { + + private Helper() { + } + public static void copyStandardHeadersFromMessageToFrame(ActiveMQMessage message, StompFrame command, FrameTranslator ft) throws IOException { final Map headers = command.getHeaders(); headers.put(Stomp.Headers.Message.DESTINATION, ft.convertDestination(message.getDestination())); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java index 5a5303c3f4..4257e99bb5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java @@ -1,3 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.activemq.transport.stomp; import java.io.IOException; @@ -67,24 +83,24 @@ public class LegacyFrameTranslator implements FrameTranslator { if (d == null) { return null; } - ActiveMQDestination amq_d = (ActiveMQDestination)d; - String p_name = amq_d.getPhysicalName(); + ActiveMQDestination activeMQDestination = (ActiveMQDestination)d; + String physicalName = activeMQDestination.getPhysicalName(); StringBuffer buffer = new StringBuffer(); - if (amq_d.isQueue()) { - if (amq_d.isTemporary()) { + if (activeMQDestination.isQueue()) { + if (activeMQDestination.isTemporary()) { buffer.append("/temp-queue/"); } else { buffer.append("/queue/"); } } else { - if (amq_d.isTemporary()) { + if (activeMQDestination.isTemporary()) { buffer.append("/temp-topic/"); } else { buffer.append("/topic/"); } } - buffer.append(p_name); + buffer.append(physicalName); return buffer.toString(); } @@ -92,17 +108,17 @@ public class LegacyFrameTranslator implements FrameTranslator { if (name == null) { return null; } else if (name.startsWith("/queue/")) { - String q_name = name.substring("/queue/".length(), name.length()); - return ActiveMQDestination.createDestination(q_name, ActiveMQDestination.QUEUE_TYPE); + String qName = name.substring("/queue/".length(), name.length()); + return ActiveMQDestination.createDestination(qName, ActiveMQDestination.QUEUE_TYPE); } else if (name.startsWith("/topic/")) { - String t_name = name.substring("/topic/".length(), name.length()); - return ActiveMQDestination.createDestination(t_name, ActiveMQDestination.TOPIC_TYPE); + String tName = name.substring("/topic/".length(), name.length()); + return ActiveMQDestination.createDestination(tName, ActiveMQDestination.TOPIC_TYPE); } else if (name.startsWith("/temp-queue/")) { - String t_name = name.substring("/temp-queue/".length(), name.length()); - return ActiveMQDestination.createDestination(t_name, ActiveMQDestination.TEMP_QUEUE_TYPE); + String tName = name.substring("/temp-queue/".length(), name.length()); + return ActiveMQDestination.createDestination(tName, ActiveMQDestination.TEMP_QUEUE_TYPE); } else if (name.startsWith("/temp-topic/")) { - String t_name = name.substring("/temp-topic/".length(), name.length()); - return ActiveMQDestination.createDestination(t_name, ActiveMQDestination.TEMP_TOPIC_TYPE); + String tName = name.substring("/temp-topic/".length(), name.length()); + return ActiveMQDestination.createDestination(tName, ActiveMQDestination.TEMP_TOPIC_TYPE); } else { throw new ProtocolException("Illegal destination name: [" + name + "] -- ActiveMQ STOMP destinations " + "must begine with one of: /queue/ /topic/ /temp-queue/ /temp-topic/"); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java index fd6c8f9748..fb29b54db9 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java @@ -56,8 +56,9 @@ import org.apache.activemq.util.LongSequenceGenerator; */ public class ProtocolConverter { - private static final IdGenerator connectionIdGenerator = new IdGenerator(); - private final ConnectionId connectionId = new ConnectionId(connectionIdGenerator.generateId()); + private static final IdGenerator CONNECTION_ID_GENERATOR = new IdGenerator(); + + private final ConnectionId connectionId = new ConnectionId(CONNECTION_ID_GENERATOR.generateId()); private final SessionId sessionId = new SessionId(connectionId, -1); private final ProducerId producerId = new ProducerId(sessionId, 1); @@ -129,26 +130,27 @@ public class ProtocolConverter { } String action = command.getAction(); - if (action.startsWith(Stomp.Commands.SEND)) + if (action.startsWith(Stomp.Commands.SEND)) { onStompSend(command); - else if (action.startsWith(Stomp.Commands.ACK)) + } else if (action.startsWith(Stomp.Commands.ACK)) { onStompAck(command); - else if (action.startsWith(Stomp.Commands.BEGIN)) + } else if (action.startsWith(Stomp.Commands.BEGIN)) { onStompBegin(command); - else if (action.startsWith(Stomp.Commands.COMMIT)) + } else if (action.startsWith(Stomp.Commands.COMMIT)) { onStompCommit(command); - else if (action.startsWith(Stomp.Commands.ABORT)) + } else if (action.startsWith(Stomp.Commands.ABORT)) { onStompAbort(command); - else if (action.startsWith(Stomp.Commands.SUBSCRIBE)) + } else if (action.startsWith(Stomp.Commands.SUBSCRIBE)) { onStompSubscribe(command); - else if (action.startsWith(Stomp.Commands.UNSUBSCRIBE)) + } else if (action.startsWith(Stomp.Commands.UNSUBSCRIBE)) { onStompUnsubscribe(command); - else if (action.startsWith(Stomp.Commands.CONNECT)) + } else if (action.startsWith(Stomp.Commands.CONNECT)) { onStompConnect(command); - else if (action.startsWith(Stomp.Commands.DISCONNECT)) + } else if (action.startsWith(Stomp.Commands.DISCONNECT)) { onStompDisconnect(command); - else + } else { throw new ProtocolException("Unknown STOMP action: " + action); + } } catch (ProtocolException e) { @@ -169,8 +171,9 @@ public class ProtocolConverter { StompFrame errorMessage = new StompFrame(Stomp.Responses.ERROR, headers, baos.toByteArray()); sendToStomp(errorMessage); - if (e.isFatal()) + if (e.isFatal()) { getTransportFilter().onException(e); + } } } @@ -189,8 +192,9 @@ public class ProtocolConverter { if (stompTx != null) { TransactionId activemqTx = (TransactionId)transactions.get(stompTx); - if (activemqTx == null) + if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); + } message.setTransactionId(activemqTx); } @@ -210,15 +214,17 @@ public class ProtocolConverter { Map headers = command.getHeaders(); String messageId = (String)headers.get(Stomp.Headers.Ack.MESSAGE_ID); - if (messageId == null) + if (messageId == null) { throw new ProtocolException("ACK received without a message-id to acknowledge!"); + } TransactionId activemqTx = null; String stompTx = (String)headers.get(Stomp.Headers.TRANSACTION); if (stompTx != null) { activemqTx = (TransactionId)transactions.get(stompTx); - if (activemqTx == null) + if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); + } } boolean acked = false; @@ -233,8 +239,9 @@ public class ProtocolConverter { } } - if (!acked) + if (!acked) { throw new ProtocolException("Unexpected ACK received for message-id [" + messageId + "]"); + } } @@ -318,7 +325,7 @@ public class ProtocolConverter { String subscriptionId = (String)headers.get(Stomp.Headers.Subscribe.ID); String destination = (String)headers.get(Stomp.Headers.Subscribe.DESTINATION); - ActiveMQDestination actual_dest = frameTranslator.convertDestination(destination); + ActiveMQDestination actualDest = frameTranslator.convertDestination(destination); ConsumerId id = new ConsumerId(sessionId, consumerIdGenerator.getNextSequenceId()); ConsumerInfo consumerInfo = new ConsumerInfo(id); consumerInfo.setPrefetchSize(1000); @@ -332,7 +339,7 @@ public class ProtocolConverter { consumerInfo.setDestination(frameTranslator.convertDestination(destination)); StompSubscription stompSubscription = new StompSubscription(this, subscriptionId, consumerInfo); - stompSubscription.setDestination(actual_dest); + stompSubscription.setDestination(actualDest); String ackMode = (String)headers.get(Stomp.Headers.Subscribe.ACK_MODE); if (Stomp.Headers.Subscribe.AckModeValues.CLIENT.equals(ackMode)) { @@ -352,8 +359,9 @@ public class ProtocolConverter { ActiveMQDestination destination = null; Object o = headers.get(Stomp.Headers.Unsubscribe.DESTINATION); - if (o != null) + if (o != null) { destination = frameTranslator.convertDestination((String)o); + } String subscriptionId = (String)headers.get(Stomp.Headers.Unsubscribe.ID); @@ -396,10 +404,11 @@ public class ProtocolConverter { IntrospectionSupport.setProperties(connectionInfo, headers, "activemq."); connectionInfo.setConnectionId(connectionId); - if (clientId != null) + if (clientId != null) { connectionInfo.setClientId(clientId); - else + } else { connectionInfo.setClientId("" + connectionInfo.getConnectionId().toString()); + } connectionInfo.setResponseRequired(true); connectionInfo.setUserName(login); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java index 7e51a209f5..253858807b 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java @@ -97,8 +97,9 @@ public class StompSubscription { String id = (String)entry.getKey(); MessageId msgid = (MessageId)entry.getValue(); - if (ack.getFirstMessageId() == null) + if (ack.getFirstMessageId() == null) { ack.setFirstMessageId(msgid); + } iter.remove(); count++; diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java index b2912b2b1a..24501d08f7 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java @@ -36,7 +36,7 @@ import org.apache.commons.logging.LogFactory; * @author chirino */ public class StompTransportFilter extends TransportFilter { - static final private Log log = LogFactory.getLog(StompTransportFilter.class); + private static final Log LOG = LogFactory.getLog(StompTransportFilter.class); private final ProtocolConverter protocolConverter; private final Object sendToActiveMQMutex = new Object(); @@ -64,7 +64,7 @@ public class StompTransportFilter extends TransportFilter { public void onCommand(Object command) { try { if (trace) { - log.trace("Received: \n" + command); + LOG.trace("Received: \n" + command); } protocolConverter.onStompCommad((StompFrame)command); } catch (IOException e) { @@ -82,7 +82,7 @@ public class StompTransportFilter extends TransportFilter { public void sendToStomp(StompFrame command) throws IOException { if (trace) { - log.trace("Sending: \n" + command); + LOG.trace("Sending: \n" + command); } synchronized (sendToStompMutex) { next.oneway(command); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java index a1d57383a3..f7d8c9e60a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java @@ -108,13 +108,14 @@ public class StompWireFormat implements WireFormat { String line = readLine(in, MAX_HEADER_LENGTH, "The maximum header length was exceeded"); if (line != null && line.trim().length() > 0) { - if (headers.size() > MAX_HEADERS) + if (headers.size() > MAX_HEADERS) { throw new ProtocolException("The maximum number of headers was exceeded", true); + } try { - int seperator_index = line.indexOf(Stomp.Headers.SEPERATOR); - String name = line.substring(0, seperator_index).trim(); - String value = line.substring(seperator_index + 1, line.length()).trim(); + int seperatorIndex = line.indexOf(Stomp.Headers.SEPERATOR); + String name = line.substring(0, seperatorIndex).trim(); + String value = line.substring(seperatorIndex + 1, line.length()).trim(); headers.put(name, value); } catch (Exception e) { throw new ProtocolException("Unable to parser header line [" + line + "]", true); @@ -137,8 +138,9 @@ public class StompWireFormat implements WireFormat { throw new ProtocolException("Specified content-length is not a valid integer", true); } - if (length > MAX_DATA_LENGTH) + if (length > MAX_DATA_LENGTH) { throw new ProtocolException("The maximum data length was exceeded", true); + } data = new byte[length]; in.readFully(data); @@ -182,8 +184,9 @@ public class StompWireFormat implements WireFormat { byte b; ByteArrayOutputStream baos = new ByteArrayOutputStream(maxLength); while ((b = in.readByte()) != '\n') { - if (baos.size() > maxLength) + if (baos.size() > maxLength) { throw new ProtocolException(errorMessage, true); + } baos.write(b); } baos.close(); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java index 6e5384e097..9f84ea0eae 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -61,7 +61,7 @@ public class SslTransportFactory extends TcpTransportFactory { private SSLContext sslContext = null; // The log this uses., - private static final Log log = LogFactory.getLog(SslTransportFactory.class); + private static final Log LOG = LogFactory.getLog(SslTransportFactory.class); /** * Constructor. Nothing special. @@ -130,7 +130,7 @@ public class SslTransportFactory extends TcpTransportFactory { String localString = location.getScheme() + ":/" + path; localLocation = new URI(localString); } catch (Exception e) { - log.warn("path isn't a valid local location for SslTransport to use", e); + LOG.warn("path isn't a valid local location for SslTransport to use", e); } } SocketFactory socketFactory = createSocketFactory(); @@ -165,8 +165,9 @@ public class SslTransportFactory extends TcpTransportFactory { protected ServerSocketFactory createServerSocketFactory() { if (sslContext == null) { return SSLServerSocketFactory.getDefault(); - } else + } else { return sslContext.getServerSocketFactory(); + } } /** @@ -178,8 +179,9 @@ public class SslTransportFactory extends TcpTransportFactory { protected SocketFactory createSocketFactory() { if (sslContext == null) { return SSLSocketFactory.getDefault(); - } else + } else { return sslContext.getSocketFactory(); + } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedInputStream.java b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedInputStream.java index ebab7576c2..878455def8 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedInputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedInputStream.java @@ -47,15 +47,17 @@ public class TcpBufferedInputStream extends FilterInputStream { byte[] buffer = internalBuffer; count = position = 0; int n = in.read(buffer, position, buffer.length - position); - if (n > 0) + if (n > 0) { count = n + position; + } } public int read() throws IOException { if (position >= count) { fill(); - if (position >= count) + if (position >= count) { return -1; + } } return internalBuffer[position++] & 0xff; } @@ -68,8 +70,9 @@ public class TcpBufferedInputStream extends FilterInputStream { } fill(); avail = count - position; - if (avail <= 0) + if (avail <= 0) { return -1; + } } int cnt = (avail < len) ? avail : len; System.arraycopy(internalBuffer, position, b, off, cnt); @@ -86,15 +89,18 @@ public class TcpBufferedInputStream extends FilterInputStream { int n = 0; for (;;) { int nread = readStream(b, off + n, len - n); - if (nread <= 0) + if (nread <= 0) { return (n == 0) ? nread : n; + } n += nread; - if (n >= len) + if (n >= len) { return n; + } // if not closed but no bytes available, return InputStream input = in; - if (input != null && input.available() <= 0) + if (input != null && input.available() <= 0) { return n; + } } } @@ -120,7 +126,8 @@ public class TcpBufferedInputStream extends FilterInputStream { } public void close() throws IOException { - if (in != null) + if (in != null) { in.close(); + } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java index 1b831374da..8f1b9453ae 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java @@ -29,7 +29,7 @@ import java.io.OutputStream; */ public class TcpBufferedOutputStream extends FilterOutputStream { - private final static int BUFFER_SIZE = 8192; + private static final int BUFFER_SIZE = 8192; private byte[] buffer; private int bufferlen; private int count; @@ -123,7 +123,7 @@ public class TcpBufferedOutputStream extends FilterOutputStream { * * @throws IOException */ - private final void checkClosed() throws IOException { + private void checkClosed() throws IOException { if (closed) { throw new EOFException("Cannot write to the stream any more it has already been closed"); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java index 5c1a7fe755..153306260b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java @@ -49,7 +49,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class TcpTransport extends TransportThreadSupport implements Transport, Service, Runnable { - private static final Log log = LogFactory.getLog(TcpTransport.class); + private static final Log LOG = LogFactory.getLog(TcpTransport.class); protected final URI remoteLocation; protected final URI localLocation; @@ -130,7 +130,7 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S * reads packets from a Socket */ public void run() { - log.trace("TCP consumer thread starting"); + LOG.trace("TCP consumer thread starting"); try { while (!isStopped()) { doRun(); @@ -284,8 +284,8 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S sock.setReceiveBufferSize(socketBufferSize); sock.setSendBufferSize(socketBufferSize); } catch (SocketException se) { - log.warn("Cannot set socket buffer size = " + socketBufferSize); - log.debug("Cannot set socket buffer size. Reason: " + se, se); + LOG.warn("Cannot set socket buffer size = " + socketBufferSize); + LOG.debug("Cannot set socket buffer size. Reason: " + se, se); } sock.setSoTimeout(soTimeout); @@ -352,8 +352,8 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S } protected void doStop(ServiceStopper stopper) throws Exception { - if (log.isDebugEnabled()) { - log.debug("Stopping transport " + this); + if (LOG.isDebugEnabled()) { + LOG.debug("Stopping transport " + this); } // Closing the streams flush the sockets before closing.. if the socket diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java index bb3a983bd7..ba842dcab6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java @@ -41,7 +41,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TcpTransportFactory extends TransportFactory { - private static final Log log = LogFactory.getLog(TcpTransportFactory.class); + private static final Log LOG = LogFactory.getLog(TcpTransportFactory.class); public TransportServer doBind(String brokerId, final URI location) throws IOException { try { @@ -117,7 +117,7 @@ public class TcpTransportFactory extends TransportFactory { String localString = location.getScheme() + ":/" + path; localLocation = new URI(localString); } catch (Exception e) { - log.warn("path isn't a valid local location for TcpTransport to use", e); + LOG.warn("path isn't a valid local location for TcpTransport to use", e); } } SocketFactory socketFactory = createSocketFactory(); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java index 0dcdf4cd63..084a566389 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java @@ -50,7 +50,7 @@ import org.apache.commons.logging.LogFactory; public class TcpTransportServer extends TransportServerThreadSupport { - private static final Log log = LogFactory.getLog(TcpTransportServer.class); + private static final Log LOG = LogFactory.getLog(TcpTransportServer.class); protected ServerSocket serverSocket; protected int backlog = 5000; protected WireFormatFactory wireFormatFactory = new OpenWireFormatFactory(); @@ -176,7 +176,7 @@ public class TcpTransportServer extends TransportServerThreadSupport { if (!isStopping()) { onAcceptError(e); } else if (!isStopped()) { - log.warn("run()", e); + LOG.warn("run()", e); onAcceptError(e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java b/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java index 75351ee64f..2e927be708 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java @@ -30,24 +30,24 @@ import org.apache.activemq.transport.reliable.Replayer; */ public interface CommandChannel extends Replayer, Service { - public Command read() throws IOException; + Command read() throws IOException; - public void write(Command command, SocketAddress address) throws IOException; + void write(Command command, SocketAddress address) throws IOException; - public int getDatagramSize(); + int getDatagramSize(); /** * Sets the default size of a datagram on the network. */ - public void setDatagramSize(int datagramSize); + void setDatagramSize(int datagramSize); - public DatagramHeaderMarshaller getHeaderMarshaller(); + DatagramHeaderMarshaller getHeaderMarshaller(); - public void setHeaderMarshaller(DatagramHeaderMarshaller headerMarshaller); + void setHeaderMarshaller(DatagramHeaderMarshaller headerMarshaller); - public void setTargetAddress(SocketAddress address); + void setTargetAddress(SocketAddress address); - public void setReplayAddress(SocketAddress address); + void setReplayAddress(SocketAddress address); - public void setReplayBuffer(ReplayBuffer replayBuffer); + void setReplayBuffer(ReplayBuffer replayBuffer); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramChannel.java b/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramChannel.java index 6ad1c7dd5b..dc097a4695 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramChannel.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramChannel.java @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; */ public class CommandDatagramChannel extends CommandChannelSupport { - private static final Log log = LogFactory.getLog(CommandDatagramChannel.class); + private static final Log LOG = LogFactory.getLog(CommandDatagramChannel.class); private DatagramChannel channel; private ByteBufferPool bufferPool; @@ -103,8 +103,8 @@ public class CommandDatagramChannel extends CommandChannelSupport { if (answer != null) { answer.setFrom(from); - if (log.isDebugEnabled()) { - log.debug("Channel: " + name + " received from: " + from + " about to process: " + answer); + if (LOG.isDebugEnabled()) { + LOG.debug("Channel: " + name + " received from: " + from + " about to process: " + answer); } } return answer; @@ -233,9 +233,9 @@ public class CommandDatagramChannel extends CommandChannelSupport { writeBuffer.flip(); - if (log.isDebugEnabled()) { + if (LOG.isDebugEnabled()) { String text = redelivery ? "REDELIVERING" : "sending"; - log.debug("Channel: " + name + " " + text + " datagram: " + commandId + " to: " + address); + LOG.debug("Channel: " + name + " " + text + " datagram: " + commandId + " to: " + address); } channel.send(writeBuffer, address); } @@ -245,8 +245,8 @@ public class CommandDatagramChannel extends CommandChannelSupport { ByteBuffer writeBuffer = (ByteBuffer)buffer; sendWriteBuffer(commandId, getReplayAddress(), writeBuffer, true); } else { - if (log.isWarnEnabled()) { - log.warn("Request for buffer: " + commandId + " is no longer present"); + if (LOG.isWarnEnabled()) { + LOG.warn("Request for buffer: " + commandId + " is no longer present"); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramSocket.java b/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramSocket.java index 122a8eb671..dfb87e4b06 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramSocket.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramSocket.java @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; */ public class CommandDatagramSocket extends CommandChannelSupport { - private static final Log log = LogFactory.getLog(CommandDatagramSocket.class); + private static final Log LOG = LogFactory.getLog(CommandDatagramSocket.class); private DatagramSocket channel; private Object readLock = new Object(); @@ -80,8 +80,8 @@ public class CommandDatagramSocket extends CommandChannelSupport { if (answer != null) { answer.setFrom(from); - if (log.isDebugEnabled()) { - log.debug("Channel: " + name + " about to process: " + answer); + if (LOG.isDebugEnabled()) { + LOG.debug("Channel: " + name + " about to process: " + answer); } } return answer; @@ -201,9 +201,9 @@ public class CommandDatagramSocket extends CommandChannelSupport { bufferCache.addBuffer(commandId, data); } - if (log.isDebugEnabled()) { + if (LOG.isDebugEnabled()) { String text = redelivery ? "REDELIVERING" : "sending"; - log.debug("Channel: " + name + " " + text + " datagram: " + commandId + " to: " + address); + LOG.debug("Channel: " + name + " " + text + " datagram: " + commandId + " to: " + address); } DatagramPacket packet = new DatagramPacket(data, 0, data.length, address); channel.send(packet); @@ -214,8 +214,8 @@ public class CommandDatagramSocket extends CommandChannelSupport { byte[] data = (byte[])buffer; sendWriteBuffer(commandId, replayAddress, data, true); } else { - if (log.isWarnEnabled()) { - log.warn("Request for buffer: " + commandId + " is no longer present"); + if (LOG.isWarnEnabled()) { + LOG.warn("Request for buffer: " + commandId + " is no longer present"); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/udp/ResponseRedirectInterceptor.java b/activemq-core/src/main/java/org/apache/activemq/transport/udp/ResponseRedirectInterceptor.java index 1e79ddf9f4..4ca632428a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/udp/ResponseRedirectInterceptor.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/udp/ResponseRedirectInterceptor.java @@ -22,7 +22,6 @@ import org.apache.activemq.transport.Transport; import org.apache.activemq.transport.TransportFilter; /** - * * @version $Revision: $ */ public class ResponseRedirectInterceptor extends TransportFilter { @@ -34,11 +33,11 @@ public class ResponseRedirectInterceptor extends TransportFilter { } public void onCommand(Object o) { - final Command command = (Command) o; + final Command command = (Command)o; // redirect to the endpoint that the last response came from Endpoint from = command.getFrom(); transport.setTargetEndpoint(from); - + super.onCommand(command); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java index e87cc5adb0..2fc45e0389 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java @@ -50,7 +50,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class UdpTransport extends TransportThreadSupport implements Transport, Service, Runnable { - private static final Log log = LogFactory.getLog(UdpTransport.class); + private static final Log LOG = LogFactory.getLog(UdpTransport.class); private static final int MAX_BIND_ATTEMPTS = 50; private static final long BIND_ATTEMPT_DELAY = 100; @@ -119,8 +119,8 @@ public class UdpTransport extends TransportThreadSupport implements Transport, S * A one way asynchronous send to a given address */ public void oneway(Object command, SocketAddress address) throws IOException { - if (log.isDebugEnabled()) { - log.debug("Sending oneway from: " + this + " to target: " + targetAddress + " command: " + command); + if (LOG.isDebugEnabled()) { + LOG.debug("Sending oneway from: " + this + " to target: " + targetAddress + " command: " + command); } checkStarted(); commandChannel.write((Command)command, address); @@ -141,7 +141,7 @@ public class UdpTransport extends TransportThreadSupport implements Transport, S * reads packets from a Socket */ public void run() { - log.trace("Consumer thread starting for: " + toString()); + LOG.trace("Consumer thread starting for: " + toString()); while (!isStopped()) { try { Command command = commandChannel.read(); @@ -151,34 +151,34 @@ public class UdpTransport extends TransportThreadSupport implements Transport, S try { stop(); } catch (Exception e2) { - log.warn("Caught in: " + this + " while closing: " + e2 + ". Now Closed", e2); + LOG.warn("Caught in: " + this + " while closing: " + e2 + ". Now Closed", e2); } } catch (SocketException e) { // DatagramSocket closed - log.debug("Socket closed: " + e, e); + LOG.debug("Socket closed: " + e, e); try { stop(); } catch (Exception e2) { - log.warn("Caught in: " + this + " while closing: " + e2 + ". Now Closed", e2); + LOG.warn("Caught in: " + this + " while closing: " + e2 + ". Now Closed", e2); } } catch (EOFException e) { // DataInputStream closed - log.debug("Socket closed: " + e, e); + LOG.debug("Socket closed: " + e, e); try { stop(); } catch (Exception e2) { - log.warn("Caught in: " + this + " while closing: " + e2 + ". Now Closed", e2); + LOG.warn("Caught in: " + this + " while closing: " + e2 + ". Now Closed", e2); } } catch (Exception e) { try { stop(); } catch (Exception e2) { - log.warn("Caught in: " + this + " while closing: " + e2 + ". Now Closed", e2); + LOG.warn("Caught in: " + this + " while closing: " + e2 + ". Now Closed", e2); } if (e instanceof IOException) { onException((IOException)e); } else { - log.error("Caught: " + e, e); + LOG.error("Caught: " + e, e); e.printStackTrace(); } } @@ -377,8 +377,8 @@ public class UdpTransport extends TransportThreadSupport implements Transport, S protected void bind(DatagramSocket socket, SocketAddress localAddress) throws IOException { channel.configureBlocking(true); - if (log.isDebugEnabled()) { - log.debug("Binding to address: " + localAddress); + if (LOG.isDebugEnabled()) { + LOG.debug("Binding to address: " + localAddress); } // @@ -392,8 +392,9 @@ public class UdpTransport extends TransportThreadSupport implements Transport, S socket.bind(localAddress); return; } catch (BindException e) { - if (i + 1 == MAX_BIND_ATTEMPTS) + if (i + 1 == MAX_BIND_ATTEMPTS) { throw e; + } try { Thread.sleep(BIND_ATTEMPT_DELAY); } catch (InterruptedException e1) { diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java b/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java index 9db887f308..e439ab3c3a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java @@ -46,7 +46,7 @@ import org.apache.commons.logging.LogFactory; */ public class UdpTransportServer extends TransportServerSupport { - private static final Log log = LogFactory.getLog(UdpTransportServer.class); + private static final Log LOG = LogFactory.getLog(UdpTransportServer.class); private UdpTransport serverTransport; private ReplayStrategy replayStrategy; @@ -76,7 +76,7 @@ public class UdpTransportServer extends TransportServerSupport { } protected void doStart() throws Exception { - log.info("Starting " + this); + LOG.info("Starting " + this); configuredTransport.setTransportListener(new TransportListener() { public void onCommand(Object o) { @@ -85,7 +85,7 @@ public class UdpTransportServer extends TransportServerSupport { } public void onException(IOException error) { - log.error("Caught: " + error, error); + LOG.error("Caught: " + error, error); } public void transportInterupted() { @@ -103,30 +103,30 @@ public class UdpTransportServer extends TransportServerSupport { protected void processInboundConnection(Command command) { DatagramEndpoint endpoint = (DatagramEndpoint)command.getFrom(); - if (log.isDebugEnabled()) { - log.debug("Received command on: " + this + " from address: " + endpoint + " command: " + command); + if (LOG.isDebugEnabled()) { + LOG.debug("Received command on: " + this + " from address: " + endpoint + " command: " + command); } Transport transport = null; synchronized (transports) { transport = (Transport)transports.get(endpoint); if (transport == null) { if (usingWireFormatNegotiation && !command.isWireFormatInfo()) { - log.error("Received inbound server communication from: " + command.getFrom() + " expecting WireFormatInfo but was command: " + command); + LOG.error("Received inbound server communication from: " + command.getFrom() + " expecting WireFormatInfo but was command: " + command); } else { - if (log.isDebugEnabled()) { - log.debug("Creating a new UDP server connection"); + if (LOG.isDebugEnabled()) { + LOG.debug("Creating a new UDP server connection"); } try { transport = createTransport(command, endpoint); transport = configureTransport(transport); transports.put(endpoint, transport); } catch (IOException e) { - log.error("Caught: " + e, e); + LOG.error("Caught: " + e, e); getAcceptListener().onAcceptError(e); } } } else { - log.warn("Discarding duplicate command to server from: " + endpoint + " command: " + command); + LOG.warn("Discarding duplicate command to server from: " + endpoint + " command: " + command); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java index ff204d52b4..2a44469a6c 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.transport.vm; import java.io.IOException; @@ -39,9 +41,9 @@ import org.apache.commons.logging.LogFactory; */ public class VMTransport implements Transport, Task { - private static final Log log = LogFactory.getLog(VMTransport.class); - private static final AtomicLong nextId = new AtomicLong(0); - private static final TaskRunnerFactory taskRunnerFactory = new TaskRunnerFactory("VMTransport", Thread.NORM_PRIORITY, true, 1000); + private static final Log LOG = LogFactory.getLog(VMTransport.class); + private static final AtomicLong NEXT_ID = new AtomicLong(0); + private static final TaskRunnerFactory TASK_RUNNER_FACTORY = new TaskRunnerFactory("VMTransport", Thread.NORM_PRIORITY, true, 1000); protected VMTransport peer; protected TransportListener transportListener; protected boolean disposed; @@ -49,7 +51,7 @@ public class VMTransport implements Transport, Task { protected boolean network; protected boolean async = true; protected int asyncQueueDepth = 2000; - protected LinkedBlockingQueue messageQueue = null; + protected LinkedBlockingQueue messageQueue; protected boolean started; protected final URI location; protected final long id; @@ -58,7 +60,7 @@ public class VMTransport implements Transport, Task { public VMTransport(URI location) { this.location = location; - this.id = nextId.getAndIncrement(); + this.id = NEXT_ID.getAndIncrement(); } public VMTransport getPeer() { @@ -77,8 +79,9 @@ public class VMTransport implements Transport, Task { if (disposed) { throw new TransportDisposedIOException("Transport disposed."); } - if (peer == null) + if (peer == null) { throw new IOException("Peer not connected."); + } TransportListener tl = null; synchronized (peer.mutex) { @@ -146,8 +149,9 @@ public class VMTransport implements Transport, Task { } public void start() throws Exception { - if (transportListener == null) + if (transportListener == null) { throw new IOException("TransportListener not set."); + } synchronized (mutex) { if (messageQueue != null) { @@ -219,8 +223,9 @@ public class VMTransport implements Transport, Task { final TransportListener tl; synchronized (mutex) { tl = transportListener; - if (!started || disposed || tl == null) + if (!started || disposed || tl == null) { return false; + } } LinkedBlockingQueue mq = getMessageQueue(); @@ -265,7 +270,7 @@ public class VMTransport implements Transport, Task { if (async) { synchronized (mutex) { if (taskRunner == null) { - taskRunner = taskRunnerFactory.createTaskRunner(this, "VMTransport: " + toString()); + taskRunner = TASK_RUNNER_FACTORY.createTaskRunner(this, "VMTransport: " + toString()); } } try { diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java index 3f557110c1..7013ea245e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java @@ -41,10 +41,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class VMTransportFactory extends TransportFactory { - private static final Log log = LogFactory.getLog(VMTransportFactory.class); - final public static ConcurrentHashMap brokers = new ConcurrentHashMap(); - final public static ConcurrentHashMap connectors = new ConcurrentHashMap(); - final public static ConcurrentHashMap servers = new ConcurrentHashMap(); + + public static final ConcurrentHashMap BROKERS = new ConcurrentHashMap(); + public static final ConcurrentHashMap CONNECTORS = new ConcurrentHashMap(); + public static final ConcurrentHashMap SERVERS = new ConcurrentHashMap(); + private static final Log LOG = LogFactory.getLog(VMTransportFactory.class); + BrokerFactoryHandler brokerFactoryHandler; public Transport doConnect(URI location) throws Exception { @@ -61,10 +63,12 @@ public class VMTransportFactory extends TransportFactory { brokerURI = data.getComponents()[0]; CompositeData brokerData = URISupport.parseComposite(brokerURI); host = (String)brokerData.getParameters().get("brokerName"); - if (host == null) + if (host == null) { host = "localhost"; - if (brokerData.getPath() != null) + } + if (brokerData.getPath() != null) { host = data.getPath(); + } options = data.getParameters(); location = new URI("vm://" + host); } else { @@ -92,7 +96,7 @@ public class VMTransportFactory extends TransportFactory { if (host == null) { host = "localhost"; } - VMTransportServer server = (VMTransportServer)servers.get(host); + VMTransportServer server = (VMTransportServer)SERVERS.get(host); // validate the broker is still active if (!validateBroker(host) || server == null) { BrokerService broker = null; @@ -116,17 +120,17 @@ public class VMTransportFactory extends TransportFactory { } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } - brokers.put(host, broker); + BROKERS.put(host, broker); } - server = (VMTransportServer)servers.get(host); + server = (VMTransportServer)SERVERS.get(host); if (server == null) { server = (VMTransportServer)bind(location, true); TransportConnector connector = new TransportConnector(broker.getBroker(), server); connector.setUri(location); connector.setTaskRunnerFactory(broker.getTaskRunnerFactory()); connector.start(); - connectors.put(host, connector); + CONNECTORS.put(host, connector); } } @@ -157,24 +161,24 @@ public class VMTransportFactory extends TransportFactory { */ private TransportServer bind(URI location, boolean dispose) throws IOException { String host = location.getHost(); - log.debug("binding to broker: " + host); + LOG.debug("binding to broker: " + host); VMTransportServer server = new VMTransportServer(location, dispose); - Object currentBoundValue = servers.get(host); + Object currentBoundValue = SERVERS.get(host); if (currentBoundValue != null) { throw new IOException("VMTransportServer already bound at: " + location); } - servers.put(host, server); + SERVERS.put(host, server); return server; } public static void stopped(VMTransportServer server) { String host = server.getBindURI().getHost(); - servers.remove(host); - TransportConnector connector = (TransportConnector)connectors.remove(host); + SERVERS.remove(host); + TransportConnector connector = (TransportConnector)CONNECTORS.remove(host); if (connector != null) { - log.debug("Shutting down VM connectors for broker: " + host); + LOG.debug("Shutting down VM connectors for broker: " + host); ServiceSupport.dispose(connector); - BrokerService broker = (BrokerService)brokers.remove(host); + BrokerService broker = (BrokerService)BROKERS.remove(host); if (broker != null) { ServiceSupport.dispose(broker); } @@ -182,12 +186,12 @@ public class VMTransportFactory extends TransportFactory { } public static void stopped(String host) { - servers.remove(host); - TransportConnector connector = (TransportConnector)connectors.remove(host); + SERVERS.remove(host); + TransportConnector connector = (TransportConnector)CONNECTORS.remove(host); if (connector != null) { - log.debug("Shutting down VM connectors for broker: " + host); + LOG.debug("Shutting down VM connectors for broker: " + host); ServiceSupport.dispose(connector); - BrokerService broker = (BrokerService)brokers.remove(host); + BrokerService broker = (BrokerService)BROKERS.remove(host); if (broker != null) { ServiceSupport.dispose(broker); } @@ -204,17 +208,17 @@ public class VMTransportFactory extends TransportFactory { private boolean validateBroker(String host) { boolean result = true; - if (brokers.containsKey(host) || servers.containsKey(host) || connectors.containsKey(host)) { + if (BROKERS.containsKey(host) || SERVERS.containsKey(host) || CONNECTORS.containsKey(host)) { // check the broker is still in the BrokerRegistry - TransportConnector connector = (TransportConnector)connectors.get(host); + TransportConnector connector = (TransportConnector)CONNECTORS.get(host); if (BrokerRegistry.getInstance().lookup(host) == null || (connector != null && connector.getBroker().isStopped())) { result = false; // clean-up - brokers.remove(host); - servers.remove(host); + BROKERS.remove(host); + SERVERS.remove(host); if (connector != null) { - connectors.remove(host); + CONNECTORS.remove(host); if (connector != null) { ServiceSupport.dispose(connector); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java index 2ad93fc4b8..99e7cbd917 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java @@ -63,18 +63,21 @@ public class VMTransportServer implements TransportServer { public VMTransport connect() throws IOException { TransportAcceptListener al; synchronized (this) { - if (disposed) + if (disposed) { throw new IOException("Server has been disposed."); + } al = acceptListener; } - if (al == null) + if (al == null) { throw new IOException("Server TransportAcceptListener is null."); + } connectionCount.incrementAndGet(); VMTransport client = new VMTransport(location) { public void stop() throws Exception { - if (disposed) + if (disposed) { return; + } super.stop(); if (connectionCount.decrementAndGet() == 0 && disposeOnDisconnect) { VMTransportServer.this.stop(); @@ -106,7 +109,7 @@ public class VMTransportServer implements TransportServer { * * @param acceptListener */ - synchronized public void setAcceptListener(TransportAcceptListener acceptListener) { + public synchronized void setAcceptListener(TransportAcceptListener acceptListener) { this.acceptListener = acceptListener; } diff --git a/activemq-core/src/main/java/org/apache/activemq/util/BitArrayBin.java b/activemq-core/src/main/java/org/apache/activemq/util/BitArrayBin.java index 370a4249d2..00f2e1abd7 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/BitArrayBin.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/BitArrayBin.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.util; import java.util.LinkedList; diff --git a/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java index 98546bd850..11d518efdb 100644 --- a/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ public class BrokerSupport { * @param deadLetterDestination * @throws Exception */ - static public void resend(final ConnectionContext context, Message message, ActiveMQDestination deadLetterDestination) throws Exception { + public static void resend(final ConnectionContext context, Message message, ActiveMQDestination deadLetterDestination) throws Exception { if (message.getOriginalDestination() != null) { message.setOriginalDestination(message.getDestination()); } diff --git a/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayInputStream.java b/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayInputStream.java index ffc0fc1d4a..85943bda94 100644 --- a/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayInputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayInputStream.java @@ -45,10 +45,11 @@ public class ByteArrayInputStream extends InputStream { } public int read() throws IOException { - if (pos < limit) + if (pos < limit) { return buffer[pos++] & 0xff; - else + } else { return -1; + } } public int read(byte[] b) throws IOException { diff --git a/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java b/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java index a17b071aaa..c314683aba 100644 --- a/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java @@ -21,11 +21,12 @@ import java.io.IOException; /** * Used to write and read primitives to and from a ByteSequence. */ -final public class ByteSequenceData { +public final class ByteSequenceData { public static byte[] toByteArray(ByteSequence packet) { - if (packet.offset == 0 && packet.length == packet.data.length) + if (packet.offset == 0 && packet.length == packet.data.length) { return packet.data; + } byte rc[] = new byte[packet.length]; System.arraycopy(packet.data, packet.offset, rc, 0, packet.length); diff --git a/activemq-core/src/main/java/org/apache/activemq/util/Callback.java b/activemq-core/src/main/java/org/apache/activemq/util/Callback.java index 5e66262b06..3ca20833e9 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/Callback.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/Callback.java @@ -32,5 +32,5 @@ public interface Callback { * else a rollback is performed * @throws Exception TODO */ - public void execute() throws Exception; + void execute() throws Exception; } diff --git a/activemq-core/src/main/java/org/apache/activemq/util/ClassLoading.java b/activemq-core/src/main/java/org/apache/activemq/util/ClassLoading.java index 7ee89747f7..f2dde0b059 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/ClassLoading.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/ClassLoading.java @@ -56,13 +56,15 @@ public class ClassLoading { // Check if it is a primitive type type = getPrimitiveType(className); - if (type != null) + if (type != null) { return type; + } // Check if it is a vm primitive type = getVMPrimitiveType(className); - if (type != null) + if (type != null) { return type; + } // Handle VM class syntax (Lclassname;) if (className.charAt(0) == 'L' && className.charAt(className.length() - 1) == ';') { @@ -105,10 +107,11 @@ public class ClassLoading { } private static Class load(final String className, final ClassLoader classLoader) throws ClassNotFoundException { - if (classLoader == null) + if (classLoader == null) { return Class.forName(className); - else + } else { return classLoader.loadClass(className); + } } public static String getClassName(Class clazz) { diff --git a/activemq-core/src/main/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStream.java b/activemq-core/src/main/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStream.java index 8e8c2dab9a..bff4201cea 100644 --- a/activemq-core/src/main/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStream.java @@ -22,9 +22,8 @@ import java.io.ObjectInputStream; import java.io.ObjectStreamClass; import java.lang.reflect.Proxy; - public class ClassLoadingAwareObjectInputStream extends ObjectInputStream { - + private static final ClassLoader FALLBACK_CLASS_LOADER = ClassLoadingAwareObjectInputStream.class.getClassLoader(); public ClassLoadingAwareObjectInputStream(InputStream in) throws IOException { @@ -39,8 +38,9 @@ public class ClassLoadingAwareObjectInputStream extends ObjectInputStream { protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Class[] cinterfaces = new Class[interfaces.length]; - for (int i = 0; i < interfaces.length; i++) + for (int i = 0; i < interfaces.length; i++) { cinterfaces[i] = load(interfaces[i], cl); + } try { return Proxy.getProxyClass(cinterfaces[0].getClassLoader(), cinterfaces); @@ -52,7 +52,7 @@ public class ClassLoadingAwareObjectInputStream extends ObjectInputStream { private Class load(String className, ClassLoader cl) throws ClassNotFoundException { try { return ClassLoading.loadClass(className, cl); - } catch ( ClassNotFoundException e ) { + } catch (ClassNotFoundException e) { return ClassLoading.loadClass(className, FALLBACK_CLASS_LOADER); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayInputStream.java b/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayInputStream.java index cd484503ad..3e60677630 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayInputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayInputStream.java @@ -256,8 +256,9 @@ public final class DataByteArrayInputStream extends InputStream implements DataI int total = pos + length; while (pos < total) { c = (int)buf[pos] & 0xff; - if (c > 127) + if (c > 127) { break; + } pos++; characters[count++] = (char)c; } @@ -278,21 +279,25 @@ public final class DataByteArrayInputStream extends InputStream implements DataI case 12: case 13: pos += 2; - if (pos > length) + if (pos > length) { throw new UTFDataFormatException("bad string"); + } c2 = (int)buf[pos - 1]; - if ((c2 & 0xC0) != 0x80) + if ((c2 & 0xC0) != 0x80) { throw new UTFDataFormatException("bad string"); + } characters[count++] = (char)(((c & 0x1F) << 6) | (c2 & 0x3F)); break; case 14: pos += 3; - if (pos > length) + if (pos > length) { throw new UTFDataFormatException("bad string"); + } c2 = (int)buf[pos - 2]; c3 = (int)buf[pos - 1]; - if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80)) + if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80)) { throw new UTFDataFormatException("bad string"); + } characters[count++] = (char)(((c & 0x0F) << 12) | ((c2 & 0x3F) << 6) | ((c3 & 0x3F) << 0)); break; default: diff --git a/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java b/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java index e253d35b8e..0a1f84d615 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java @@ -216,15 +216,17 @@ public final class DataByteArrayOutputStream extends OutputStream implements Dat encodedsize += 2; } } - if (encodedsize > 65535) + if (encodedsize > 65535){ throw new UTFDataFormatException("encoded string too long: " + encodedsize + " bytes"); + } ensureEnoughBuffer(pos + encodedsize + 2); writeShort(encodedsize); int i = 0; for (i = 0; i < strlen; i++) { c = str.charAt(i); - if (!((c >= 0x0001) && (c <= 0x007F))) + if (!((c >= 0x0001) && (c <= 0x007F))) { break; + } buf[pos++] = (byte)c; } for (; i < strlen; i++) { diff --git a/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java b/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java index f31cd59921..434f399f1c 100644 --- a/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java @@ -82,8 +82,9 @@ public class FactoryFinder { // lets try the thread context class loader first ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - if (classLoader == null) + if (classLoader == null) { classLoader = getClass().getClassLoader(); + } InputStream in = classLoader.getResourceAsStream(uri); if (in == null) { in = FactoryFinder.class.getClassLoader().getResourceAsStream(uri); diff --git a/activemq-core/src/main/java/org/apache/activemq/util/HexSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/HexSupport.java index 5788024ac4..589b3c84a1 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/HexSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/HexSupport.java @@ -46,7 +46,7 @@ public class HexSupport { * @param hex * @return */ - static public byte[] toBytesFromHex(String hex) { + public static byte[] toBytesFromHex(String hex) { byte rc[] = new byte[hex.length() / 2]; for (int i = 0; i < rc.length; i++) { String h = hex.substring(i * 2, i * 2 + 2); @@ -60,7 +60,7 @@ public class HexSupport { * @param bytes * @return */ - static public String toHexFromBytes(byte[] bytes) { + public static String toHexFromBytes(byte[] bytes) { StringBuffer rc = new StringBuffer(bytes.length * 2); for (int i = 0; i < bytes.length; i++) { rc.append(HEX_TABLE[0xFF & bytes[i]]); diff --git a/activemq-core/src/main/java/org/apache/activemq/util/IOExceptionSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/IOExceptionSupport.java index 128248bb00..ee0cc4b5ec 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/IOExceptionSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/IOExceptionSupport.java @@ -18,7 +18,7 @@ package org.apache.activemq.util; import java.io.IOException; -final public class IOExceptionSupport { +public final class IOExceptionSupport { public static IOException create(String msg, Throwable cause) { IOException exception = new IOException(msg); diff --git a/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java b/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java index cd81f75f42..0f1dcf7d1d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java @@ -27,7 +27,7 @@ import java.util.logging.Logger; public class IdGenerator { - private static final Logger log = Logger.getLogger(IdGenerator.class.getName()); + private static final Logger LOG = Logger.getLogger(IdGenerator.class.getName()); private static final String UNIQUE_STUB; private static int instanceCount; private static String hostName; @@ -54,7 +54,7 @@ public class IdGenerator { Thread.sleep(100); ss.close(); } catch (Exception ioe) { - log.log(Level.WARNING, "could not generate unique stub", ioe); + LOG.log(Level.WARNING, "could not generate unique stub", ioe); } } else { hostName = "localhost"; diff --git a/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java index c5acc3e214..2384ef83af 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java @@ -35,16 +35,19 @@ import org.apache.activemq.command.ActiveMQDestination; public class IntrospectionSupport { - static public boolean getProperties(Object target, Map props, String optionPrefix) { + public static boolean getProperties(Object target, Map props, String optionPrefix) { boolean rc = false; - if (target == null) + if (target == null) { throw new IllegalArgumentException("target was null."); - if (props == null) + } + if (props == null) { throw new IllegalArgumentException("props was null."); + } - if (optionPrefix == null) + if (optionPrefix == null) { optionPrefix = ""; + } Class clazz = target.getClass(); Method[] methods = clazz.getMethods(); @@ -58,12 +61,14 @@ public class IntrospectionSupport { try { Object value = method.invoke(target, new Object[] {}); - if (value == null) + if (value == null) { continue; + } String strValue = convertToString(value, type); - if (strValue == null) + if (strValue == null) { continue; + } name = name.substring(3, 4).toLowerCase() + name.substring(4); props.put(optionPrefix + name, strValue); @@ -78,12 +83,14 @@ public class IntrospectionSupport { return rc; } - static public boolean setProperties(Object target, Map props, String optionPrefix) { + public static boolean setProperties(Object target, Map props, String optionPrefix) { boolean rc = false; - if (target == null) + if (target == null) { throw new IllegalArgumentException("target was null."); - if (props == null) + } + if (props == null) { throw new IllegalArgumentException("props was null."); + } for (Iterator iter = props.keySet().iterator(); iter.hasNext();) { String name = (String)iter.next(); @@ -100,8 +107,9 @@ public class IntrospectionSupport { } public static Map extractProperties(Map props, String optionPrefix) { - if (props == null) + if (props == null) { throw new IllegalArgumentException("props was null."); + } HashMap rc = new HashMap(props.size()); @@ -121,10 +129,12 @@ public class IntrospectionSupport { public static boolean setProperties(Object target, Map props) { boolean rc = false; - if (target == null) + if (target == null) { throw new IllegalArgumentException("target was null."); - if (props == null) + } + if (props == null) { throw new IllegalArgumentException("props was null."); + } for (Iterator iter = props.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Entry)iter.next(); @@ -141,8 +151,9 @@ public class IntrospectionSupport { try { Class clazz = target.getClass(); Method setter = findSetterMethod(clazz, name); - if (setter == null) + if (setter == null) { return false; + } // If the type is null or it matches the needed type, just use the // value directly @@ -197,20 +208,23 @@ public class IntrospectionSupport { } private static boolean isSettableType(Class clazz) { - if (PropertyEditorManager.findEditor(clazz) != null) + if (PropertyEditorManager.findEditor(clazz) != null) { return true; - if (clazz == URI.class) + } + if (clazz == URI.class) { return true; - if (clazz == Boolean.class) + } + if (clazz == Boolean.class) { return true; + } return false; } - static public String toString(Object target) { + public static String toString(Object target) { return toString(target, Object.class); } - static public String toString(Object target, Class stopClass) { + public static String toString(Object target, Class stopClass) { LinkedHashMap map = new LinkedHashMap(); addFields(target, target.getClass(), stopClass, map); StringBuffer buffer = new StringBuffer(simpleName(target.getClass())); @@ -241,7 +255,7 @@ public class IntrospectionSupport { } } - static public String simpleName(Class clazz) { + public static String simpleName(Class clazz) { String name = clazz.getName(); int p = name.lastIndexOf("."); if (p >= 0) { @@ -250,10 +264,11 @@ public class IntrospectionSupport { return name; } - static private void addFields(Object target, Class startClass, Class stopClass, LinkedHashMap map) { + private static void addFields(Object target, Class startClass, Class stopClass, LinkedHashMap map) { - if (startClass != stopClass) + if (startClass != stopClass) { addFields(target, startClass.getSuperclass(), stopClass, map); + } Field[] fields = startClass.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { diff --git a/activemq-core/src/main/java/org/apache/activemq/util/JMSExceptionSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/JMSExceptionSupport.java index f13aea2c14..cf9f8e1580 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/JMSExceptionSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/JMSExceptionSupport.java @@ -20,7 +20,7 @@ import javax.jms.JMSException; import javax.jms.MessageEOFException; import javax.jms.MessageFormatException; -final public class JMSExceptionSupport { +public final class JMSExceptionSupport { public static JMSException create(String msg, Throwable cause) { JMSException exception = new JMSException(msg); @@ -40,8 +40,9 @@ final public class JMSExceptionSupport { return (JMSException)cause; } String msg = cause.getMessage(); - if (msg == null || msg.length() == 0) + if (msg == null || msg.length() == 0) { msg = cause.toString(); + } JMSException exception = new JMSException(msg); exception.initCause(cause); return exception; @@ -52,8 +53,9 @@ final public class JMSExceptionSupport { return (JMSException)cause; } String msg = cause.getMessage(); - if (msg == null || msg.length() == 0) + if (msg == null || msg.length() == 0) { msg = cause.toString(); + } JMSException exception = new JMSException(msg); exception.setLinkedException(cause); exception.initCause(cause); @@ -62,8 +64,9 @@ final public class JMSExceptionSupport { public static MessageEOFException createMessageEOFException(Exception cause) { String msg = cause.getMessage(); - if (msg == null || msg.length() == 0) + if (msg == null || msg.length() == 0) { msg = cause.toString(); + } MessageEOFException exception = new MessageEOFException(msg); exception.setLinkedException(cause); exception.initCause(cause); @@ -72,8 +75,9 @@ final public class JMSExceptionSupport { public static MessageFormatException createMessageFormatException(Exception cause) { String msg = cause.getMessage(); - if (msg == null || msg.length() == 0) + if (msg == null || msg.length() == 0) { msg = cause.toString(); + } MessageFormatException exception = new MessageFormatException(msg); exception.setLinkedException(cause); exception.initCause(cause); diff --git a/activemq-core/src/main/java/org/apache/activemq/util/JMXSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/JMXSupport.java index 38a55e10df..6a9688f9ad 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/JMXSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/JMXSupport.java @@ -17,7 +17,7 @@ package org.apache.activemq.util; public class JMXSupport { - static public String encodeObjectNamePart(String part) { + public static String encodeObjectNamePart(String part) { //return ObjectName.quote(part); String answer = part.replaceAll("[\\:\\,\\'\\\"]", "_"); answer = answer.replaceAll("\\?", "&qe;"); diff --git a/activemq-core/src/main/java/org/apache/activemq/util/LongSequenceGenerator.java b/activemq-core/src/main/java/org/apache/activemq/util/LongSequenceGenerator.java index c87488b590..53ae7f1afd 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/LongSequenceGenerator.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/LongSequenceGenerator.java @@ -20,15 +20,15 @@ public class LongSequenceGenerator { private long lastSequenceId; - synchronized public long getNextSequenceId() { + public synchronized long getNextSequenceId() { return ++lastSequenceId; } - synchronized public long getLastSequenceId() { + public synchronized long getLastSequenceId() { return lastSequenceId; } - synchronized public void setLastSequenceId(long l) { + public synchronized void setLastSequenceId(long l) { lastSequenceId = l; } diff --git a/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java index aaa9e33a73..19351f5a00 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java @@ -52,7 +52,7 @@ public class MarshallingSupport { public static final byte LIST_TYPE = 12; public static final byte BIG_STRING_TYPE = 13; - static public void marshalPrimitiveMap(Map map, DataOutputStream out) throws IOException { + public static void marshalPrimitiveMap(Map map, DataOutputStream out) throws IOException { if (map == null) { out.writeInt(-1); } else { @@ -66,7 +66,7 @@ public class MarshallingSupport { } } - static public Map unmarshalPrimitiveMap(DataInputStream in) throws IOException { + public static Map unmarshalPrimitiveMap(DataInputStream in) throws IOException { return unmarshalPrimitiveMap(in, Integer.MAX_VALUE); } @@ -76,9 +76,9 @@ public class MarshallingSupport { * @throws IOException * @throws IOException */ - public static Map unmarshalPrimitiveMap(DataInputStream in, int max_property_size) throws IOException { + public static Map unmarshalPrimitiveMap(DataInputStream in, int maxPropertySize) throws IOException { int size = in.readInt(); - if (size > max_property_size) { + if (size > maxPropertySize) { throw new IOException("Primitive map is larger than the allowed size: " + size); } if (size < 0) { @@ -111,7 +111,7 @@ public class MarshallingSupport { return answer; } - static public void marshalPrimitive(DataOutputStream out, Object value) throws IOException { + public static void marshalPrimitive(DataOutputStream out, Object value) throws IOException { if (value == null) { marshalNull(out); } else if (value.getClass() == Boolean.class) { @@ -145,7 +145,7 @@ public class MarshallingSupport { } } - static public Object unmarshalPrimitive(DataInputStream in) throws IOException { + public static Object unmarshalPrimitive(DataInputStream in) throws IOException { Object value = null; byte type = in.readByte(); switch (type) { @@ -260,7 +260,7 @@ public class MarshallingSupport { } } - static public void writeUTF8(DataOutput dataOut, String text) throws IOException { + public static void writeUTF8(DataOutput dataOut, String text) throws IOException { if (text != null) { int strlen = text.length(); int utflen = 0; @@ -307,7 +307,7 @@ public class MarshallingSupport { } } - static public String readUTF8(DataInput dataIn) throws IOException { + public static String readUTF8(DataInput dataIn) throws IOException { int utflen = dataIn.readInt(); // TODO diff: Sun code if (utflen > -1) { StringBuffer str = new StringBuffer(utflen); diff --git a/activemq-core/src/main/java/org/apache/activemq/util/ServiceSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/ServiceSupport.java index 4bbe629896..c7842afc15 100644 --- a/activemq-core/src/main/java/org/apache/activemq/util/ServiceSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/ServiceSupport.java @@ -29,7 +29,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public abstract class ServiceSupport implements Service { - private static final Log log = LogFactory.getLog(ServiceSupport.class); + private static final Log LOG = LogFactory.getLog(ServiceSupport.class); private AtomicBoolean started = new AtomicBoolean(false); private AtomicBoolean stopping = new AtomicBoolean(false); @@ -39,7 +39,7 @@ public abstract class ServiceSupport implements Service { try { service.stop(); } catch (Exception e) { - log.debug("Could not stop service: " + service + ". Reason: " + e, e); + LOG.debug("Could not stop service: " + service + ". Reason: " + e, e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/util/TransactionTemplate.java b/activemq-core/src/main/java/org/apache/activemq/util/TransactionTemplate.java index 965969d5dd..3b449e764a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/TransactionTemplate.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/TransactionTemplate.java @@ -28,7 +28,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.2 $ */ public class TransactionTemplate { - static private final Log LOG = LogFactory.getLog(TransactionTemplate.class); + private static final Log LOG = LogFactory.getLog(TransactionTemplate.class); private PersistenceAdapter persistenceAdapter; private ConnectionContext context; diff --git a/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java index ce71110f75..943cec88a8 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java @@ -48,7 +48,7 @@ public class TypeConversionSupport { Object convert(Object value); } - static final private HashMap CONVERSION_MAP = new HashMap(); + private static final HashMap CONVERSION_MAP = new HashMap(); static { Converter toStringConverter = new Converter() { public Object convert(Object value) { @@ -139,16 +139,18 @@ public class TypeConversionSupport { }); } - static public Object convert(Object value, Class clazz) { + public static Object convert(Object value, Class clazz) { assert value != null && clazz != null; - if (value.getClass() == clazz) + if (value.getClass() == clazz) { return value; + } Converter c = (Converter) CONVERSION_MAP.get(new ConversionKey(value.getClass(), clazz)); - if (c == null) + if (c == null) { return null; + } return c.convert(value); } diff --git a/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java b/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java index a06052dd72..3bfb187f76 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java @@ -76,8 +76,9 @@ public class URISupport { } else { sb.append('('); for (int i = 0; i < components.length; i++) { - if (i != 0) + if (i != 0) { sb.append(','); + } sb.append(components[i].toString()); } sb.append(')'); @@ -197,8 +198,9 @@ public class URISupport { } rc.parameters = parseQuery(params.substring(p + 1)); } else { - if (params.length() > 0) + if (params.length() > 0) { rc.path = stripPrefix(params, "/"); + } rc.parameters = Collections.EMPTY_MAP; } } @@ -233,8 +235,9 @@ public class URISupport { } String s = str.substring(last); - if (s.length() != 0) + if (s.length() != 0) { l.add(s); + } String rc[] = new String[l.size()]; l.toArray(rc); @@ -242,8 +245,9 @@ public class URISupport { } public static String stripPrefix(String value, String prefix) { - if (value.startsWith(prefix)) + if (value.startsWith(prefix)) { return value.substring(prefix.length()); + } return value; } @@ -257,11 +261,11 @@ public class URISupport { StringBuffer rc = new StringBuffer(); boolean first = true; for (Iterator iter = options.keySet().iterator(); iter.hasNext();) { - if (first) + if (first) { first = false; - else + } else { rc.append("&"); - + } String key = (String)iter.next(); String value = (String)options.get(key); rc.append(URLEncoder.encode(key, "UTF-8")); @@ -284,12 +288,13 @@ public class URISupport { */ public static URI createRemainingURI(URI originalURI, Map params) throws URISyntaxException { String s = createQueryString(params); - if (s.length() == 0) + if (s.length() == 0) { s = null; + } return createURIWithQuery(originalURI, s); } - static public URI changeScheme(URI bindAddr, String scheme) throws URISyntaxException { + public static URI changeScheme(URI bindAddr, String scheme) throws URISyntaxException { return new URI(scheme, bindAddr.getUserInfo(), bindAddr.getHost(), bindAddr.getPort(), bindAddr.getPath(), bindAddr.getQuery(), bindAddr.getFragment()); } diff --git a/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormat.java b/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormat.java index 0bf33209bd..2375fcd66b 100644 --- a/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormat.java +++ b/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormat.java @@ -54,11 +54,11 @@ public interface WireFormat { /** * @param the version of the wire format */ - public void setVersion(int version); + void setVersion(int version); /** * @return the version of the wire format */ - public int getVersion(); + int getVersion(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java b/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java index b0ef07ed5c..77bf82a83d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java @@ -34,7 +34,7 @@ import org.springframework.core.io.Resource; */ public class PooledBrokerFactoryBean implements FactoryBean, InitializingBean, DisposableBean { - static final HashMap sharedBrokerMap = new HashMap(); + static final HashMap SHARED_BROKER_MAP = new HashMap(); private boolean start; private Resource config; @@ -45,28 +45,28 @@ public class PooledBrokerFactoryBean implements FactoryBean, InitializingBean, D } public void afterPropertiesSet() throws Exception { - synchronized (sharedBrokerMap) { - SharedBroker sharedBroker = (SharedBroker)sharedBrokerMap.get(config.getFilename()); + synchronized (SHARED_BROKER_MAP) { + SharedBroker sharedBroker = (SharedBroker)SHARED_BROKER_MAP.get(config.getFilename()); if (sharedBroker == null) { sharedBroker = new SharedBroker(); sharedBroker.factory = new BrokerFactoryBean(); sharedBroker.factory.setConfig(config); sharedBroker.factory.setStart(start); sharedBroker.factory.afterPropertiesSet(); - sharedBrokerMap.put(config.getFilename(), sharedBroker); + SHARED_BROKER_MAP.put(config.getFilename(), sharedBroker); } sharedBroker.refCount++; } } public void destroy() throws Exception { - synchronized (sharedBrokerMap) { - SharedBroker sharedBroker = (SharedBroker)sharedBrokerMap.get(config.getFilename()); + synchronized (SHARED_BROKER_MAP) { + SharedBroker sharedBroker = (SharedBroker)SHARED_BROKER_MAP.get(config.getFilename()); if (sharedBroker != null) { sharedBroker.refCount--; if (sharedBroker.refCount == 0) { sharedBroker.factory.destroy(); - sharedBrokerMap.remove(config.getFilename()); + SHARED_BROKER_MAP.remove(config.getFilename()); } } } @@ -77,8 +77,8 @@ public class PooledBrokerFactoryBean implements FactoryBean, InitializingBean, D } public Object getObject() throws Exception { - synchronized (sharedBrokerMap) { - SharedBroker sharedBroker = (SharedBroker)sharedBrokerMap.get(config.getFilename()); + synchronized (SHARED_BROKER_MAP) { + SharedBroker sharedBroker = (SharedBroker)SHARED_BROKER_MAP.get(config.getFilename()); if (sharedBroker != null) { return sharedBroker.factory.getObject(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java b/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java index 5dcd643ed4..b299705127 100644 --- a/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java @@ -39,7 +39,7 @@ import org.springframework.util.ResourceUtils; * @version $Revision$ */ public class XBeanBrokerFactory implements BrokerFactoryHandler { - private static final transient Log log = LogFactory.getLog(XBeanBrokerFactory.class); + private static final transient Log LOG = LogFactory.getLog(XBeanBrokerFactory.class); static { PropertyEditorManager.registerEditor(URI.class, URIEditor.class); @@ -77,7 +77,7 @@ public class XBeanBrokerFactory implements BrokerFactoryHandler { } protected ApplicationContext createApplicationContext(String uri) throws MalformedURLException { - log.debug("Now attempting to figure out the type of resource: " + uri); + LOG.debug("Now attempting to figure out the type of resource: " + uri); Resource resource; File file = new File(uri); diff --git a/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java b/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java index 9597888beb..1d15b21aa0 100644 --- a/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java +++ b/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java @@ -1,3 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.activemq; import java.net.URI; @@ -35,7 +51,7 @@ import org.springframework.jms.core.MessageCreator; import org.springframework.jms.listener.DefaultMessageListenerContainer; public class AMQDeadlockTest3 extends TestCase { - private static final transient Log log = LogFactory.getLog(AMQDeadlockTest3.class); + private static final transient Log LOG = LogFactory.getLog(AMQDeadlockTest3.class); private static final String URL1 = "tcp://localhost:61616"; @@ -289,7 +305,7 @@ public class AMQDeadlockTest3 extends TestCase { public void onMessage(Message msg) { try { - log.info("Listener1 Consumed message " + msg.getIntProperty("count")); + LOG.info("Listener1 Consumed message " + msg.getIntProperty("count")); messageCount.incrementAndGet(); doneLatch.countDown(); @@ -349,12 +365,12 @@ public class AMQDeadlockTest3 extends TestCase { } }); - log.info("PooledProducer sent message: " + count.get()); + LOG.info("PooledProducer sent message: " + count.get()); // Thread.sleep(1000); } } catch (final Throwable e) { - log.error("Producer 1 is exiting", e); + LOG.error("Producer 1 is exiting", e); } } } @@ -402,13 +418,13 @@ public class AMQDeadlockTest3 extends TestCase { } }); - log.info("Non-PooledProducer sent message: " + count.get()); + LOG.info("Non-PooledProducer sent message: " + count.get()); // Thread.sleep(1000); } } catch (final Throwable e) { - log.error("Producer 1 is exiting", e); + LOG.error("Producer 1 is exiting", e); } } } diff --git a/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java b/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java index 9230c23356..290a387d89 100755 --- a/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java @@ -29,8 +29,12 @@ import javax.jms.Session; import org.apache.activemq.broker.BrokerRegistry; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.TransportConnector; +import org.apache.activemq.network.DiscoveryNetworkConnector; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public class ActiveMQConnectionFactoryTest extends CombinationTestSupport { + private static final Log LOG = LogFactory.getLog(ActiveMQConnectionFactoryTest.class); private ActiveMQConnection connection; private BrokerService broker; @@ -44,7 +48,7 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport { connection.start(); String clientID = connection.getClientID(); - log.info("Got client ID: " + clientID); + LOG.info("Got client ID: " + clientID); assertTrue("should start with Cheese! but was: " + clientID, clientID.startsWith("Cheese")); } @@ -117,7 +121,7 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport { connection.start(); String brokerName = connection.getBrokerName(); - log.info("Got broker name: " + brokerName); + LOG.info("Got broker name: " + brokerName); assertNotNull("No broker name available!", brokerName); } @@ -172,7 +176,7 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport { URI connectURI = new URI(temp.getScheme(), temp.getUserInfo(), temp.getHost(), currentURI.getPort(), temp.getPath(), temp.getQuery(), temp.getFragment()); - log.info("connection URI is: " + connectURI); + LOG.info("connection URI is: " + connectURI); // This should create the connection. ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(connectURI); diff --git a/activemq-core/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java b/activemq-core/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java index f4630fb2c4..d240bc0aae 100755 --- a/activemq-core/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq; import java.util.ArrayList; diff --git a/activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java b/activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java index bfac07e064..980a35e0b8 100644 --- a/activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java @@ -28,8 +28,12 @@ import javax.jms.XATopicConnection; import org.apache.activemq.broker.BrokerRegistry; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.TransportConnector; +import org.apache.activemq.transport.stomp.StompTransportFilter; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport { + private static final Log LOG = LogFactory.getLog(ActiveMQXAConnectionFactoryTest.class); public void testCopy() throws URISyntaxException, JMSException { ActiveMQXAConnectionFactory cf = new ActiveMQXAConnectionFactory("vm://localhost?"); @@ -78,7 +82,7 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport { connection.start(); String brokerName = connection.getBrokerName(); - log.info("Got broker name: " + brokerName); + LOG.info("Got broker name: " + brokerName); assertNotNull("No broker name available!", brokerName); connection.close(); @@ -110,7 +114,7 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport { URI connectURI = new URI(temp.getScheme(), temp.getUserInfo(), temp.getHost(), currentURI.getPort(), temp.getPath(), temp.getQuery(), temp.getFragment()); - log.info("connection URI is: " + connectURI); + LOG.info("connection URI is: " + connectURI); // This should create the connection. ActiveMQXAConnectionFactory cf = new ActiveMQXAConnectionFactory(connectURI); diff --git a/activemq-core/src/test/java/org/apache/activemq/AutoFailTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/AutoFailTestSupport.java index 3e792bdbfa..76b0a7f32e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/AutoFailTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/AutoFailTestSupport.java @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; */ public abstract class AutoFailTestSupport extends TestCase { - protected static final Log LOG = LogFactory.getLog(AutoFailTestSupport.class); + private static final Log LOG = LogFactory.getLog(AutoFailTestSupport.class); public static final int EXIT_SUCCESS = 0; public static final int EXIT_ERROR = 1; diff --git a/activemq-core/src/test/java/org/apache/activemq/ClientTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/ClientTestSupport.java index 66b2bb2698..1cb27be280 100755 --- a/activemq-core/src/test/java/org/apache/activemq/ClientTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/ClientTestSupport.java @@ -132,12 +132,13 @@ public class ClientTestSupport extends TestCase { return ack; } - protected Message receiveMessage(StubConnection connection, int MAX_WAIT) throws InterruptedException { + protected Message receiveMessage(StubConnection connection, int maxWait) throws InterruptedException { while (true) { - Object o = connection.getDispatchQueue().poll(MAX_WAIT, TimeUnit.MILLISECONDS); + Object o = connection.getDispatchQueue().poll(maxWait, TimeUnit.MILLISECONDS); - if (o == null) + if (o == null) { return null; + } if (o instanceof MessageDispatch) { MessageDispatch dispatch = (MessageDispatch)o; diff --git a/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java index 122d18591b..7b1d0ed943 100755 --- a/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java @@ -60,7 +60,7 @@ import org.apache.commons.logging.LogFactory; */ public abstract class CombinationTestSupport extends AutoFailTestSupport { - protected static final Log log = LogFactory.getLog(CombinationTestSupport.class); + private static final Log LOG = LogFactory.getLog(CombinationTestSupport.class); private HashMap comboOptions = new HashMap(); private boolean combosEvaluated; @@ -108,7 +108,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { Field field = getClass().getField(attribute); field.set(this, value); } catch (Throwable e) { - log.info("Could not set field '" + attribute + "' to value '" + value + "', make sure the field exists and is public."); + LOG.info("Could not set field '" + attribute + "' to value '" + value + "', make sure the field exists and is public."); } } } @@ -190,8 +190,9 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { Method[] methods = clazz.getMethods(); for (int i = 0; i < methods.length; i++) { String name = methods[i].getName(); - if (names.contains(name) || !isPublicTestMethod(methods[i])) + if (names.contains(name) || !isPublicTestMethod(methods[i])) { continue; + } names.add(name); Test test = TestSuite.createTest(clazz, name); if (test instanceof CombinationTestSupport) { @@ -206,11 +207,11 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { return suite; } - static private boolean isPublicTestMethod(Method m) { + private static boolean isPublicTestMethod(Method m) { return isTestMethod(m) && Modifier.isPublic(m.getModifiers()); } - static private boolean isTestMethod(Method m) { + private static boolean isTestMethod(Method m) { String name = m.getName(); Class[] parameters = m.getParameterTypes(); Class returnType = m.getReturnType(); diff --git a/activemq-core/src/test/java/org/apache/activemq/CreateConsumerButDontStartConnectionWarningTest.java b/activemq-core/src/test/java/org/apache/activemq/CreateConsumerButDontStartConnectionWarningTest.java index d24715248c..13efcc1f77 100644 --- a/activemq-core/src/test/java/org/apache/activemq/CreateConsumerButDontStartConnectionWarningTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/CreateConsumerButDontStartConnectionWarningTest.java @@ -25,7 +25,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public class CreateConsumerButDontStartConnectionWarningTest extends JmsQueueSendReceiveTest { - private static final transient Log log = LogFactory.getLog(CreateConsumerButDontStartConnectionWarningTest.class); + private static final transient Log LOG = LogFactory.getLog(CreateConsumerButDontStartConnectionWarningTest.class); @Override protected void startConnection() throws JMSException { @@ -37,7 +37,7 @@ public class CreateConsumerButDontStartConnectionWarningTest extends JmsQueueSen try { Thread.sleep(1000); } catch (InterruptedException e) { - log.warn("Caught: " + e, e); + LOG.warn("Caught: " + e, e); } } } diff --git a/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java index fd16affd7c..57c99f6ec7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java @@ -37,7 +37,7 @@ import org.springframework.jms.core.JmsTemplate; */ public abstract class EmbeddedBrokerTestSupport extends TestCase { - protected static final Log LOG = LogFactory.getLog(EmbeddedBrokerTestSupport.class); + private static final Log LOG = LogFactory.getLog(EmbeddedBrokerTestSupport.class); protected BrokerService broker; // protected String bindAddress = "tcp://localhost:61616"; diff --git a/activemq-core/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java b/activemq-core/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java index 2acedf1c98..eb062d26ee 100644 --- a/activemq-core/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java @@ -1,18 +1,18 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation + * http://www.apache.org/licenses/LICENSE-2.0 * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq; diff --git a/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java b/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java index fe4bbde84f..263236bf45 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java @@ -41,7 +41,7 @@ import org.apache.activemq.command.ActiveMQQueue; */ public class JMSConsumerTest extends JmsTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(JMSConsumerTest.class); public static Test suite() { @@ -83,10 +83,12 @@ public class JMSConsumerTest extends JmsTestSupport { consumer.setMessageListener(new MessageListener() { public void onMessage(Message m) { counter.incrementAndGet(); - if (counter.get() == 1) + if (counter.get() == 1) { done1.countDown(); - if (counter.get() == 2) + } + if (counter.get() == 2) { done2.countDown(); + } } }); @@ -254,8 +256,9 @@ public class JMSConsumerTest extends JmsTestSupport { consumer.setMessageListener(new MessageListener() { public void onMessage(Message m) { counter.incrementAndGet(); - if (counter.get() == 4) + if (counter.get() == 4) { done.countDown(); + } } }); @@ -298,7 +301,7 @@ public class JMSConsumerTest extends JmsTestSupport { public void onMessage(Message m) { try { TextMessage tm = (TextMessage)m; - log.info("Got in first listener: " + tm.getText()); + LOG.info("Got in first listener: " + tm.getText()); assertEquals("" + counter.get(), tm.getText()); counter.incrementAndGet(); m.acknowledge(); @@ -335,11 +338,12 @@ public class JMSConsumerTest extends JmsTestSupport { public void onMessage(Message m) { try { TextMessage tm = (TextMessage)m; - log.info("Got in second listener: " + tm.getText()); + LOG.info("Got in second listener: " + tm.getText()); assertEquals("" + counter.get(), tm.getText()); counter.incrementAndGet(); - if (counter.get() == 4) + if (counter.get() == 4) { done2.countDown(); + } } catch (Throwable e) { e.printStackTrace(); } @@ -379,8 +383,9 @@ public class JMSConsumerTest extends JmsTestSupport { consumer.setMessageListener(new MessageListener() { public void onMessage(Message m) { counter.incrementAndGet(); - if (counter.get() == 4) + if (counter.get() == 4) { done.countDown(); + } } }); @@ -417,8 +422,9 @@ public class JMSConsumerTest extends JmsTestSupport { consumer.setMessageListener(new MessageListener() { public void onMessage(Message m) { counter.incrementAndGet(); - if (counter.get() == 4) + if (counter.get() == 4) { done.countDown(); + } } }); diff --git a/activemq-core/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java b/activemq-core/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java index ef1eddf187..c4a91243a3 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java @@ -25,7 +25,7 @@ import javax.jms.TextMessage; */ public class JMSDurableTopicRedeliverTest extends JmsTopicRedeliverTest { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(JMSDurableTopicRedeliverTest.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JMSDurableTopicRedeliverTest.class); protected void setUp() throws Exception { durable = true; @@ -42,7 +42,7 @@ public class JMSDurableTopicRedeliverTest extends JmsTopicRedeliverTest { Message sendMessage = session.createTextMessage(text); if (verbose) { - log.info("About to send a message: " + sendMessage + " with text: " + text); + LOG.info("About to send a message: " + sendMessage + " with text: " + text); } producer.send(producerDestination, sendMessage); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsBenchmark.java b/activemq-core/src/test/java/org/apache/activemq/JmsBenchmark.java index 58296a0ee5..ca5d60fa62 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsBenchmark.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsBenchmark.java @@ -54,7 +54,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class JmsBenchmark extends JmsTestSupport { - private static final transient Log log = LogFactory.getLog(JmsBenchmark.class); + private static final transient Log LOG = LogFactory.getLog(JmsBenchmark.class); private static final long SAMPLE_DELAY = Integer.parseInt(System.getProperty("SAMPLE_DELAY", "" + 1000 * 5)); private static final long SAMPLES = Integer.parseInt(System.getProperty("SAMPLES", "10")); @@ -169,12 +169,12 @@ public class JmsBenchmark extends JmsTestSupport { }.start(); } - log.info(getName() + ": Waiting for Producers and Consumers to startup."); + LOG.info(getName() + ": Waiting for Producers and Consumers to startup."); connectionsEstablished.acquire(); - log.info("Producers and Consumers are now running. Waiting for system to reach steady state: " + (SAMPLE_DELAY / 1000.0f) + " seconds"); + LOG.info("Producers and Consumers are now running. Waiting for system to reach steady state: " + (SAMPLE_DELAY / 1000.0f) + " seconds"); Thread.sleep(1000 * 10); - log.info("Starting sample: " + SAMPLES + " each lasting " + (SAMPLE_DURATION / 1000.0f) + " seconds"); + LOG.info("Starting sample: " + SAMPLES + " each lasting " + (SAMPLE_DURATION / 1000.0f) + " seconds"); long now = System.currentTimeMillis(); for (int i = 0; i < SAMPLES; i++) { @@ -189,10 +189,10 @@ public class JmsBenchmark extends JmsTestSupport { int r = receivedMessages.get(); int p = producedMessages.get(); - log.info("published: " + p + " msgs at " + (p * 1000f / (end - start)) + " msgs/sec, " + "consumed: " + r + " msgs at " + (r * 1000f / (end - start)) + " msgs/sec"); + LOG.info("published: " + p + " msgs at " + (p * 1000f / (end - start)) + " msgs/sec, " + "consumed: " + r + " msgs at " + (r * 1000f / (end - start)) + " msgs/sec"); } - log.info("Sample done."); + LOG.info("Sample done."); sampleTimeDone.countDown(); workerDone.acquire(); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java index ccd3887053..a7a3dc9b4d 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java @@ -30,7 +30,7 @@ import javax.jms.Topic; */ public class JmsConnectionStartStopTest extends TestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(JmsConnectionStartStopTest.class); private Connection startedConnection; @@ -41,7 +41,7 @@ public class JmsConnectionStartStopTest extends TestSupport { */ protected void setUp() throws Exception { - log.info(getClass().getClassLoader().getResource("log4j.properties")); + LOG.info(getClass().getClassLoader().getResource("log4j.properties")); ActiveMQConnectionFactory factory = createConnectionFactory(); startedConnection = factory.createConnection(); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java index d83d57b20b..7b2c58e1ad 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.test.JmsTopicSendReceiveTest; * @version $Revision: 1.5 $ */ public class JmsDurableTopicSendReceiveTest extends JmsTopicSendReceiveTest { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(JmsDurableTopicSendReceiveTest.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsDurableTopicSendReceiveTest.class); protected Connection connection2; protected Session session2; @@ -75,7 +75,7 @@ public class JmsDurableTopicSendReceiveTest extends JmsTopicSendReceiveTest { message.setStringProperty("test", "test"); message.setJMSType("test"); producer2.send(producerDestination2, message); - log.info("Creating durable consumer"); + LOG.info("Creating durable consumer"); consumer2 = consumeSession2.createDurableSubscriber((Topic)consumerDestination2, getName()); Message msg = consumer2.receive(1000); assertNotNull(msg); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java index fdff056ff2..ec1a8ea03e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java @@ -59,7 +59,7 @@ import org.springframework.core.io.Resource; */ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport { public static final String AUTO_ASSIGN_TRANSPORT = "tcp://localhost:0"; - public static int MAX_SETUP_TIME = 5000; + public static int maxSetupTime = 5000; protected Map brokers; protected Map destinations; @@ -99,7 +99,7 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport { connector.setDynamicOnly(dynamicOnly); connector.setNetworkTTL(networkTTL); localBroker.addNetworkConnector(connector); - MAX_SETUP_TIME = 2000; + maxSetupTime = 2000; return connector; } else { throw new Exception("Remote broker has no registered connectors."); @@ -129,7 +129,7 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport { } // Multicasting may take longer to setup - MAX_SETUP_TIME = 8000; + maxSetupTime = 8000; } protected void startAllBrokers() throws Exception { @@ -139,7 +139,7 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport { broker.start(); } - Thread.sleep(MAX_SETUP_TIME); + Thread.sleep(maxSetupTime); } protected BrokerService createBroker(String brokerName) throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java index 90d85d6435..77dba50af8 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java @@ -32,7 +32,7 @@ import org.apache.activemq.command.ActiveMQQueue; * @version $Revision: 1.4 $ */ public class JmsQueueBrowserTest extends JmsTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(JmsQueueBrowserTest.class); @@ -81,7 +81,7 @@ public class JmsQueueBrowserTest extends JmsTestSupport { // There should be no more. boolean tooMany = false; while (enumeration.hasMoreElements()) { - log.info("Got extra message: " + ((TextMessage) enumeration.nextElement()).getText()); + LOG.info("Got extra message: " + ((TextMessage) enumeration.nextElement()).getText()); tooMany = true; } assertFalse(tooMany); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java index b7c8121bd0..a8a91e6975 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.test.JmsTopicSendReceiveTest; * @version $Revision: 1.3 $ */ public class JmsQueueCompositeSendReceiveTest extends JmsTopicSendReceiveTest { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(JmsQueueCompositeSendReceiveTest.class); /** @@ -71,10 +71,10 @@ public class JmsQueueCompositeSendReceiveTest extends JmsTopicSendReceiveTest { super.testSendReceive(); messages.clear(); Destination consumerDestination = consumeSession.createQueue("FOO.BAR.HUMBUG2"); - log.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); + LOG.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); MessageConsumer consumer = null; if (durable) { - log.info("Creating durable consumer"); + LOG.info("Creating durable consumer"); consumer = consumeSession.createDurableSubscriber((Topic) consumerDestination, getName()); } else { consumer = consumeSession.createConsumer(consumerDestination); @@ -82,6 +82,6 @@ public class JmsQueueCompositeSendReceiveTest extends JmsTopicSendReceiveTest { consumer.setMessageListener(this); assertMessagesAreReceived(); - log.info("" + data.length + " messages(s) received, closing down connections"); + LOG.info("" + data.length + " messages(s) received, closing down connections"); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsQueueRequestReplyTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsQueueRequestReplyTest.java index d909c9a46b..a25291ad6b 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsQueueRequestReplyTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsQueueRequestReplyTest.java @@ -20,12 +20,12 @@ package org.apache.activemq; * @version $Revision: 1.2 $ */ public class JmsQueueRequestReplyTest extends JmsTopicRequestReplyTest { - + /** - * Set up the test with a queue. + * Set up the test with a queue. * * @see junit.framework.TestCase#setUp() - */ + */ protected void setUp() throws Exception { topic = false; super.setUp(); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTest.java index e87e62a108..49d41581b4 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTest.java @@ -18,17 +18,16 @@ package org.apache.activemq; import org.apache.activemq.test.JmsTopicSendReceiveTest; - /** * @version $Revision: 1.2 $ */ public class JmsQueueSendReceiveTest extends JmsTopicSendReceiveTest { /** - * Set up the test with a queue. + * Set up the test with a queue. * * @see junit.framework.TestCase#setUp() - */ + */ protected void setUp() throws Exception { topic = false; super.setUp(); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java index 360e2178ad..22d312dbca 100644 --- a/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java @@ -20,12 +20,14 @@ import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import org.apache.activemq.broker.BrokerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision$ */ -public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends - JmsQueueSendReceiveTwoConnectionsTest { +public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends JmsQueueSendReceiveTwoConnectionsTest { + private static final Log LOG = LogFactory.getLog(JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.class); private Queue errors = new ConcurrentLinkedQueue(); private int delayBeforeStartingBroker = 1000; @@ -33,28 +35,27 @@ public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends public void startBroker() { // Initialize the broker - log.info("Lets wait: " + delayBeforeStartingBroker + " millis before creating the broker"); + LOG.info("Lets wait: " + delayBeforeStartingBroker + " millis before creating the broker"); try { Thread.sleep(delayBeforeStartingBroker); } catch (InterruptedException e) { e.printStackTrace(); } - log.info("Now starting the broker"); + LOG.info("Now starting the broker"); try { broker = new BrokerService(); broker.setPersistent(false); broker.addConnector("tcp://localhost:61616"); broker.start(); } catch (Exception e) { - log.info("Caught: " + e); + LOG.info("Caught: " + e); errors.add(e); } } protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { - return new ActiveMQConnectionFactory( - "failover:(tcp://localhost:61616)?maxReconnectAttempts=10&useExponentialBackOff=false&initialReconnectDelay=200"); + return new ActiveMQConnectionFactory("failover:(tcp://localhost:61616)?maxReconnectAttempts=10&useExponentialBackOff=false&initialReconnectDelay=200"); } protected void setUp() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java index e10cdec295..53eb1ef03c 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java @@ -25,13 +25,13 @@ import org.apache.commons.logging.LogFactory; */ public class JmsQueueSendReceiveTwoConnectionsTest extends JmsTopicSendReceiveWithTwoConnectionsTest { - protected static final Log log = LogFactory.getLog(JmsQueueSendReceiveTwoConnectionsTest.class); - + private static final Log LOG = LogFactory.getLog(JmsQueueSendReceiveTwoConnectionsTest.class); + /** - * Set up the test with a queue and using two connections. + * Set up the test with a queue and using two connections. * * @see junit.framework.TestCase#setUp() - */ + */ protected void setUp() throws Exception { topic = false; super.setUp(); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveUsingTwoSessionsTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveUsingTwoSessionsTest.java index ccaccc2e1f..d968d69df4 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveUsingTwoSessionsTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveUsingTwoSessionsTest.java @@ -22,10 +22,10 @@ package org.apache.activemq; public class JmsQueueSendReceiveUsingTwoSessionsTest extends JmsQueueSendReceiveTest { /** - * Set up the test using two sessions. + * Set up the test using two sessions. * * @see junit.framework.TestCase#setUp() - */ + */ protected void setUp() throws Exception { useSeparateSession = true; super.setUp(); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsQueueTopicCompositeSendReceiveTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsQueueTopicCompositeSendReceiveTest.java index 099e4eb471..39ce5a31d5 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsQueueTopicCompositeSendReceiveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsQueueTopicCompositeSendReceiveTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.test.JmsTopicSendReceiveTest; * @version $Revision: 1.3 $ */ public class JmsQueueTopicCompositeSendReceiveTest extends JmsTopicSendReceiveTest { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(JmsQueueTopicCompositeSendReceiveTest.class); Destination consumerDestination2; MessageConsumer consumer2; @@ -43,9 +43,9 @@ public class JmsQueueTopicCompositeSendReceiveTest extends JmsTopicSendReceiveTe topic = false; super.setUp(); consumerDestination2 = consumeSession.createTopic("FOO.BAR.HUMBUG2"); - log.info("Created consumer destination: " + consumerDestination2 + " of type: " + consumerDestination2.getClass()); + LOG.info("Created consumer destination: " + consumerDestination2 + " of type: " + consumerDestination2.getClass()); if (durable) { - log.info("Creating durable consumer"); + LOG.info("Creating durable consumer"); consumer2 = consumeSession.createDurableSubscriber((Topic) consumerDestination2, getName()); } else { consumer2 = consumeSession.createConsumer(consumerDestination2); @@ -83,6 +83,6 @@ public class JmsQueueTopicCompositeSendReceiveTest extends JmsTopicSendReceiveTe messages.clear(); consumer2.setMessageListener(this); assertMessagesAreReceived(); - log.info("" + data.length + " messages(s) received, closing down connections"); + LOG.info("" + data.length + " messages(s) received, closing down connections"); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java index 8797b2db93..c0b5b25ab8 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.test.JmsResourceProvider; * @version $Revision: 1.2 $ */ public class JmsQueueTransactionTest extends JmsTransactionTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(JmsQueueTransactionTest.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsQueueTransactionTest.class); /** * @see org.apache.activemq.JmsTransactionTestSupport#getJmsResourceProvider() @@ -62,8 +62,8 @@ public class JmsQueueTransactionTest extends JmsTransactionTestSupport { producer.send(outbound[1]); session.commit(); - log.info("Sent 0: " + outbound[0]); - log.info("Sent 1: " + outbound[1]); + LOG.info("Sent 0: " + outbound[0]); + LOG.info("Sent 1: " + outbound[1]); ArrayList messages = new ArrayList(); Message message = consumer.receive(1000); @@ -170,7 +170,7 @@ public class JmsQueueTransactionTest extends JmsTransactionTestSupport { // There should be no more. boolean tooMany = false; while (enumeration.hasMoreElements()) { - log.info("Got extra message: " + ((TextMessage)enumeration.nextElement()).getText()); + LOG.info("Got extra message: " + ((TextMessage)enumeration.nextElement()).getText()); tooMany = true; } assertFalse(tooMany); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsRedeliveredTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsRedeliveredTest.java index 1f822d8597..a608e6d6f6 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsRedeliveredTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsRedeliveredTest.java @@ -396,7 +396,7 @@ public class JmsRedeliveredTest extends TestCase { /** * Run the JmsRedeliverTest with the delivery mode set as persistent. */ - static final public class PersistentCase extends JmsRedeliveredTest { + public static final class PersistentCase extends JmsRedeliveredTest { /** * Returns delivery mode. @@ -411,7 +411,7 @@ public class JmsRedeliveredTest extends TestCase { /** * Run the JmsRedeliverTest with the delivery mode set as non-persistent. */ - static final public class TransientCase extends JmsRedeliveredTest { + public static final class TransientCase extends JmsRedeliveredTest { /** * Returns delivery mode. diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsTopicCompositeSendReceiveTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsTopicCompositeSendReceiveTest.java index 7f7b5f6c9e..4ad4042f78 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsTopicCompositeSendReceiveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsTopicCompositeSendReceiveTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.test.JmsTopicSendReceiveTest; * @version $Revision: 1.3 $ */ public class JmsTopicCompositeSendReceiveTest extends JmsTopicSendReceiveTest { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(JmsTopicCompositeSendReceiveTest.class); Destination consumerDestination2; @@ -43,9 +43,9 @@ public class JmsTopicCompositeSendReceiveTest extends JmsTopicSendReceiveTest { deliveryMode = DeliveryMode.NON_PERSISTENT; super.setUp(); consumerDestination2 = consumeSession.createTopic("FOO.BAR.HUMBUG2"); - log.info("Created consumer destination: " + consumerDestination2 + " of type: " + consumerDestination2.getClass()); + LOG.info("Created consumer destination: " + consumerDestination2 + " of type: " + consumerDestination2.getClass()); if (durable) { - log.info("Creating durable consumer"); + LOG.info("Creating durable consumer"); consumer2 = consumeSession.createDurableSubscriber((Topic) consumerDestination2, getName()); } else { consumer2 = consumeSession.createConsumer(consumerDestination2); @@ -83,6 +83,6 @@ public class JmsTopicCompositeSendReceiveTest extends JmsTopicSendReceiveTest { messages.clear(); consumer2.setMessageListener(this); assertMessagesAreReceived(); - log.info("" + data.length + " messages(s) received, closing down connections"); + LOG.info("" + data.length + " messages(s) received, closing down connections"); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java index 7213767351..2c20121a84 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java @@ -31,7 +31,7 @@ import javax.jms.Topic; */ public class JmsTopicRedeliverTest extends TestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(JmsTopicRedeliverTest.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsTopicRedeliverTest.class); protected Connection connection; protected Session session; @@ -56,17 +56,17 @@ public class JmsTopicRedeliverTest extends TestSupport { connection.setClientID(getClass().getName()); } - log.info("Created connection: " + connection); + LOG.info("Created connection: " + connection); session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); consumeSession = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); - log.info("Created session: " + session); - log.info("Created consumeSession: " + consumeSession); + LOG.info("Created session: " + session); + LOG.info("Created consumeSession: " + consumeSession); producer = session.createProducer(null); // producer.setDeliveryMode(deliveryMode); - log.info("Created producer: " + producer); + LOG.info("Created producer: " + producer); if (topic) { consumerDestination = session.createTopic(getConsumerSubject()); @@ -76,12 +76,12 @@ public class JmsTopicRedeliverTest extends TestSupport { producerDestination = session.createQueue(getProducerSubject()); } - log.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); - log.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); + LOG.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); + LOG.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); consumer = createConsumer(); connection.start(); - log.info("Created connection: " + connection); + LOG.info("Created connection: " + connection); } protected void tearDown() throws Exception { @@ -121,7 +121,7 @@ public class JmsTopicRedeliverTest extends TestSupport { Message sendMessage = session.createTextMessage(text); if (verbose) { - log.info("About to send a message: " + sendMessage + " with text: " + text); + LOG.info("About to send a message: " + sendMessage + " with text: " + text); } producer.send(producerDestination, sendMessage); @@ -149,7 +149,7 @@ public class JmsTopicRedeliverTest extends TestSupport { protected MessageConsumer createConsumer() throws JMSException { if (durable) { - log.info("Creating durable consumer"); + LOG.info("Creating durable consumer"); return consumeSession.createDurableSubscriber((Topic)consumerDestination, getName()); } return consumeSession.createConsumer(consumerDestination); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveTest.java index 392ff446f8..13fa4b6b5f 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveTest.java @@ -27,7 +27,7 @@ import javax.jms.Topic; * @version $Revision: 1.3 $ */ public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(JmsTopicSendReceiveTest.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsTopicSendReceiveTest.class); protected Connection connection; @@ -40,15 +40,15 @@ public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport { connection.setClientID(getClass().getName()); } - log.info("Created connection: " + connection); + LOG.info("Created connection: " + connection); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - log.info("Created session: " + session); + LOG.info("Created session: " + session); producer = session.createProducer(null); producer.setDeliveryMode(deliveryMode); - log.info("Created producer: " + producer + " delivery mode = " + (deliveryMode == DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON_PERSISTENT")); + LOG.info("Created producer: " + producer + " delivery mode = " + (deliveryMode == DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON_PERSISTENT")); if (topic) { consumerDestination = session.createTopic(getConsumerSubject()); @@ -58,8 +58,8 @@ public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport { producerDestination = session.createQueue(getProducerSubject()); } - log.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); - log.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); + LOG.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); + LOG.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); consumer = createConsumer(); consumer.setMessageListener(this); connection.start(); @@ -69,17 +69,17 @@ public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport { protected MessageConsumer createConsumer() throws JMSException { if (durable) { - log.info("Creating durable consumer"); + LOG.info("Creating durable consumer"); return session.createDurableSubscriber((Topic)consumerDestination, getName()); } return session.createConsumer(consumerDestination); } protected void tearDown() throws Exception { - log.info("Dumping stats..."); + LOG.info("Dumping stats..."); // connectionFactory.getStats().reset(); - log.info("Closing down connection"); + LOG.info("Closing down connection"); /** TODO we should be able to shut down properly */ session.close(); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java index 18bd381f89..168ed24a68 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java @@ -28,7 +28,7 @@ import javax.jms.Session; */ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(JmsTopicSendReceiveWithTwoConnectionsTest.class); protected Connection sendConnection; @@ -46,19 +46,19 @@ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTes receiveConnection = createReceiveConnection(); receiveConnection.start(); - log.info("Created sendConnection: " + sendConnection); - log.info("Created receiveConnection: " + receiveConnection); + LOG.info("Created sendConnection: " + sendConnection); + LOG.info("Created receiveConnection: " + receiveConnection); session = sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); receiveSession = receiveConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - log.info("Created sendSession: " + session); - log.info("Created receiveSession: " + receiveSession); + LOG.info("Created sendSession: " + session); + LOG.info("Created receiveSession: " + receiveSession); producer = session.createProducer(null); producer.setDeliveryMode(deliveryMode); - log.info("Created producer: " + producer + " delivery mode = " + LOG.info("Created producer: " + producer + " delivery mode = " + (deliveryMode == DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON_PERSISTENT")); if (topic) { @@ -69,15 +69,15 @@ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTes producerDestination = session.createQueue(getProducerSubject()); } - log.info("Created consumer destination: " + consumerDestination + " of type: " + LOG.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); - log.info("Created producer destination: " + producerDestination + " of type: " + LOG.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); consumer = createConsumer(receiveSession, consumerDestination); consumer.setMessageListener(this); - log.info("Started connections"); + LOG.info("Started connections"); } protected Connection createReceiveConnection() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendSameMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendSameMessageTest.java index a401e4df62..c0ee492a31 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendSameMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendSameMessageTest.java @@ -23,7 +23,7 @@ import javax.jms.TextMessage; */ public class JmsTopicSendSameMessageTest extends JmsTopicSendReceiveWithTwoConnectionsTest { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(JmsTopicSendSameMessageTest.class); public void testSendReceive() throws Exception { @@ -37,7 +37,7 @@ public class JmsTopicSendSameMessageTest extends JmsTopicSendReceiveWithTwoConne message.setIntProperty("intProperty", i); if (verbose) { - log.info("About to send a message: " + message + " with text: " + data[i]); + LOG.info("About to send a message: " + message + " with text: " + data[i]); } producer.send(producerDestination, message); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java index 2124d1f4b7..9c6e037011 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java @@ -39,9 +39,11 @@ import org.apache.activemq.test.TestSupport; /** * @version $Revision: 1.9 $ */ -abstract public class JmsTransactionTestSupport extends TestSupport implements MessageListener { +public abstract class JmsTransactionTestSupport extends TestSupport implements MessageListener { private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsTransactionTestSupport.class); + private static final int MESSAGE_COUNT = 5; + private static final String MESSAGE_TEXT = "message"; protected ConnectionFactory connectionFactory; protected Connection connection; @@ -52,10 +54,8 @@ abstract public class JmsTransactionTestSupport extends TestSupport implements M protected Destination destination; // for message listener test - private static final int messageCount = 5; - private static final String messageText = "message"; - private List unackMessages = new ArrayList(messageCount); - private List ackMessages = new ArrayList(messageCount); + private List unackMessages = new ArrayList(MESSAGE_COUNT); + private List ackMessages = new ArrayList(MESSAGE_COUNT); private boolean resendPhase; protected int batchCount = 10; protected int batchSize = 20; @@ -402,8 +402,9 @@ abstract public class JmsTransactionTestSupport extends TestSupport implements M * @throws Exception */ public void testReceiveTwoThenRollbackManyTimes() throws Exception { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) { testReceiveTwoThenRollback(); + } } /** @@ -559,17 +560,17 @@ abstract public class JmsTransactionTestSupport extends TestSupport implements M public void testMessageListener() throws Exception { // send messages - for (int i = 0; i < messageCount; i++) { - producer.send(session.createTextMessage(messageText + i)); + for (int i = 0; i < MESSAGE_COUNT; i++) { + producer.send(session.createTextMessage(MESSAGE_TEXT + i)); } session.commit(); consumer.setMessageListener(this); // wait receive waitReceiveUnack(); - assertEquals(unackMessages.size(), messageCount); + assertEquals(unackMessages.size(), MESSAGE_COUNT); // resend phase waitReceiveAck(); - assertEquals(ackMessages.size(), messageCount); + assertEquals(ackMessages.size(), MESSAGE_COUNT); // should no longer re-receive consumer.setMessageListener(null); assertNull(consumer.receive(500)); @@ -579,7 +580,7 @@ abstract public class JmsTransactionTestSupport extends TestSupport implements M public void onMessage(Message message) { if (!resendPhase) { unackMessages.add(message); - if (unackMessages.size() == messageCount) { + if (unackMessages.size() == MESSAGE_COUNT) { try { session.rollback(); resendPhase = true; @@ -589,7 +590,7 @@ abstract public class JmsTransactionTestSupport extends TestSupport implements M } } else { ackMessages.add(message); - if (ackMessages.size() == messageCount) { + if (ackMessages.size() == MESSAGE_COUNT) { try { session.commit(); } catch (Exception e) { @@ -607,9 +608,9 @@ abstract public class JmsTransactionTestSupport extends TestSupport implements M } private void waitReceiveAck() throws Exception { - for (int i = 0; i < 100 && ackMessages.size() < messageCount; i++) { + for (int i = 0; i < 100 && ackMessages.size() < MESSAGE_COUNT; i++) { Thread.sleep(100); } - assertFalse(ackMessages.size() < messageCount); + assertFalse(ackMessages.size() < MESSAGE_COUNT); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/LargeMessageTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/LargeMessageTestSupport.java index 76a68ec804..deeb8319cc 100755 --- a/activemq-core/src/test/java/org/apache/activemq/LargeMessageTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/LargeMessageTestSupport.java @@ -41,10 +41,11 @@ import org.apache.activemq.util.IdGenerator; */ public class LargeMessageTestSupport extends ClientTestSupport implements MessageListener { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LargeMessageTestSupport.class); - protected static final int LARGE_MESSAGE_SIZE = 128 * 1024; protected static final int MESSAGE_COUNT = 100; + + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(LargeMessageTestSupport.class); + protected Connection producerConnection; protected Connection consumerConnection; protected MessageConsumer consumer; @@ -82,7 +83,7 @@ public class LargeMessageTestSupport extends ClientTestSupport implements Messag public void setUp() throws Exception { super.setUp(); ClientTestSupport.removeMessageStore(); - log.info("Setting up . . . . . "); + LOG.info("Setting up . . . . . "); messageCount.set(0); destination = createDestination(); @@ -117,7 +118,7 @@ public class LargeMessageTestSupport extends ClientTestSupport implements Messag consumerSession = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); consumer = createConsumer(); consumer.setMessageListener(this); - log.info("Setup complete"); + LOG.info("Setup complete"); } protected void setPrefetchPolicy(ActiveMQConnection activeMQConnection) { @@ -144,8 +145,9 @@ public class LargeMessageTestSupport extends ClientTestSupport implements Messag for (int i = 0; i < LARGE_MESSAGE_SIZE; i++) { result = msg1.readByte() == largeMessageData[i]; - if (!result) + if (!result) { break; + } } return result; @@ -161,9 +163,9 @@ public class LargeMessageTestSupport extends ClientTestSupport implements Messag messageCount.notify(); } } - log.info("got message = " + messageCount); + LOG.info("got message = " + messageCount); if (messageCount.get() % 50 == 0) { - log.info("count = " + messageCount); + LOG.info("count = " + messageCount); } } catch (Exception e) { e.printStackTrace(); @@ -172,22 +174,22 @@ public class LargeMessageTestSupport extends ClientTestSupport implements Messag public void testLargeMessages() throws Exception { for (int i = 0; i < MESSAGE_COUNT; i++) { - log.info("Sending message: " + i); + LOG.info("Sending message: " + i); BytesMessage msg = producerSession.createBytesMessage(); msg.writeBytes(largeMessageData); producer.send(msg); } long now = System.currentTimeMillis(); while (now + 60000 > System.currentTimeMillis() && messageCount.get() < MESSAGE_COUNT) { - log.info("message count = " + messageCount); + LOG.info("message count = " + messageCount); synchronized (messageCount) { messageCount.wait(1000); } } - log.info("Finished count = " + messageCount); + LOG.info("Finished count = " + messageCount); assertTrue("Not enough messages - expected " + MESSAGE_COUNT + " but got " + messageCount, messageCount.get() == MESSAGE_COUNT); assertTrue("received messages are not valid", validMessageConsumption); Thread.sleep(1000); - log.info("FINAL count = " + messageCount); + LOG.info("FINAL count = " + messageCount); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java b/activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java index bce9072224..c3ed6dd702 100644 --- a/activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java @@ -1,3 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.activemq; /** @@ -37,7 +53,7 @@ import org.apache.commons.logging.LogFactory; */ public final class LargeStreamletTest extends TestCase { - private static final Log log = LogFactory.getLog(LargeStreamletTest.class); + private static final Log LOG = LogFactory.getLog(LargeStreamletTest.class); private static final String BROKER_URL = "vm://localhost?broker.persistent=false"; private static final int BUFFER_SIZE = 1 * 1024; private static final int MESSAGE_COUNT = 10 * 1024; @@ -80,7 +96,7 @@ public final class LargeStreamletTest extends TestCase { readerException = e; e.printStackTrace(); } finally { - log.info(totalRead + " total bytes read."); + LOG.info(totalRead + " total bytes read."); } } }); @@ -108,7 +124,7 @@ public final class LargeStreamletTest extends TestCase { writerException = e; e.printStackTrace(); } finally { - log.info(totalWritten + " total bytes written."); + LOG.info(totalWritten + " total bytes written."); } } }); diff --git a/activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java b/activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java index 58d8ca5fcd..6d1328f3db 100644 --- a/activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java +++ b/activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java @@ -49,14 +49,14 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class LoadTestBurnIn extends JmsTestSupport { - private static final transient Log log = LogFactory.getLog(LoadTestBurnIn.class); + private static final transient Log LOG = LogFactory.getLog(LoadTestBurnIn.class); public static Test suite() { return suite(LoadTestBurnIn.class); } protected void setUp() throws Exception { - log.info("Start: " + getName()); + LOG.info("Start: " + getName()); super.setUp(); } @@ -66,7 +66,7 @@ public class LoadTestBurnIn extends JmsTestSupport { } catch (Throwable e) { e.printStackTrace(System.out); } finally { - log.info("End: " + getName()); + LOG.info("End: " + getName()); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/ProducerFlowControlTest.java b/activemq-core/src/test/java/org/apache/activemq/ProducerFlowControlTest.java index 120d36ace4..eef0f8b169 100644 --- a/activemq-core/src/test/java/org/apache/activemq/ProducerFlowControlTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/ProducerFlowControlTest.java @@ -1,3 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.activemq; import java.io.IOException; diff --git a/activemq-core/src/test/java/org/apache/activemq/ReconnectWithSameClientIDTest.java b/activemq-core/src/test/java/org/apache/activemq/ReconnectWithSameClientIDTest.java index 6b92ac8676..4b55b6e902 100644 --- a/activemq-core/src/test/java/org/apache/activemq/ReconnectWithSameClientIDTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/ReconnectWithSameClientIDTest.java @@ -21,11 +21,16 @@ import javax.jms.InvalidClientIDException; import javax.jms.JMSException; import javax.jms.Session; +import org.apache.activemq.store.kahadaptor.KahaPersistenceAdapter; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** * * @version $Revision$ */ public class ReconnectWithSameClientIDTest extends EmbeddedBrokerTestSupport { + private static final Log LOG = LogFactory.getLog(ReconnectWithSameClientIDTest.class); protected Connection connection; protected boolean transacted; diff --git a/activemq-core/src/test/java/org/apache/activemq/TimeStampTest.java b/activemq-core/src/test/java/org/apache/activemq/TimeStampTest.java index 1efac3c974..6e9fa5fdc3 100644 --- a/activemq-core/src/test/java/org/apache/activemq/TimeStampTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/TimeStampTest.java @@ -1,18 +1,18 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2006 The Apache Software Foundation + * http://www.apache.org/licenses/LICENSE-2.0 * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq; diff --git a/activemq-core/src/test/java/org/apache/activemq/ZeroPrefetchConsumerTest.java b/activemq-core/src/test/java/org/apache/activemq/ZeroPrefetchConsumerTest.java index 85001dafb9..0d7fea80e0 100644 --- a/activemq-core/src/test/java/org/apache/activemq/ZeroPrefetchConsumerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/ZeroPrefetchConsumerTest.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -36,7 +36,7 @@ import org.apache.commons.logging.LogFactory; */ public class ZeroPrefetchConsumerTest extends EmbeddedBrokerTestSupport { - private static final Log log = LogFactory.getLog(ZeroPrefetchConsumerTest.class); + private static final Log LOG = LogFactory.getLog(ZeroPrefetchConsumerTest.class); protected Connection connection; protected Queue queue; @@ -50,7 +50,7 @@ public class ZeroPrefetchConsumerTest extends EmbeddedBrokerTestSupport { consumer.setMessageListener(listener); fail("Should have thrown JMSException as we cannot use MessageListener with zero prefetch"); } catch (JMSException e) { - log.info("Received expected exception : " + e); + LOG.info("Received expected exception : " + e); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java b/activemq-core/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java index 3cb76417e0..be7cca01e1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java @@ -28,12 +28,16 @@ import javax.jms.MessageListener; import javax.jms.Session; import org.apache.activemq.EmbeddedBrokerTestSupport; +import org.apache.activemq.ReconnectWithSameClientIDTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * * @version $Revision$ */ public class ConsumerListenerTest extends EmbeddedBrokerTestSupport implements ConsumerListener { + private static final Log LOG = LogFactory.getLog(ConsumerListenerTest.class); protected Session consumerSession1; protected Session consumerSession2; diff --git a/activemq-core/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java b/activemq-core/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java index e795820f7f..6cbab6b75a 100644 --- a/activemq-core/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java @@ -26,12 +26,15 @@ import javax.jms.MessageProducer; import javax.jms.Session; import org.apache.activemq.EmbeddedBrokerTestSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * * @version $Revision: 359679 $ */ public class ProducerListenerTest extends EmbeddedBrokerTestSupport implements ProducerListener { + private static final Log LOG = LogFactory.getLog(ProducerListenerTest.class); protected Session consumerSession1; protected Session consumerSession2; diff --git a/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java b/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java index 21660a142e..b60f933b67 100644 --- a/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java @@ -33,12 +33,15 @@ import org.apache.activemq.EmbeddedBrokerTestSupport; import org.apache.activemq.broker.region.RegionBroker; import org.apache.activemq.command.ActiveMQTempQueue; import org.apache.activemq.command.ActiveMQTempTopic; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * * @version $Revision: 397249 $ */ public class TempDestDeleteTest extends EmbeddedBrokerTestSupport implements ConsumerListener { + private static final Log LOG = LogFactory.getLog(TempDestDeleteTest.class); protected int consumerCounter; protected ConsumerEventSource topicConsumerEventSource; diff --git a/activemq-core/src/test/java/org/apache/activemq/blob/DefaultBlobUploadStrategyTest.java b/activemq-core/src/test/java/org/apache/activemq/blob/DefaultBlobUploadStrategyTest.java index 80012af5ec..51558189d4 100755 --- a/activemq-core/src/test/java/org/apache/activemq/blob/DefaultBlobUploadStrategyTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/blob/DefaultBlobUploadStrategyTest.java @@ -1,3 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.activemq.blob; import java.io.BufferedWriter; @@ -24,7 +40,8 @@ public class DefaultBlobUploadStrategyTest extends TestCase { } - public void DISABLED_UNTIL_WE_EMBED_JETTY_testUploadViaDefaultBlobUploadStrategy() throws Exception { + // DISABLED UNTIL WE EMBED JETTY + public void xtestUploadViaDefaultBlobUploadStrategy() throws Exception { // 0. Initialise File file = File.createTempFile("amq-data-file-", ".dat"); // lets write some data diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerBenchmark.java b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerBenchmark.java index 342a87a111..10e961001c 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerBenchmark.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerBenchmark.java @@ -45,12 +45,12 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.9 $ */ public class BrokerBenchmark extends BrokerTestSupport { - private static final transient Log log = LogFactory.getLog(BrokerBenchmark.class); + private static final transient Log LOG = LogFactory.getLog(BrokerBenchmark.class); - public int PRODUCE_COUNT = Integer.parseInt(System.getProperty("PRODUCE_COUNT", "10000")); + public int produceCount = Integer.parseInt(System.getProperty("PRODUCE_COUNT", "10000")); public ActiveMQDestination destination; - public int PRODUCER_COUNT; - public int CONSUMER_COUNT; + public int prodcuerCount; + public int consumerCount; public boolean deliveryMode; public void initCombosForTestPerformance() { @@ -63,13 +63,13 @@ public class BrokerBenchmark extends BrokerTestSupport { public void testPerformance() throws Exception { - log.info("Running Benchmark for destination=" + destination + ", producers=" + PRODUCER_COUNT + ", consumers=" + CONSUMER_COUNT + ", deliveryMode=" + deliveryMode); - final int CONSUME_COUNT = destination.isTopic() ? CONSUMER_COUNT * PRODUCE_COUNT : PRODUCE_COUNT; + LOG.info("Running Benchmark for destination=" + destination + ", producers=" + prodcuerCount + ", consumers=" + consumerCount + ", deliveryMode=" + deliveryMode); + final int consumeCount = destination.isTopic() ? consumerCount * produceCount : produceCount; - final Semaphore consumersStarted = new Semaphore(1 - CONSUMER_COUNT); - final Semaphore producersFinished = new Semaphore(1 - PRODUCER_COUNT); - final Semaphore consumersFinished = new Semaphore(1 - CONSUMER_COUNT); - final ProgressPrinter printer = new ProgressPrinter(PRODUCE_COUNT + CONSUME_COUNT, 10); + final Semaphore consumersStarted = new Semaphore(1 - consumerCount); + final Semaphore producersFinished = new Semaphore(1 - prodcuerCount); + final Semaphore consumersFinished = new Semaphore(1 - consumerCount); + final ProgressPrinter printer = new ProgressPrinter(produceCount + consumeCount, 10); // Start a producer and consumer @@ -78,7 +78,7 @@ public class BrokerBenchmark extends BrokerTestSupport { long start = System.currentTimeMillis(); final AtomicInteger receiveCounter = new AtomicInteger(0); - for (int i = 0; i < CONSUMER_COUNT; i++) { + for (int i = 0; i < consumerCount; i++) { new Thread() { public void run() { try { @@ -96,7 +96,7 @@ public class BrokerBenchmark extends BrokerTestSupport { consumersStarted.release(); - while (receiveCounter.get() < CONSUME_COUNT) { + while (receiveCounter.get() < consumeCount) { int counter = 0; // Get a least 1 message. @@ -120,8 +120,8 @@ public class BrokerBenchmark extends BrokerTestSupport { if (msg != null) { connection.send(createAck(consumerInfo, msg, counter, MessageAck.STANDARD_ACK_TYPE)); - } else if (receiveCounter.get() < CONSUME_COUNT) { - log.info("Consumer stall, waiting for message #" + receiveCounter.get() + 1); + } else if (receiveCounter.get() < consumeCount) { + LOG.info("Consumer stall, waiting for message #" + receiveCounter.get() + 1); } } @@ -142,7 +142,7 @@ public class BrokerBenchmark extends BrokerTestSupport { consumersStarted.acquire(); // Send the messages in an async thread. - for (int i = 0; i < PRODUCER_COUNT; i++) { + for (int i = 0; i < prodcuerCount; i++) { new Thread() { public void run() { try { @@ -155,7 +155,7 @@ public class BrokerBenchmark extends BrokerTestSupport { connection.send(sessionInfo); connection.send(producerInfo); - for (int i = 0; i < PRODUCE_COUNT / PRODUCER_COUNT; i++) { + for (int i = 0; i < produceCount / prodcuerCount; i++) { Message message = createMessage(producerInfo, destination); message.setPersistent(deliveryMode); message.setResponseRequired(false); @@ -176,9 +176,9 @@ public class BrokerBenchmark extends BrokerTestSupport { consumersFinished.acquire(); long end2 = System.currentTimeMillis(); - log.info("Results for destination=" + destination + ", producers=" + PRODUCER_COUNT + ", consumers=" + CONSUMER_COUNT + ", deliveryMode=" + deliveryMode); - log.info("Produced at messages/sec: " + (PRODUCE_COUNT * 1000.0 / (end1 - start))); - log.info("Consumed at messages/sec: " + (CONSUME_COUNT * 1000.0 / (end2 - start))); + LOG.info("Results for destination=" + destination + ", producers=" + prodcuerCount + ", consumers=" + consumerCount + ", deliveryMode=" + deliveryMode); + LOG.info("Produced at messages/sec: " + (produceCount * 1000.0 / (end1 - start))); + LOG.info("Consumed at messages/sec: " + (consumeCount * 1000.0 / (end2 - start))); profilerPause("Benchmark done. Stop profiler "); } diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerServiceTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerServiceTest.java index 58cbe80852..18ebad18f0 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerServiceTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerServiceTest.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java index d29821cd49..f73ddf9193 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java @@ -111,7 +111,7 @@ public class BrokerTest extends BrokerTestSupport { * * @throws Exception */ - public void XtestQueueBrowserWith2Consumers() throws Exception { + public void xtestQueueBrowserWith2Consumers() throws Exception { ActiveMQDestination destination = new ActiveMQQueue("TEST"); @@ -1061,7 +1061,7 @@ public class BrokerTest extends BrokerTestSupport { // Send another message, connection1 should not get the message. connection2.send(createMessage(producerInfo2, destination, deliveryMode)); - assertNull(connection1.getDispatchQueue().poll(MAX_WAIT, TimeUnit.MILLISECONDS)); + assertNull(connection1.getDispatchQueue().poll(maxWait, TimeUnit.MILLISECONDS)); } public void initCombosForTestSessionCloseCascades() { @@ -1113,7 +1113,7 @@ public class BrokerTest extends BrokerTestSupport { // Send another message, connection1 should not get the message. connection2.send(createMessage(producerInfo2, destination, deliveryMode)); - assertNull(connection1.getDispatchQueue().poll(MAX_WAIT, TimeUnit.MILLISECONDS)); + assertNull(connection1.getDispatchQueue().poll(maxWait, TimeUnit.MILLISECONDS)); } public void initCombosForTestConsumerClose() { @@ -1165,7 +1165,7 @@ public class BrokerTest extends BrokerTestSupport { // Send another message, connection1 should not get the message. connection2.send(createMessage(producerInfo2, destination, deliveryMode)); - assertNull(connection1.getDispatchQueue().poll(MAX_WAIT, TimeUnit.MILLISECONDS)); + assertNull(connection1.getDispatchQueue().poll(maxWait, TimeUnit.MILLISECONDS)); } public void initCombosForTestTopicNoLocal() { diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java index 73348f6d88..e4f3f67861 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java @@ -58,14 +58,15 @@ import org.apache.commons.logging.LogFactory; public class BrokerTestSupport extends CombinationTestSupport { - protected static final Log LOG = LogFactory.getLog(BrokerTestSupport.class); - /** * Setting this to false makes the test run faster but they may be less * accurate. */ public static final boolean FAST_NO_MESSAGE_LEFT_ASSERT = System.getProperty("FAST_NO_MESSAGE_LEFT_ASSERT", "true").equals("true"); + private static final Log LOG = LogFactory.getLog(BrokerTestSupport.class); + + protected RegionBroker regionBroker; protected BrokerService broker; protected long idGenerator; @@ -74,7 +75,7 @@ public class BrokerTestSupport extends CombinationTestSupport { protected int tempDestGenerator; protected PersistenceAdapter persistenceAdapter; - protected int MAX_WAIT = 4000; + protected int maxWait = 4000; protected UsageManager memoryManager; @@ -249,7 +250,7 @@ public class BrokerTestSupport extends CombinationTestSupport { ArrayList skipped = new ArrayList(); // Now get the messages. - Object m = connection.getDispatchQueue().poll(MAX_WAIT, TimeUnit.MILLISECONDS); + Object m = connection.getDispatchQueue().poll(maxWait, TimeUnit.MILLISECONDS); int i = 0; while (m != null) { if (m instanceof MessageDispatch && ((MessageDispatch)m).getConsumerId().equals(consumerInfo.getConsumerId())) { @@ -263,7 +264,7 @@ public class BrokerTestSupport extends CombinationTestSupport { } else { skipped.add(m); } - m = connection.getDispatchQueue().poll(MAX_WAIT, TimeUnit.MILLISECONDS); + m = connection.getDispatchQueue().poll(maxWait, TimeUnit.MILLISECONDS); } for (Iterator iter = skipped.iterator(); iter.hasNext();) { @@ -319,22 +320,22 @@ public class BrokerTestSupport extends CombinationTestSupport { * @throws InterruptedException */ public Message receiveMessage(StubConnection connection) throws InterruptedException { - return receiveMessage(connection, MAX_WAIT); + return receiveMessage(connection, maxWait); } public Message receiveMessage(StubConnection connection, long timeout) throws InterruptedException { while (true) { Object o = connection.getDispatchQueue().poll(timeout, TimeUnit.MILLISECONDS); - if (o == null) + if (o == null) { return null; - + } if (o instanceof MessageDispatch) { MessageDispatch dispatch = (MessageDispatch)o; - if (dispatch.getMessage() == null) + if (dispatch.getMessage() == null) { return null; - + } dispatch.setMessage(dispatch.getMessage().copy()); dispatch.getMessage().setRedeliveryCounter(dispatch.getRedeliveryCounter()); return dispatch.getMessage(); @@ -343,11 +344,12 @@ public class BrokerTestSupport extends CombinationTestSupport { }; protected void assertNoMessagesLeft(StubConnection connection) throws InterruptedException { - long wait = FAST_NO_MESSAGE_LEFT_ASSERT ? 0 : MAX_WAIT; + long wait = FAST_NO_MESSAGE_LEFT_ASSERT ? 0 : maxWait; while (true) { Object o = connection.getDispatchQueue().poll(wait, TimeUnit.MILLISECONDS); - if (o == null) + if (o == null) { return; + } if (o instanceof MessageDispatch && ((MessageDispatch)o).getMessage() != null) { fail("Received a message."); } diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/CreateDestinationsOnStartupViaXBeanTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/CreateDestinationsOnStartupViaXBeanTest.java index 2531bcfcff..9e77a378b2 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/CreateDestinationsOnStartupViaXBeanTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/CreateDestinationsOnStartupViaXBeanTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java index c6b9232759..df7c6c56c9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java @@ -211,7 +211,7 @@ public class MessageExpirationTest extends BrokerTestSupport { connection.send(closeConnectionInfo(connectionInfo)); } - public void TestMessagesInSubscriptionPendingListExpire() { + public void xinitCombosForTestMessagesInSubscriptionPendingListExpire() { addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT), Integer.valueOf(DeliveryMode.PERSISTENT)}); addCombinationValues("destinationType", new Object[] {Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)}); diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/ProgressPrinter.java b/activemq-core/src/test/java/org/apache/activemq/broker/ProgressPrinter.java index 57dbda5eb7..707248d9c0 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/ProgressPrinter.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/ProgressPrinter.java @@ -29,11 +29,11 @@ public class ProgressPrinter { this.interval = interval; } - synchronized public void increment() { + public synchronized void increment() { update(++counter); } - synchronized public void update(long current) { + public synchronized void update(long current) { long at = 100 * current / total; if ((percentDone / interval) != (at / interval)) { percentDone = at; diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/QueueSubscriptionTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/QueueSubscriptionTest.java index 8a4d76982b..041dec5b14 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/QueueSubscriptionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/QueueSubscriptionTest.java @@ -149,8 +149,9 @@ public class QueueSubscriptionTest extends JmsMultipleClientsTestSupport { // Wait for messages to be received. Make it proportional to the // messages delivered. int totalMessageCount = messageCount * producerCount; - if (dest.isTopic()) + if (dest.isTopic()) { totalMessageCount *= consumerCount; + } waitForAllMessagesToBeReceived(totalMessageCount); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/SpringTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/SpringTest.java index c193876c3d..46e0a87ef9 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/SpringTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/SpringTest.java @@ -31,7 +31,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringTest extends TestCase { - private static final Log log = LogFactory.getLog(SpringTest.class); + private static final Log LOG = LogFactory.getLog(SpringTest.class); protected AbstractApplicationContext context; protected SpringConsumer consumer; @@ -66,10 +66,10 @@ public class SpringTest extends TestCase { // now lets check that the consumer has received some messages List messages = consumer.flushMessages(); - log.info("Consumer has received messages...."); + LOG.info("Consumer has received messages...."); for (Iterator iter = messages.iterator(); iter.hasNext();) { Object message = iter.next(); - log.info("Received: " + message); + LOG.info("Received: " + message); } assertEquals("Message count", producer.getMessageCount(), messages.size()); diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveUsingMasterConnectorElementTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveUsingMasterConnectorElementTest.java index 7b38bcf8dc..1895647df2 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveUsingMasterConnectorElementTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveUsingMasterConnectorElementTest.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java index a0a614b446..717b443e09 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java @@ -32,7 +32,10 @@ import javax.management.openmbean.TabularData; import junit.textui.TestRunner; import org.apache.activemq.EmbeddedBrokerTestSupport; +import org.apache.activemq.advisory.TempDestDeleteTest; import org.apache.activemq.broker.BrokerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * A test case of the various MBeans in ActiveMQ. If you want to look at the @@ -42,6 +45,7 @@ import org.apache.activemq.broker.BrokerService; * @version $Revision$ */ public class MBeanTest extends EmbeddedBrokerTestSupport { + private static final Log LOG = LogFactory.getLog(MBeanTest.class); private static boolean waitForKeyPress; diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/jmx/PurgeTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/jmx/PurgeTest.java index 703b048c7d..b1ef4dcb80 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/jmx/PurgeTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/jmx/PurgeTest.java @@ -28,6 +28,8 @@ import javax.management.ObjectName; import junit.textui.TestRunner; import org.apache.activemq.EmbeddedBrokerTestSupport; import org.apache.activemq.broker.BrokerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * A specific test of Queue.purge() functionality @@ -35,6 +37,7 @@ import org.apache.activemq.broker.BrokerService; * @version $Revision$ */ public class PurgeTest extends EmbeddedBrokerTestSupport { + private static final Log LOG = LogFactory.getLog(PurgeTest.class); protected MBeanServer mbeanServer; protected String domain = "org.apache.activemq"; diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java index c48c7cd6b7..c0f03992c0 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorDurableTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorDurableTest.java index e83ea435fa..29828f99d1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorDurableTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorDurableTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.cursors; import javax.jms.Connection; diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorQueueStoreTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorQueueStoreTest.java index ef243b1515..d2edb53a66 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorQueueStoreTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorQueueStoreTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.cursors; import javax.jms.Connection; diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorSupport.java b/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorSupport.java index 12606946b5..fcedd1139d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/CursorSupport.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.broker.region.cursors; import java.util.ArrayList; @@ -39,7 +41,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.3 $ */ public abstract class CursorSupport extends TestCase { - protected static final Log log = LogFactory.getLog(CursorSupport.class); + private static final Log LOG = LogFactory.getLog(CursorSupport.class); protected static final int MESSAGE_COUNT = 500; protected static final int PREFETCH_SIZE = 50; @@ -135,9 +137,9 @@ public abstract class CursorSupport extends TestCase { Message sent = (Message)senderList.get(i); Message consumed = (Message)consumerList.get(i); if (!sent.equals(consumed)) { - log.error("BAD MATCH AT POS " + i); - log.error(sent); - log.error(consumed); + LOG.error("BAD MATCH AT POS " + i); + LOG.error(sent); + LOG.error(consumed); /* * log.error("\n\n\n\n\n"); for (int j = 0; j < * consumerList.size(); j++) { log.error(consumerList.get(j)); } diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java b/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java index 33dc1701fc..52fe1f1d20 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java @@ -37,14 +37,19 @@ import org.apache.activemq.broker.ProgressPrinter; import org.apache.activemq.broker.TransportConnector; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.memory.list.SimpleMessageList; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision$ */ public class LoadTester extends JmsTestSupport { - protected int MESSAGE_SIZE = 1024 * 64; - protected int PRODUCE_COUNT = 10000; + private static final Log LOG = LogFactory.getLog(LoadTester.class); + + protected int messageSize = 1024 * 64; + protected int produceCount = 10000; protected BrokerService createBroker() throws Exception { return BrokerFactory.createBroker(new URI("xbean:org/apache/activemq/broker/store/loadtester.xml")); @@ -57,7 +62,7 @@ public class LoadTester extends JmsTestSupport { } public void testQueueSendThenAddConsumer() throws Exception { - ProgressPrinter printer = new ProgressPrinter(PRODUCE_COUNT, 20); + ProgressPrinter printer = new ProgressPrinter(produceCount, 20); ActiveMQDestination destination = new ActiveMQQueue("TEST"); @@ -68,29 +73,29 @@ public class LoadTester extends JmsTestSupport { MessageProducer producer = session.createProducer(destination); producer.setDeliveryMode(DeliveryMode.PERSISTENT); - log.info("Sending " + PRODUCE_COUNT + " messages that are " + (MESSAGE_SIZE / 1024.0) + "k large, for a total of " + (PRODUCE_COUNT * MESSAGE_SIZE / (1024.0 * 1024.0)) + LOG.info("Sending " + produceCount + " messages that are " + (messageSize / 1024.0) + "k large, for a total of " + (produceCount * messageSize / (1024.0 * 1024.0)) + " megs of data."); // Send a message to the broker. long start = System.currentTimeMillis(); - for (int i = 0; i < PRODUCE_COUNT; i++) { + for (int i = 0; i < produceCount; i++) { printer.increment(); BytesMessage msg = session.createBytesMessage(); - msg.writeBytes(new byte[MESSAGE_SIZE]); + msg.writeBytes(new byte[messageSize]); producer.send(msg); } long end1 = System.currentTimeMillis(); - log.info("Produced messages/sec: " + (PRODUCE_COUNT * 1000.0 / (end1 - start))); + LOG.info("Produced messages/sec: " + (produceCount * 1000.0 / (end1 - start))); - printer = new ProgressPrinter(PRODUCE_COUNT, 10); + printer = new ProgressPrinter(produceCount, 10); start = System.currentTimeMillis(); MessageConsumer consumer = session.createConsumer(destination); - for (int i = 0; i < PRODUCE_COUNT; i++) { + for (int i = 0; i < produceCount; i++) { printer.increment(); assertNotNull("Getting message: " + i, consumer.receive(20000)); } end1 = System.currentTimeMillis(); - log.info("Consumed messages/sec: " + (PRODUCE_COUNT * 1000.0 / (end1 - start))); + LOG.info("Consumed messages/sec: " + (produceCount * 1000.0 / (end1 - start))); } diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/util/LoggingBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/util/LoggingBrokerTest.java index 81876d38ba..a82fc02467 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/util/LoggingBrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/util/LoggingBrokerTest.java @@ -29,7 +29,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class LoggingBrokerTest extends JmsTopicSendReceiveTest { - private static final Log log = LogFactory.getLog(LoggingBrokerTest.class); + private static final Log LOG = LogFactory.getLog(LoggingBrokerTest.class); private BrokerService broker; protected void setUp() throws Exception { @@ -49,7 +49,7 @@ public class LoggingBrokerTest extends JmsTopicSendReceiveTest { } protected BrokerService createBroker(String uri) throws Exception { - log.info("Loading broker configuration from the classpath with URI: " + uri); + LOG.info("Loading broker configuration from the classpath with URI: " + uri); return BrokerFactory.createBroker(new URI("xbean:" + uri)); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/virtual/CompositeQueueTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/virtual/CompositeQueueTest.java index 7150ccb344..46e1008bdb 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/virtual/CompositeQueueTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/virtual/CompositeQueueTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -41,7 +41,7 @@ import org.apache.commons.logging.LogFactory; */ public class CompositeQueueTest extends EmbeddedBrokerTestSupport { - private static final Log log = LogFactory.getLog(CompositeQueueTest.class); + private static final Log LOG = LogFactory.getLog(CompositeQueueTest.class); private Connection connection; @@ -65,8 +65,8 @@ public class CompositeQueueTest extends EmbeddedBrokerTestSupport { Destination destination1 = getConsumer1Dsetination(); Destination destination2 = getConsumer2Dsetination(); - log.info("Sending to: " + producerDestination); - log.info("Consuming from: " + destination1 + " and " + destination2); + LOG.info("Sending to: " + producerDestination); + LOG.info("Consuming from: " + destination1 + " and " + destination2); MessageConsumer c1 = session.createConsumer(destination1); MessageConsumer c2 = session.createConsumer(destination2); diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java index 7829ff00c6..b6b5432358 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/test/java/org/apache/activemq/bugs/CraigsBugTest.java b/activemq-core/src/test/java/org/apache/activemq/bugs/CraigsBugTest.java index 20e5d78a76..ac23f2a371 100644 --- a/activemq-core/src/test/java/org/apache/activemq/bugs/CraigsBugTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/bugs/CraigsBugTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/test/java/org/apache/activemq/bugs/JmsDurableTopicSlowReceiveTest.java b/activemq-core/src/test/java/org/apache/activemq/bugs/JmsDurableTopicSlowReceiveTest.java index 7703b9b58c..8148d21024 100755 --- a/activemq-core/src/test/java/org/apache/activemq/bugs/JmsDurableTopicSlowReceiveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/bugs/JmsDurableTopicSlowReceiveTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.bugs; import java.util.Properties; @@ -36,7 +38,11 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.5 $ */ public class JmsDurableTopicSlowReceiveTest extends JmsTopicSendReceiveTest { - private static final transient Log log = LogFactory.getLog(JmsDurableTopicSlowReceiveTest.class); + + static final int NMSG = 100; + static final int MSIZE = 256000; + private static final transient Log LOG = LogFactory.getLog(JmsDurableTopicSlowReceiveTest.class); + private static final String COUNT_PROPERY_NAME = "count"; protected Connection connection2; protected Session session2; @@ -45,12 +51,9 @@ public class JmsDurableTopicSlowReceiveTest extends JmsTopicSendReceiveTest { protected MessageProducer producer2; protected Destination consumerDestination2; BrokerService broker; - static final int NMSG = 100; - static final int MSIZE = 256000; private Connection connection3; private Session consumeSession3; private TopicSubscriber consumer3; - private static final String countProperyName = "count"; /** * Set up a durable suscriber test. @@ -120,12 +123,12 @@ public class JmsDurableTopicSlowReceiveTest extends JmsTopicSendReceiveTest { BytesMessage message = session2.createBytesMessage(); message.writeBytes(new byte[MSIZE]); message.setStringProperty("test", "test"); - message.setIntProperty(countProperyName, count); + message.setIntProperty(COUNT_PROPERY_NAME, count); message.setJMSType("test"); producer2.send(consumerDestination2, message); Thread.sleep(50); if (verbose) { - log.debug("Sent(" + loop + "): " + i); + LOG.debug("Sent(" + loop + "): " + i); } count++; } @@ -155,15 +158,16 @@ public class JmsDurableTopicSlowReceiveTest extends JmsTopicSendReceiveTest { int i; for (i = 0; i < NMSG / 4; i++) { msg = consumer3.receive(10000); - if (msg == null) + if (msg == null) { break; + } if (verbose) { - log.debug("Received(" + loop + "): " + i + " count = " + msg.getIntProperty(countProperyName)); + LOG.debug("Received(" + loop + "): " + i + " count = " + msg.getIntProperty(COUNT_PROPERY_NAME)); } assertNotNull(msg); assertEquals(msg.getJMSType(), "test"); assertEquals(msg.getStringProperty("test"), "test"); - assertEquals("Messages received out of order", count, msg.getIntProperty(countProperyName)); + assertEquals("Messages received out of order", count, msg.getIntProperty(COUNT_PROPERY_NAME)); Thread.sleep(500); msg.acknowledge(); count++; diff --git a/activemq-core/src/test/java/org/apache/activemq/bugs/SlowConsumerTest.java b/activemq-core/src/test/java/org/apache/activemq/bugs/SlowConsumerTest.java index 710253612e..6c3978a6ff 100644 --- a/activemq-core/src/test/java/org/apache/activemq/bugs/SlowConsumerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/bugs/SlowConsumerTest.java @@ -37,7 +37,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class SlowConsumerTest extends TestCase { - private static final Log log = LogFactory.getLog(SlowConsumerTest.class); + private static final Log LOG = LogFactory.getLog(SlowConsumerTest.class); private Socket stompSocket; private ByteArrayOutputStream inputBuffer; @@ -70,7 +70,7 @@ public class SlowConsumerTest extends TestCase { for (int idx = 0; idx < MESSAGES_COUNT; ++idx) { Message message = session.createTextMessage("" + idx); producer.send(message); - log.debug("Sending: " + idx); + LOG.debug("Sending: " + idx); } producer.close(); session.close(); @@ -93,20 +93,20 @@ public class SlowConsumerTest extends TestCase { while (messagesCount != MESSAGES_COUNT) { Message msg = consumer.receive(messageReceiveTimeout); if (msg == null) { - log.warn("Got null message at count: " + messagesCount + ". Continuing..."); + LOG.warn("Got null message at count: " + messagesCount + ". Continuing..."); break; } String text = ((TextMessage)msg).getText(); int currentMsgIdx = Integer.parseInt(text); - log.debug("Received: " + text + " messageCount: " + messagesCount); + LOG.debug("Received: " + text + " messageCount: " + messagesCount); msg.acknowledge(); if ((messagesCount + diff) != currentMsgIdx) { - log.debug("Message(s) skipped!! Should be message no.: " + messagesCount + " but got: " + currentMsgIdx); + LOG.debug("Message(s) skipped!! Should be message no.: " + messagesCount + " but got: " + currentMsgIdx); diff = currentMsgIdx - messagesCount; } ++messagesCount; if (messagesCount % messageLogFrequency == 0) { - log.info("Received: " + messagesCount + " messages so far"); + LOG.info("Received: " + messagesCount + " messages so far"); } // Thread.sleep(70); } diff --git a/activemq-core/src/test/java/org/apache/activemq/camel/CamelJmsTest.java b/activemq-core/src/test/java/org/apache/activemq/camel/CamelJmsTest.java index ce2cc8bbce..a1b5a3f8a1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/camel/CamelJmsTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/camel/CamelJmsTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMapMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMapMessageTest.java index 402e396a4a..2f9f03fe47 100755 --- a/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMapMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMapMessageTest.java @@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class ActiveMQMapMessageTest extends TestCase { - private static final transient Log log = LogFactory.getLog(ActiveMQMapMessageTest.class); + private static final Log LOG = LogFactory.getLog(ActiveMQMapMessageTest.class); private String name = "testName"; @@ -252,7 +252,7 @@ public class ActiveMQMapMessageTest extends TestCase { msg.setObject("short", shortValue); msg.setObject("string", stringValue); } catch (MessageFormatException mfe) { - log.warn("Caught: " + mfe); + LOG.warn("Caught: " + mfe); mfe.printStackTrace(); fail("object formats should be correct"); } diff --git a/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java index ad9d52f262..b7cfc5e8f6 100755 --- a/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java @@ -31,15 +31,19 @@ import org.apache.activemq.openwire.OpenWireFormat; import org.apache.activemq.state.CommandVisitor; import org.apache.activemq.util.ByteSequence; import org.apache.activemq.wireformat.WireFormat; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision$ */ public class ActiveMQMessageTest extends TestCase { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(ActiveMQMessageTest.class); + private static final Log LOG = LogFactory.getLog(ActiveMQMessageTest.class); - private String jmsMessageID; + protected boolean readOnlyMessage; + + private String jmsMessageID; private String jmsCorrelationID; private ActiveMQDestination jmsDestination; private ActiveMQDestination jmsReplyTo; @@ -49,7 +53,6 @@ public class ActiveMQMessageTest extends TestCase { private long jmsExpiration; private int jmsPriority; private long jmsTimestamp; - protected boolean readOnlyMessage; private long[] consumerIDs; public static void main(String[] args) { @@ -183,7 +186,7 @@ public class ActiveMQMessageTest extends TestCase { assertTrue(msg1.getJMSPriority() == msg2.getJMSPriority()); assertTrue(msg1.getJMSTimestamp() == msg2.getJMSTimestamp()); - log.info("Message is: " + msg1); + LOG.info("Message is: " + msg1); } public void testGetAndSetJMSMessageID() throws Exception { @@ -443,7 +446,7 @@ public class ActiveMQMessageTest extends TestCase { msg.setStringProperty(null, "Cheese"); fail("Should have thrown exception"); } catch (IllegalArgumentException e) { - log.info("Worked, caught: " + e); + LOG.info("Worked, caught: " + e); } } @@ -454,7 +457,7 @@ public class ActiveMQMessageTest extends TestCase { msg.setStringProperty("", "Cheese"); fail("Should have thrown exception"); } catch (IllegalArgumentException e) { - log.info("Worked, caught: " + e); + LOG.info("Worked, caught: " + e); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/command/DataStructureTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/command/DataStructureTestSupport.java index d19ec5aad9..3ca569524b 100755 --- a/activemq-core/src/test/java/org/apache/activemq/command/DataStructureTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/command/DataStructureTestSupport.java @@ -59,13 +59,16 @@ public abstract class DataStructureTestSupport extends CombinationTestSupport { // } } - static public void assertEquals(Object expect, Object was) { - if (expect == null ^ was == null) + public static void assertEquals(Object expect, Object was) { + if (expect == null ^ was == null) { throw new AssertionFailedError("Not equals, expected: " + expect + ", was: " + was); - if (expect == null) + } + if (expect == null) { return; - if (expect.getClass() != was.getClass()) + } + if (expect.getClass() != was.getClass()) { throw new AssertionFailedError("Not equals, classes don't match. expected: " + expect.getClass() + ", was: " + was.getClass()); + } if (expect.getClass().isArray()) { Class componentType = expect.getClass().getComponentType(); if (componentType.isPrimitive()) { @@ -97,8 +100,9 @@ public abstract class DataStructureTestSupport extends CombinationTestSupport { } else { Object expectArray[] = (Object[])expect; Object wasArray[] = (Object[])was; - if (expectArray.length != wasArray.length) + if (expectArray.length != wasArray.length) { throw new AssertionFailedError("Not equals, array lengths don't match. expected: " + expectArray.length + ", was: " + wasArray.length); + } for (int i = 0; i < wasArray.length; i++) { assertEquals(expectArray[i], wasArray[i]); } diff --git a/activemq-core/src/test/java/org/apache/activemq/command/MessageCompressionTest.java b/activemq-core/src/test/java/org/apache/activemq/command/MessageCompressionTest.java index a562928000..af08fd8b2c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/command/MessageCompressionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/command/MessageCompressionTest.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -105,7 +105,7 @@ public class MessageCompressionTest extends TestCase { // public void testJavaUtilZip() throws Exception { // String str = "When the going gets weird, the weird turn pro."; // byte[] bytes = str.getBytes(); - // + // // ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length); // DeflaterOutputStream dos = new DeflaterOutputStream(baos); // dos. diff --git a/activemq-core/src/test/java/org/apache/activemq/command/MessageSendTest.java b/activemq-core/src/test/java/org/apache/activemq/command/MessageSendTest.java index a313a470ce..1f99b7669d 100755 --- a/activemq-core/src/test/java/org/apache/activemq/command/MessageSendTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/command/MessageSendTest.java @@ -20,9 +20,13 @@ import java.io.IOException; import junit.framework.Test; +import org.apache.activemq.JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest; import org.apache.activemq.util.ByteSequence; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public class MessageSendTest extends DataStructureTestSupport { + private static final Log LOG = LogFactory.getLog(MessageSendTest.class); public static Test suite() { return suite(MessageSendTest.class); @@ -70,6 +74,6 @@ public class MessageSendTest extends DataStructureTestSupport { } long end = System.currentTimeMillis(); - log.info("marshaled/unmarshaled: " + p + " msgs at " + (p * 1000f / (end - start)) + " msgs/sec"); + LOG.info("marshaled/unmarshaled: " + p + " msgs at " + (p * 1000f / (end - start)) + " msgs/sec"); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/config/BrokerPropertiesTest.java b/activemq-core/src/test/java/org/apache/activemq/config/BrokerPropertiesTest.java index dc9130fdb4..32c04c3b6f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/config/BrokerPropertiesTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/config/BrokerPropertiesTest.java @@ -26,12 +26,12 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class BrokerPropertiesTest extends TestCase { - private static final transient Log log = LogFactory.getLog(BrokerPropertiesTest.class); + private static final transient Log LOG = LogFactory.getLog(BrokerPropertiesTest.class); public void testPropertiesFile() throws Exception { BrokerService broker = BrokerFactory.createBroker("properties:org/apache/activemq/config/broker.properties"); - log.info("Created broker: " + broker); + LOG.info("Created broker: " + broker); assertNotNull(broker); assertEquals("isUseJmx()", false, broker.isUseJmx()); diff --git a/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java b/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java index d4095822be..f4ce2277ac 100755 --- a/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java @@ -52,7 +52,7 @@ import org.springframework.core.io.Resource; */ public class ConfigTest extends TestCase { - private static final Log log = LogFactory.getLog(ConfigTest.class); + private static final Log LOG = LogFactory.getLog(ConfigTest.class); protected static final String JOURNAL_ROOT = "target/test-data/"; protected static final String DERBY_ROOT = "target/test-data/"; @@ -106,7 +106,7 @@ public class ConfigTest extends TestCase { // settings... "); JournalPersistenceAdapter pa = (JournalPersistenceAdapter)broker.getPersistenceAdapter(); - log.info("Success"); + LOG.info("Success"); } finally { if (broker != null) { broker.stop(); @@ -137,7 +137,7 @@ public class ConfigTest extends TestCase { assertTrue("Should have created an EmbeddedDataSource", ((JDBCPersistenceAdapter)adapter).getDataSource() instanceof EmbeddedDataSource); assertTrue("Should have created a DefaultWireFormat", ((JDBCPersistenceAdapter)adapter).getWireFormat() instanceof ObjectStreamWireFormat); - log.info("Success"); + LOG.info("Success"); } finally { if (broker != null) { broker.stop(); @@ -159,7 +159,7 @@ public class ConfigTest extends TestCase { // Create broker from resource // System.out.print("Creating broker... "); broker = createBroker("org/apache/activemq/config/example.xml"); - log.info("Success"); + LOG.info("Success"); try { // Check broker configuration @@ -171,12 +171,12 @@ public class ConfigTest extends TestCase { assertEquals("Broker Config Error (persistent)", false, broker.isPersistent()); assertEquals("Broker Config Error (useShutdownHook)", false, broker.isUseShutdownHook()); assertEquals("Broker Config Error (deleteAllMessagesOnStartup)", true, broker.isDeleteAllMessagesOnStartup()); - log.info("Success"); + LOG.info("Success"); // Check specific vm transport // System.out.print("Checking vm connector... "); assertEquals("Should have a specific VM Connector", "vm://javacoola", broker.getVmConnectorURI().toString()); - log.info("Success"); + LOG.info("Success"); // Check transport connectors list // System.out.print("Checking transport connectors... "); @@ -190,7 +190,7 @@ public class ConfigTest extends TestCase { // System.out.print("Checking network connectors... "); List networkConnectors = broker.getNetworkConnectors(); assertEquals("Should have a single network connector", 1, networkConnectors.size()); - log.info("Success"); + LOG.info("Success"); // Check dispatch policy configuration // System.out.print("Checking dispatch policies... "); @@ -206,7 +206,7 @@ public class ConfigTest extends TestCase { dest = new ActiveMQTopic("Topic.StrictOrderDispatch"); assertTrue("Should have a strict order dispatch policy for " + dest.getTopicName(), broker.getDestinationPolicy().getEntryFor(dest).getDispatchPolicy() instanceof StrictOrderDispatchPolicy); - log.info("Success"); + LOG.info("Success"); // Check subscription policy configuration // System.out.print("Checking subscription recovery policies... "); @@ -230,7 +230,7 @@ public class ConfigTest extends TestCase { subsPolicy = broker.getDestinationPolicy().getEntryFor(dest).getSubscriptionRecoveryPolicy(); assertTrue("Should have a timed subscription recovery policy for " + dest.getTopicName(), subsPolicy instanceof TimedSubscriptionRecoveryPolicy); assertEquals("TimedSubsPolicy Config Error (recoverDuration)", 25000, ((TimedSubscriptionRecoveryPolicy)subsPolicy).getRecoverDuration()); - log.info("Success"); + LOG.info("Success"); // Check usage manager // System.out.print("Checking memory manager configurations... "); @@ -238,9 +238,9 @@ public class ConfigTest extends TestCase { assertTrue("Should have a memory manager", memMgr != null); assertEquals("UsageManager Config Error (limit)", 200000, memMgr.getLimit()); assertEquals("UsageManager Config Error (percentUsageMinDelta)", 20, memMgr.getPercentUsageMinDelta()); - log.info("Success"); + LOG.info("Success"); - log.info("Success"); + LOG.info("Success"); } finally { if (broker != null) { broker.stop(); @@ -268,7 +268,7 @@ public class ConfigTest extends TestCase { assertTrue("Should have created a journal persistence adapter", adapter instanceof JournalPersistenceAdapter); assertTrue("Should have created a journal directory at " + journalFile.getAbsolutePath(), journalFile.exists()); - log.info("Success"); + LOG.info("Success"); } finally { if (broker != null) { broker.stop(); @@ -301,7 +301,7 @@ public class ConfigTest extends TestCase { assertTrue("Should have not created a derby directory at " + derbyFile.getAbsolutePath(), !derbyFile.exists()); assertTrue("Should have not created a journal directory at " + journalFile.getAbsolutePath(), !journalFile.exists()); - log.info("Success"); + LOG.info("Success"); } finally { if (broker != null) { broker.stop(); diff --git a/activemq-core/src/test/java/org/apache/activemq/demo/DefaultQueueSender.java b/activemq-core/src/test/java/org/apache/activemq/demo/DefaultQueueSender.java index 94693d45ad..12af12fa7d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/demo/DefaultQueueSender.java +++ b/activemq-core/src/test/java/org/apache/activemq/demo/DefaultQueueSender.java @@ -46,7 +46,7 @@ import org.apache.activemq.ActiveMQConnectionFactory; */ public class DefaultQueueSender { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(DefaultQueueSender.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(DefaultQueueSender.class); public static void main(String[] args) { @@ -72,8 +72,8 @@ public class DefaultQueueSender { idx += 2; } String queueName = args[idx]; - log.info("Connecting to: " + uri); - log.info("Queue name is " + queueName); + LOG.info("Connecting to: " + uri); + LOG.info("Queue name is " + queueName); if (++idx < args.length) { text = args[idx]; @@ -89,7 +89,7 @@ public class DefaultQueueSender { Message message = session.createTextMessage(text); producer.send(message); } catch (JMSException e) { - log.info("Exception occurred: " + e.toString()); + LOG.info("Exception occurred: " + e.toString()); } finally { if (connection != null) { try { diff --git a/activemq-core/src/test/java/org/apache/activemq/demo/SimpleConsumer.java b/activemq-core/src/test/java/org/apache/activemq/demo/SimpleConsumer.java index 73981a8f2c..223eb29ed6 100755 --- a/activemq-core/src/test/java/org/apache/activemq/demo/SimpleConsumer.java +++ b/activemq-core/src/test/java/org/apache/activemq/demo/SimpleConsumer.java @@ -44,7 +44,7 @@ import javax.naming.NamingException; */ public class SimpleConsumer { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(SimpleConsumer.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(SimpleConsumer.class); /** * @param args the queue used by the example @@ -62,11 +62,11 @@ public class SimpleConsumer { * Read destination name from command line and display it. */ if (args.length != 1) { - log.info("Usage: java SimpleConsumer "); + LOG.info("Usage: java SimpleConsumer "); System.exit(1); } destinationName = args[0]; - log.info("Destination name is " + destinationName); + LOG.info("Destination name is " + destinationName); /* * Create a JNDI API InitialContext object @@ -74,7 +74,7 @@ public class SimpleConsumer { try { jndiContext = new InitialContext(); } catch (NamingException e) { - log.info("Could not create JNDI API " + "context: " + e.toString()); + LOG.info("Could not create JNDI API " + "context: " + e.toString()); System.exit(1); } @@ -85,7 +85,7 @@ public class SimpleConsumer { connectionFactory = (ConnectionFactory)jndiContext.lookup("ConnectionFactory"); destination = (Destination)jndiContext.lookup(destinationName); } catch (NamingException e) { - log.info("JNDI API lookup failed: " + e.toString()); + LOG.info("JNDI API lookup failed: " + e.toString()); System.exit(1); } @@ -106,14 +106,14 @@ public class SimpleConsumer { if (m != null) { if (m instanceof TextMessage) { TextMessage message = (TextMessage)m; - log.info("Reading message: " + message.getText()); + LOG.info("Reading message: " + message.getText()); } else { break; } } } } catch (JMSException e) { - log.info("Exception occurred: " + e); + LOG.info("Exception occurred: " + e); } finally { if (connection != null) { try { diff --git a/activemq-core/src/test/java/org/apache/activemq/demo/SimpleProducer.java b/activemq-core/src/test/java/org/apache/activemq/demo/SimpleProducer.java index b3f4dae6a0..e9346f988d 100755 --- a/activemq-core/src/test/java/org/apache/activemq/demo/SimpleProducer.java +++ b/activemq-core/src/test/java/org/apache/activemq/demo/SimpleProducer.java @@ -47,7 +47,7 @@ import javax.naming.NamingException; */ public class SimpleProducer { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(SimpleProducer.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(SimpleProducer.class); /** * @param args the destination name to send to and optionally, the number of @@ -61,18 +61,18 @@ public class SimpleProducer { Destination destination = null; MessageProducer producer = null; String destinationName = null; - final int NUM_MSGS; + final int numMsgs; if ((args.length < 1) || (args.length > 2)) { - log.info("Usage: java SimpleProducer []"); + LOG.info("Usage: java SimpleProducer []"); System.exit(1); } destinationName = args[0]; - log.info("Destination name is " + destinationName); + LOG.info("Destination name is " + destinationName); if (args.length == 2) { - NUM_MSGS = (new Integer(args[1])).intValue(); + numMsgs = (new Integer(args[1])).intValue(); } else { - NUM_MSGS = 1; + numMsgs = 1; } /* @@ -81,7 +81,7 @@ public class SimpleProducer { try { jndiContext = new InitialContext(); } catch (NamingException e) { - log.info("Could not create JNDI API context: " + e.toString()); + LOG.info("Could not create JNDI API context: " + e.toString()); System.exit(1); } @@ -92,7 +92,7 @@ public class SimpleProducer { connectionFactory = (ConnectionFactory)jndiContext.lookup("ConnectionFactory"); destination = (Destination)jndiContext.lookup(destinationName); } catch (NamingException e) { - log.info("JNDI API lookup failed: " + e); + LOG.info("JNDI API lookup failed: " + e); System.exit(1); } @@ -107,9 +107,9 @@ public class SimpleProducer { session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(destination); TextMessage message = session.createTextMessage(); - for (int i = 0; i < NUM_MSGS; i++) { + for (int i = 0; i < numMsgs; i++) { message.setText("This is message " + (i + 1)); - log.info("Sending message: " + message.getText()); + LOG.info("Sending message: " + message.getText()); producer.send(message); } @@ -118,7 +118,7 @@ public class SimpleProducer { */ producer.send(session.createMessage()); } catch (JMSException e) { - log.info("Exception occurred: " + e); + LOG.info("Exception occurred: " + e); } finally { if (connection != null) { try { diff --git a/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueReceiver.java b/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueReceiver.java index 75526fcd31..b22a3132a1 100755 --- a/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueReceiver.java +++ b/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueReceiver.java @@ -39,7 +39,7 @@ import javax.naming.NamingException; public class SimpleQueueReceiver { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(SimpleQueueReceiver.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(SimpleQueueReceiver.class); /** * Main method. @@ -60,11 +60,11 @@ public class SimpleQueueReceiver { * Read queue name from command line and display it. */ if (args.length != 1) { - log.info("Usage: java " + "SimpleQueueReceiver "); + LOG.info("Usage: java " + "SimpleQueueReceiver "); System.exit(1); } queueName = args[0]; - log.info("Queue name is " + queueName); + LOG.info("Queue name is " + queueName); /* * Create a JNDI API InitialContext object if none exists yet. @@ -72,7 +72,7 @@ public class SimpleQueueReceiver { try { jndiContext = new InitialContext(); } catch (NamingException e) { - log.info("Could not create JNDI API " + "context: " + e.toString()); + LOG.info("Could not create JNDI API " + "context: " + e.toString()); System.exit(1); } @@ -83,7 +83,7 @@ public class SimpleQueueReceiver { queueConnectionFactory = (QueueConnectionFactory)jndiContext.lookup("QueueConnectionFactory"); queue = (Queue)jndiContext.lookup(queueName); } catch (NamingException e) { - log.info("JNDI API lookup failed: " + e.toString()); + LOG.info("JNDI API lookup failed: " + e.toString()); System.exit(1); } @@ -104,14 +104,14 @@ public class SimpleQueueReceiver { if (m != null) { if (m instanceof TextMessage) { message = (TextMessage)m; - log.info("Reading message: " + message.getText()); + LOG.info("Reading message: " + message.getText()); } else { break; } } } } catch (JMSException e) { - log.info("Exception occurred: " + e.toString()); + LOG.info("Exception occurred: " + e.toString()); } finally { if (queueConnection != null) { try { diff --git a/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueSender.java b/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueSender.java index 941c8ce530..3fd411166e 100755 --- a/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueSender.java +++ b/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueSender.java @@ -42,7 +42,7 @@ import javax.naming.NamingException; public class SimpleQueueSender { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(SimpleQueueSender.class); + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(SimpleQueueSender.class); /** * Main method. @@ -59,18 +59,18 @@ public class SimpleQueueSender { Queue queue = null; QueueSender queueSender = null; TextMessage message = null; - final int NUM_MSGS; + final int numMsgs; if ((args.length < 1) || (args.length > 2)) { - log.info("Usage: java SimpleQueueSender " + " []"); + LOG.info("Usage: java SimpleQueueSender " + " []"); System.exit(1); } queueName = args[0]; - log.info("Queue name is " + queueName); + LOG.info("Queue name is " + queueName); if (args.length == 2) { - NUM_MSGS = (new Integer(args[1])).intValue(); + numMsgs = (new Integer(args[1])).intValue(); } else { - NUM_MSGS = 1; + numMsgs = 1; } /* @@ -79,7 +79,7 @@ public class SimpleQueueSender { try { jndiContext = new InitialContext(); } catch (NamingException e) { - log.info("Could not create JNDI API context: " + e.toString()); + LOG.info("Could not create JNDI API context: " + e.toString()); System.exit(1); } @@ -90,7 +90,7 @@ public class SimpleQueueSender { queueConnectionFactory = (QueueConnectionFactory)jndiContext.lookup("QueueConnectionFactory"); queue = (Queue)jndiContext.lookup(queueName); } catch (NamingException e) { - log.info("JNDI API lookup failed: " + e); + LOG.info("JNDI API lookup failed: " + e); System.exit(1); } @@ -105,9 +105,9 @@ public class SimpleQueueSender { queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); queueSender = queueSession.createSender(queue); message = queueSession.createTextMessage(); - for (int i = 0; i < NUM_MSGS; i++) { + for (int i = 0; i < numMsgs; i++) { message.setText("This is message " + (i + 1)); - log.info("Sending message: " + message.getText()); + LOG.info("Sending message: " + message.getText()); queueSender.send(message); } @@ -116,7 +116,7 @@ public class SimpleQueueSender { */ queueSender.send(queueSession.createMessage()); } catch (JMSException e) { - log.info("Exception occurred: " + e.toString()); + LOG.info("Exception occurred: " + e.toString()); } finally { if (queueConnection != null) { try { diff --git a/activemq-core/src/test/java/org/apache/activemq/filter/BadDummyPolicyConfigTest.java b/activemq-core/src/test/java/org/apache/activemq/filter/BadDummyPolicyConfigTest.java index bc126152f2..cd5297ee88 100644 --- a/activemq-core/src/test/java/org/apache/activemq/filter/BadDummyPolicyConfigTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/filter/BadDummyPolicyConfigTest.java @@ -25,7 +25,7 @@ import org.apache.commons.logging.LogFactory; */ public class BadDummyPolicyConfigTest extends TestCase { - protected static final Log log = LogFactory.getLog(BadDummyPolicyConfigTest.class); + private static final Log LOG = LogFactory.getLog(BadDummyPolicyConfigTest.class); protected DummyPolicy policy = new DummyPolicy(); public void testNoDestinationSpecified() throws Exception { @@ -54,7 +54,7 @@ public class BadDummyPolicyConfigTest extends TestCase { try { entry.afterPropertiesSet(); } catch (IllegalArgumentException e) { - log.info("Worked! Caught expected exception: " + e); + LOG.info("Worked! Caught expected exception: " + e); } } } diff --git a/activemq-core/src/test/java/org/apache/activemq/jndi/InitialContextTest.java b/activemq-core/src/test/java/org/apache/activemq/jndi/InitialContextTest.java index 8276aa233b..209a0e05a0 100755 --- a/activemq-core/src/test/java/org/apache/activemq/jndi/InitialContextTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/jndi/InitialContextTest.java @@ -28,19 +28,18 @@ import org.apache.activemq.ActiveMQConnectionFactory; * @version $Revision: 1.3 $ */ public class InitialContextTest extends TestCase { - - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory - .getLog(InitialContextTest.class); - + + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(InitialContextTest.class); + public void testInitialContext() throws Exception { InitialContext context = new InitialContext(); assertTrue("Created context", context != null); - ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory"); + ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory)context.lookup("ConnectionFactory"); assertTrue("Should have created a ConnectionFactory", connectionFactory != null); - log.info("Created with brokerURL: " + connectionFactory.getBrokerURL()); + LOG.info("Created with brokerURL: " + connectionFactory.getBrokerURL()); } @@ -53,17 +52,15 @@ public class InitialContextTest extends TestCase { InitialContext context = new InitialContext(properties); assertTrue("Created context", context != null); - ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory"); + ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory)context.lookup("ConnectionFactory"); assertTrue("Should have created a ConnectionFactory", connectionFactory != null); assertEquals("the brokerURL should match", expected, connectionFactory.getBrokerURL()); } - - - + public void testConnectionFactoryPolicyConfig() throws Exception { - + Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); properties.put(Context.PROVIDER_URL, "tcp://localhost:65432"); @@ -74,7 +71,7 @@ public class InitialContextTest extends TestCase { InitialContext context = new InitialContext(properties); assertTrue("Created context", context != null); - ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory"); + ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory)context.lookup("ConnectionFactory"); assertTrue("Should have created a ConnectionFactory", connectionFactory != null); diff --git a/activemq-core/src/test/java/org/apache/activemq/jndi/JNDITestSupport.java b/activemq-core/src/test/java/org/apache/activemq/jndi/JNDITestSupport.java index 167a642c26..48701999ab 100755 --- a/activemq-core/src/test/java/org/apache/activemq/jndi/JNDITestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/jndi/JNDITestSupport.java @@ -35,7 +35,7 @@ import org.apache.activemq.ActiveMQConnectionFactory; */ public abstract class JNDITestSupport extends TestCase { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(JNDITestSupport.class); protected Hashtable environment = new Hashtable(); @@ -56,7 +56,7 @@ public abstract class JNDITestSupport extends TestCase { NamingEnumeration iter = childContext.listBindings(""); while (iter.hasMore()) { Binding destinationBinding = (Binding) iter.next(); - log.info("Found destination: " + destinationBinding.getName()); + LOG.info("Found destination: " + destinationBinding.getName()); Object destination = destinationBinding.getObject(); assertTrue("Should have a Destination but got: " + destination, destination instanceof Destination); } diff --git a/activemq-core/src/test/java/org/apache/activemq/kaha/Loader.java b/activemq-core/src/test/java/org/apache/activemq/kaha/Loader.java index daa6d9e377..ad12b2eb5c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/kaha/Loader.java +++ b/activemq-core/src/test/java/org/apache/activemq/kaha/Loader.java @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; */ class Loader extends Thread { - protected static final Log log = LogFactory.getLog(Loader.class); + private static final Log LOG = LogFactory.getLog(Loader.class); private String name; private Store store; @@ -67,7 +67,7 @@ class Loader extends Thread { } long finishLoad = System.currentTimeMillis(); long totalLoadTime = finishLoad - startLoad; - log.info("name " + name + " load time = " + totalLoadTime + "(ms)"); + LOG.info("name " + name + " load time = " + totalLoadTime + "(ms)"); Set keys = container.keySet(); long startExtract = System.currentTimeMillis(); @@ -77,7 +77,7 @@ class Loader extends Thread { } long finishExtract = System.currentTimeMillis(); long totalExtractTime = finishExtract - startExtract; - log.info("name " + name + " extract time = " + totalExtractTime + "(ms)"); + LOG.info("name " + name + " extract time = " + totalExtractTime + "(ms)"); long startRemove = System.currentTimeMillis(); for (Iterator i = keys.iterator(); i.hasNext();) { @@ -85,7 +85,7 @@ class Loader extends Thread { } long finishRemove = System.currentTimeMillis(); long totalRemoveTime = finishRemove - startRemove; - log.info("name " + name + " remove time = " + totalRemoveTime + "(ms)"); + LOG.info("name " + name + " remove time = " + totalRemoveTime + "(ms)"); // re-insert data of longer length startLoad = System.currentTimeMillis(); value = getData(2048); @@ -97,7 +97,7 @@ class Loader extends Thread { } finishLoad = System.currentTimeMillis(); totalLoadTime = finishLoad - startLoad; - log.info("name " + name + " 2nd load time = " + totalLoadTime + "(ms)"); + LOG.info("name " + name + " 2nd load time = " + totalLoadTime + "(ms)"); } catch (Exception e) { e.printStackTrace(); diff --git a/activemq-core/src/test/java/org/apache/activemq/kaha/VolumeTest.java b/activemq-core/src/test/java/org/apache/activemq/kaha/VolumeTest.java index 91f848d717..b0efa39b5d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/kaha/VolumeTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/kaha/VolumeTest.java @@ -24,7 +24,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class VolumeTest extends TestCase { - private static final transient Log log = LogFactory.getLog(VolumeTest.class); + private static final transient Log LOG = LogFactory.getLog(VolumeTest.class); protected Store store; protected String name; @@ -36,12 +36,12 @@ public class VolumeTest extends TestCase { */ public void testListVolume() throws Exception { ListContainer container = store.getListContainer("volume"); - container.setMarshaller(Store.BytesMarshaller); + container.setMarshaller(Store.BYTES_MARSHALLER); byte[] data = new byte[10]; for (int i = 0; i < NUMBER; i++) { container.add(data); if (i % 100000 == 0) { - log.error("persisted " + i); + LOG.error("persisted " + i); } } @@ -51,7 +51,7 @@ public class VolumeTest extends TestCase { assertNotNull(i.next()); count++; if (count % 100000 == 0) { - log.error("retrived " + count); + LOG.error("retrived " + count); } } assertEquals("Different retrieved to stored", NUMBER, count); diff --git a/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/JournalImplTest.java b/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/JournalImplTest.java index f272e485f1..d6d545418a 100644 --- a/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/JournalImplTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/JournalImplTest.java @@ -71,8 +71,9 @@ public class JournalImplTest extends TestCase { protected void tearDown() throws Exception { journal.close(); - if (logDirectory.exists()) + if (logDirectory.exists()) { deleteDir(logDirectory); + } // assertTrue( !logDirectory.exists() ); } @@ -165,12 +166,15 @@ public class JournalImplTest extends TestCase { // System.out.println("Comparing: "+new String(arg0)+" and "+new // String(arg1)); - if (arg0 == null ^ arg1 == null) + if (arg0 == null ^ arg1 == null) { fail("Not equal: " + arg0 + " != " + arg1); - if (arg0 == null) + } + if (arg0 == null) { return; - if (arg0.length != arg1.length) + } + if (arg0.length != arg1.length) { fail("Array lenght not equal: " + arg0.length + " != " + arg1.length); + } for (int i = 0; i < arg0.length; i++) { if (arg0[i] != arg1[i]) { fail("Array item not equal at index " + i + ": " + arg0[i] + " != " + arg1[i]); diff --git a/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/LocationTest.java b/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/LocationTest.java index 5bc0907f74..12c7251c77 100644 --- a/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/LocationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/LocationTest.java @@ -31,10 +31,10 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public class LocationTest extends TestCase { - private static final transient Log log = LogFactory.getLog(LocationTest.class); + private static final transient Log LOG = LogFactory.getLog(LocationTest.class); @SuppressWarnings("unchecked") - synchronized public void testRecordLocationImplComparison() throws IOException { + public synchronized void testRecordLocationImplComparison() throws IOException { Location l1 = new Location(); l1.setDataFileId(0); l1.setOffset(5); @@ -54,7 +54,7 @@ public class LocationTest extends TestCase { Collections.sort(l); // Did they get sorted to the correct order? - log.debug(l.get(0)); + LOG.debug(l.get(0)); assertSame(l.get(0).getLocation(), l1); assertSame(l.get(1).getLocation(), l2); assertSame(l.get(2).getLocation(), l3); diff --git a/activemq-core/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashTest.java b/activemq-core/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashTest.java index e7c35fe925..5853651889 100644 --- a/activemq-core/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index.hash; import java.io.File; @@ -27,7 +29,7 @@ import org.apache.activemq.util.IOHelper; */ public class HashTest extends TestCase { - private static int COUNT = 1000; + private static final int COUNT = 1000; private HashIndex hashIndex; private File directory; private IndexManager indexManager; @@ -42,7 +44,7 @@ public class HashTest extends TestCase { directory.mkdirs(); indexManager = new IndexManager(directory, "im-hash-test", "rw", null); this.hashIndex = new HashIndex(directory, "testHash", indexManager); - this.hashIndex.setKeyMarshaller(Store.StringMarshaller); + this.hashIndex.setKeyMarshaller(Store.STRING_MARSHALLER); } public void testHashIndex() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/kaha/impl/index/tree/TreeTest.java b/activemq-core/src/test/java/org/apache/activemq/kaha/impl/index/tree/TreeTest.java index e1ef4eff49..716bbdd435 100644 --- a/activemq-core/src/test/java/org/apache/activemq/kaha/impl/index/tree/TreeTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/kaha/impl/index/tree/TreeTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.kaha.impl.index.tree; import java.io.File; @@ -27,7 +29,7 @@ import org.apache.activemq.kaha.impl.index.IndexManager; */ public class TreeTest extends TestCase { - private static int COUNT = 55; + private static final int COUNT = 55; private TreeIndex tree; private File directory; private IndexManager indexManager; @@ -43,7 +45,7 @@ public class TreeTest extends TestCase { directory.mkdirs(); indexManager = new IndexManager(directory, "im-test", "rw", null); this.tree = new TreeIndex(directory, "testTree", indexManager); - this.tree.setKeyMarshaller(Store.StringMarshaller); + this.tree.setKeyMarshaller(Store.STRING_MARSHALLER); } public void testTreeWithCaching() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/management/BoundaryStatisticTest.java b/activemq-core/src/test/java/org/apache/activemq/management/BoundaryStatisticTest.java index 2085ac26e8..194cbbcf11 100755 --- a/activemq-core/src/test/java/org/apache/activemq/management/BoundaryStatisticTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/management/BoundaryStatisticTest.java @@ -19,7 +19,7 @@ package org.apache.activemq.management; public class BoundaryStatisticTest extends StatisticTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(BoundaryStatisticTest.class); /** @@ -33,6 +33,6 @@ public class BoundaryStatisticTest extends StatisticTestSupport { assertEquals(1000, stat.getLowerBound()); assertEquals(2000, stat.getUpperBound()); - log.info("Stat is: " + stat); + LOG.info("Stat is: " + stat); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/management/CountStatisticTest.java b/activemq-core/src/test/java/org/apache/activemq/management/CountStatisticTest.java index 1b6e6321c7..85f8be104d 100755 --- a/activemq-core/src/test/java/org/apache/activemq/management/CountStatisticTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/management/CountStatisticTest.java @@ -19,7 +19,7 @@ package org.apache.activemq.management; public class CountStatisticTest extends StatisticTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(CountStatisticTest.class); /** @@ -48,7 +48,7 @@ public class CountStatisticTest extends StatisticTestSupport { assertLastTimeNotStartTime(stat); - log.info("Counter is: " + stat); + LOG.info("Counter is: " + stat); stat.reset(); diff --git a/activemq-core/src/test/java/org/apache/activemq/management/RangeStatisticTest.java b/activemq-core/src/test/java/org/apache/activemq/management/RangeStatisticTest.java index d90f5b7f46..49caa986fc 100755 --- a/activemq-core/src/test/java/org/apache/activemq/management/RangeStatisticTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/management/RangeStatisticTest.java @@ -19,7 +19,7 @@ package org.apache.activemq.management; public class RangeStatisticTest extends StatisticTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(RangeStatisticTest.class); /** @@ -62,7 +62,7 @@ public class RangeStatisticTest extends StatisticTestSupport { assertLastTimeNotStartTime(stat); - log.info("Stat is: " + stat); + LOG.info("Stat is: " + stat); stat.reset(); diff --git a/activemq-core/src/test/java/org/apache/activemq/management/TimeStatisticTest.java b/activemq-core/src/test/java/org/apache/activemq/management/TimeStatisticTest.java index b313f4be20..88ec2eac1c 100755 --- a/activemq-core/src/test/java/org/apache/activemq/management/TimeStatisticTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/management/TimeStatisticTest.java @@ -19,7 +19,7 @@ package org.apache.activemq.management; public class TimeStatisticTest extends StatisticTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory + private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory .getLog(TimeStatisticTest.class); /** @@ -56,7 +56,7 @@ public class TimeStatisticTest extends StatisticTestSupport { assertLastTimeNotStartTime(stat); - log.info("Stat is: " + stat); + LOG.info("Stat is: " + stat); stat.reset(); diff --git a/activemq-core/src/test/java/org/apache/activemq/memory/buffer/MemoryBufferTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/memory/buffer/MemoryBufferTestSupport.java index 6cae07c105..f2c39ad385 100644 --- a/activemq-core/src/test/java/org/apache/activemq/memory/buffer/MemoryBufferTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/memory/buffer/MemoryBufferTestSupport.java @@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public abstract class MemoryBufferTestSupport extends TestCase { - protected static final Log log = LogFactory.getLog(MemoryBufferTestSupport.class); + private static final Log LOG = LogFactory.getLog(MemoryBufferTestSupport.class); protected abstract MessageBuffer createMessageBuffer(); @@ -45,14 +45,14 @@ public abstract class MemoryBufferTestSupport extends TestCase { } protected void dump() { - log.info("Dumping current state"); + LOG.info("Dumping current state"); dumpQueue(qA, "A"); dumpQueue(qB, "B"); dumpQueue(qC, "C"); } protected void dumpQueue(MessageQueue queue, String name) { - log.info(" " + name + " = " + queue.getList()); + LOG.info(" " + name + " = " + queue.getList()); } protected ActiveMQMessage createMessage(int size) throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java b/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java index d003b23a06..7f40f001c8 100755 --- a/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.network; import org.apache.activemq.broker.BrokerService; @@ -20,7 +22,7 @@ import org.apache.commons.logging.LogFactory; public class DuplexNetworkTest extends SimpleNetworkTest { - protected static final Log log = LogFactory.getLog(DuplexNetworkTest.class); + private static final Log LOG = LogFactory.getLog(DuplexNetworkTest.class); protected String getLocalBrokerURI() { return "org/apache/activemq/network/duplexLocalBroker.xml"; diff --git a/activemq-core/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java index 210bb15877..cea4f7c63c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java @@ -48,7 +48,7 @@ import org.apache.commons.logging.LogFactory; */ public class NetworkReconnectTest extends TestCase { - protected static final Log log = LogFactory.getLog(NetworkReconnectTest.class); + private static final Log LOG = LogFactory.getLog(NetworkReconnectTest.class); private BrokerService producerBroker; private BrokerService consumerBroker; @@ -184,9 +184,9 @@ public class NetworkReconnectTest extends TestCase { protected void setUp() throws Exception { - log.info("==============================================================================="); - log.info("Running Test Case: " + getName()); - log.info("==============================================================================="); + LOG.info("==============================================================================="); + LOG.info("Running Test Case: " + getName()); + LOG.info("==============================================================================="); producerConnectionFactory = createProducerConnectionFactory(); consumerConnectionFactory = createConsumerConnectionFactory(); diff --git a/activemq-core/src/test/java/org/apache/activemq/network/SSHTunnelNetworkReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/network/SSHTunnelNetworkReconnectTest.java index adb33100a3..6093cc2490 100644 --- a/activemq-core/src/test/java/org/apache/activemq/network/SSHTunnelNetworkReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/SSHTunnelNetworkReconnectTest.java @@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory; * @author chirino */ public class SSHTunnelNetworkReconnectTest extends NetworkReconnectTest { - private static final transient Log log = LogFactory.getLog(SSHTunnelNetworkReconnectTest.class); + private static final transient Log LOG = LogFactory.getLog(SSHTunnelNetworkReconnectTest.class); ArrayList processes = new ArrayList(); diff --git a/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java b/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java index ded065c8ce..5456f7f3db 100755 --- a/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java @@ -45,7 +45,7 @@ import org.springframework.core.io.Resource; public class SimpleNetworkTest extends TestCase { - protected static final Log log = LogFactory.getLog(SimpleNetworkTest.class); + private static final Log LOG = LogFactory.getLog(SimpleNetworkTest.class); protected static final int MESSAGE_COUNT = 10; protected AbstractApplicationContext context; @@ -86,11 +86,11 @@ public class SimpleNetworkTest extends TestCase { TextMessage msg = localSession.createTextMessage("test msg: " + i); TextMessage result = (TextMessage)requestor.request(msg); assertNotNull(result); - log.info(result.getText()); + LOG.info(result.getText()); } } - public void XtestFiltering() throws Exception { + public void xtestFiltering() throws Exception { MessageConsumer includedConsumer = remoteSession.createConsumer(included); MessageConsumer excludedConsumer = remoteSession.createConsumer(excluded); @@ -104,7 +104,7 @@ public class SimpleNetworkTest extends TestCase { assertNotNull(includedConsumer.receive(500)); } - public void XtestConduitBridge() throws Exception { + public void xtestConduitBridge() throws Exception { MessageConsumer consumer1 = remoteSession.createConsumer(included); MessageConsumer consumer2 = remoteSession.createConsumer(included); MessageProducer producer = localSession.createProducer(included); @@ -121,7 +121,7 @@ public class SimpleNetworkTest extends TestCase { assertNull(consumer2.receive(500)); } - public void XtestDurableStoreAndForward() throws Exception { + public void xtestDurableStoreAndForward() throws Exception { // create a remote durable consumer MessageConsumer remoteConsumer = remoteSession.createDurableSubscriber(included, consumerName); Thread.sleep(1000); @@ -192,10 +192,10 @@ public class SimpleNetworkTest extends TestCase { return "org/apache/activemq/network/localBroker.xml"; } - protected BrokerService createBroker(String URI) throws Exception { - Resource resource = new ClassPathResource(URI); + protected BrokerService createBroker(String uri) throws Exception { + Resource resource = new ClassPathResource(uri); BrokerFactoryBean factory = new BrokerFactoryBean(resource); - resource = new ClassPathResource(URI); + resource = new ClassPathResource(uri); factory = new BrokerFactoryBean(resource); factory.afterPropertiesSet(); BrokerService result = factory.getBroker(); diff --git a/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java b/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java index d7ace52cb0..4db12c6c87 100755 --- a/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java @@ -39,7 +39,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class QueueBridgeTest extends TestCase implements MessageListener { - protected static final Log log = LogFactory.getLog(QueueBridgeTest.class); + private static final Log LOG = LogFactory.getLog(QueueBridgeTest.class); protected static final int MESSAGE_COUNT = 10; protected AbstractApplicationContext context; @@ -90,7 +90,7 @@ public class QueueBridgeTest extends TestCase implements MessageListener { TextMessage msg = requestServerSession.createTextMessage("test msg: " + i); TextMessage result = (TextMessage)requestor.request(msg); assertNotNull(result); - log.info(result.getText()); + LOG.info(result.getText()); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeSpringTest.java b/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeSpringTest.java index 35b29846aa..fada65e28b 100755 --- a/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeSpringTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeSpringTest.java @@ -38,7 +38,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class TopicBridgeSpringTest extends TestCase implements MessageListener { - protected static final Log log = LogFactory.getLog(TopicBridgeSpringTest.class); + private static final Log LOG = LogFactory.getLog(TopicBridgeSpringTest.class); protected static final int MESSAGE_COUNT = 10; protected AbstractApplicationContext context; @@ -81,10 +81,10 @@ public class TopicBridgeSpringTest extends TestCase implements MessageListener { public void testTopicRequestorOverBridge() throws JMSException { for (int i = 0; i < MESSAGE_COUNT; i++) { TextMessage msg = requestServerSession.createTextMessage("test msg: " + i); - log.info("Making request: " + msg); + LOG.info("Making request: " + msg); TextMessage result = (TextMessage)requestor.request(msg); assertNotNull(result); - log.info("Received result: " + result.getText()); + LOG.info("Received result: " + result.getText()); } } @@ -96,7 +96,7 @@ public class TopicBridgeSpringTest extends TestCase implements MessageListener { replyTo = msg.getJMSReplyTo(); textMsg.clearBody(); textMsg.setText(payload); - log.info("Sending response: " + textMsg); + LOG.info("Sending response: " + textMsg); requestServerProducer.send(replyTo, textMsg); } catch (JMSException e) { // TODO Auto-generated catch block diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/BooleanStreamTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/BooleanStreamTest.java index db5b0354bf..5d51e64165 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/BooleanStreamTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/BooleanStreamTest.java @@ -35,7 +35,7 @@ public class BooleanStreamTest extends TestCase { int numberOfBytes = 8 * 200; interface BooleanValueSet { - public boolean getBooleanValueFor(int index, int count); + boolean getBooleanValueFor(int index, int count); } public void testBooleanMarshallingUsingAllTrue() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java index 57f48e9a83..fe56a0764c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java @@ -29,16 +29,16 @@ import java.util.Iterator; import junit.framework.Assert; -abstract public class DataFileGenerator extends Assert { +public abstract class DataFileGenerator extends Assert { - static final File moduleBaseDir; - static final File controlDir; - static final File classFileDir; + static final File MODULE_BASE_DIR; + static final File CONTROL_DIR; + static final File CLASS_FILE_DIR; static { - moduleBaseDir = new File(System.getProperty("basedir", ".")); - controlDir = new File(moduleBaseDir, "src/test/resources/openwire-control"); - classFileDir = new File(moduleBaseDir, "src/test/java/org/apache/activemq/openwire"); + MODULE_BASE_DIR = new File(System.getProperty("basedir", ".")); + CONTROL_DIR = new File(MODULE_BASE_DIR, "src/test/resources/openwire-control"); + CLASS_FILE_DIR = new File(MODULE_BASE_DIR, "src/test/java/org/apache/activemq/openwire"); } public static void main(String[] args) throws Exception { @@ -55,7 +55,7 @@ abstract public class DataFileGenerator extends Assert { public static ArrayList getAllDataFileGenerators() throws Exception { // System.out.println("Looking for generators in : "+classFileDir); ArrayList l = new ArrayList(); - File[] files = classFileDir.listFiles(); + File[] files = CLASS_FILE_DIR.listFiles(); for (int i = 0; files != null && i < files.length; i++) { File file = files[i]; if (file.getName().endsWith("Data.java")) { @@ -83,8 +83,8 @@ abstract public class DataFileGenerator extends Assert { } public void generateControlFile() throws Exception { - controlDir.mkdirs(); - File dataFile = new File(controlDir, getClass().getName() + ".bin"); + CONTROL_DIR.mkdirs(); + File dataFile = new File(CONTROL_DIR, getClass().getName() + ".bin"); OpenWireFormat wf = new OpenWireFormat(); wf.setCacheEnabled(false); @@ -121,7 +121,7 @@ abstract public class DataFileGenerator extends Assert { } public void assertControlFileIsEqual() throws Exception { - File dataFile = new File(controlDir, getClass().getName() + ".bin"); + File dataFile = new File(CONTROL_DIR, getClass().getName() + ".bin"); FileInputStream is1 = new FileInputStream(dataFile); int pos = 0; try { @@ -142,5 +142,5 @@ abstract public class DataFileGenerator extends Assert { } } - abstract protected Object createObject() throws IOException; + protected abstract Object createObject() throws IOException; } diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java index 5b56d75d3e..9a6ccd218f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java @@ -61,14 +61,14 @@ import org.apache.commons.logging.LogFactory; public abstract class DataFileGeneratorTestSupport extends TestSupport { - private static final Log log = LogFactory.getLog(DataFileGeneratorTestSupport.class); - protected static final Object[] EMPTY_ARGUMENTS = {}; - private static Throwable singletonException = new Exception("shared exception"); + private static final Log LOG = LogFactory.getLog(DataFileGeneratorTestSupport.class); + + private static final Throwable SINGLETON_EXCEPTION = new Exception("shared exception"); + private static final File MODULE_BASE_DIR; + private static final File CONTROL_DIR; + private static final File CLASS_FILE_DIR; - static final File moduleBaseDir; - static final File controlDir; - static final File classFileDir; static { File basedir = null; @@ -79,15 +79,15 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { } catch (Exception e) { throw new RuntimeException(e); } - moduleBaseDir = basedir; - controlDir = new File(moduleBaseDir, "src/test/resources/openwire-control"); - classFileDir = new File(moduleBaseDir, "src/test/java/org/activemq/openwire"); + MODULE_BASE_DIR = basedir; + CONTROL_DIR = new File(MODULE_BASE_DIR, "src/test/resources/openwire-control"); + CLASS_FILE_DIR = new File(MODULE_BASE_DIR, "src/test/java/org/activemq/openwire"); } private int counter; private OpenWireFormat openWireformat; - public void XXXX_testControlFileIsValid() throws Exception { + public void xtestControlFileIsValid() throws Exception { generateControlFile(); assertControlFileIsEqual(); } @@ -96,7 +96,7 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); DataOutputStream ds = new DataOutputStream(buffer); Object expected = createObject(); - log.info("Created: " + expected); + LOG.info("Created: " + expected); openWireformat.marshal(expected, ds); ds.close(); @@ -105,7 +105,7 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { DataInputStream dis = new DataInputStream(in); Object actual = openWireformat.unmarshal(dis); - log.info("Parsed: " + actual); + LOG.info("Parsed: " + actual); assertBeansEqual("", new HashSet(), expected, actual); } @@ -131,7 +131,7 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { expectedValue = method.invoke(expected, EMPTY_ARGUMENTS); actualValue = method.invoke(actual, EMPTY_ARGUMENTS); } catch (Exception e) { - log.info("Failed to access property: " + name); + LOG.info("Failed to access property: " + name); } assertPropertyValuesEqual(message + name, comparedObjects, expectedValue, actualValue); } @@ -202,8 +202,8 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { } public void generateControlFile() throws Exception { - controlDir.mkdirs(); - File dataFile = new File(controlDir, getClass().getName() + ".bin"); + CONTROL_DIR.mkdirs(); + File dataFile = new File(CONTROL_DIR, getClass().getName() + ".bin"); FileOutputStream os = new FileOutputStream(dataFile); DataOutputStream ds = new DataOutputStream(os); @@ -222,7 +222,7 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { } public void assertControlFileIsEqual() throws Exception { - File dataFile = new File(controlDir, getClass().getName() + ".bin"); + File dataFile = new File(CONTROL_DIR, getClass().getName() + ".bin"); FileInputStream is1 = new FileInputStream(dataFile); int pos = 0; try { @@ -311,7 +311,7 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { protected Throwable createThrowable(String string) { // we have issues with stack frames not being equal so share the same // exception each time - return singletonException; + return SINGLETON_EXCEPTION; } protected BooleanExpression createBooleanExpression(String string) { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/NumberRangesWhileMarshallingTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/NumberRangesWhileMarshallingTest.java index f3421db6f8..bd1e771fd7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/NumberRangesWhileMarshallingTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/NumberRangesWhileMarshallingTest.java @@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory; */ public class NumberRangesWhileMarshallingTest extends TestCase { - private static final Log log = LogFactory.getLog(NumberRangesWhileMarshallingTest.class); + private static final Log LOG = LogFactory.getLog(NumberRangesWhileMarshallingTest.class); protected String connectionId = "Cheese"; protected ByteArrayOutputStream buffer = new ByteArrayOutputStream(); @@ -74,7 +74,7 @@ public class NumberRangesWhileMarshallingTest extends TestCase { for (int i = 0; i < numberValues.length; i++) { long value = numberValues[i]; String expected = Long.toHexString(value); - log.info("Unmarshaling value: " + i + " = " + expected); + LOG.info("Unmarshaling value: " + i + " = " + expected); SessionId command = (SessionId)openWireformat.unmarshal(dis); assertEquals("connection ID in object: " + i, connectionId, command.getConnectionId()); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java index f4465ca9ae..4dbae6a625 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQBytesMessage; */ public class ActiveMQBytesMessageTest extends ActiveMQMessageTest { - public static ActiveMQBytesMessageTest SINGLETON = new ActiveMQBytesMessageTest(); + public static final ActiveMQBytesMessageTest SINGLETON = new ActiveMQBytesMessageTest(); public Object createObject() throws Exception { ActiveMQBytesMessage info = new ActiveMQBytesMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java index ee5ca2b2ea..2c92954b4f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQMapMessage; */ public class ActiveMQMapMessageTest extends ActiveMQMessageTest { - public static ActiveMQMapMessageTest SINGLETON = new ActiveMQMapMessageTest(); + public static final ActiveMQMapMessageTest SINGLETON = new ActiveMQMapMessageTest(); public Object createObject() throws Exception { ActiveMQMapMessage info = new ActiveMQMapMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java index 52fcfd3781..d2b20e8b03 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQMessage; */ public class ActiveMQMessageTest extends MessageTestSupport { - public static ActiveMQMessageTest SINGLETON = new ActiveMQMessageTest(); + public static final ActiveMQMessageTest SINGLETON = new ActiveMQMessageTest(); public Object createObject() throws Exception { ActiveMQMessage info = new ActiveMQMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageTest.java index aa6905f81a..cf06976cac 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQObjectMessage; */ public class ActiveMQObjectMessageTest extends ActiveMQMessageTest { - public static ActiveMQObjectMessageTest SINGLETON = new ActiveMQObjectMessageTest(); + public static final ActiveMQObjectMessageTest SINGLETON = new ActiveMQObjectMessageTest(); public Object createObject() throws Exception { ActiveMQObjectMessage info = new ActiveMQObjectMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQQueueTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQQueueTest.java index 47a8f220d6..44a509b626 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQQueueTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQQueueTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.command.ActiveMQQueue; */ public class ActiveMQQueueTest extends ActiveMQDestinationTestSupport { - public static ActiveMQQueueTest SINGLETON = new ActiveMQQueueTest(); + public static final ActiveMQQueueTest SINGLETON = new ActiveMQQueueTest(); public Object createObject() throws Exception { ActiveMQQueue info = new ActiveMQQueue(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageTest.java index 7dcbdbff62..114ee360e1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.command.ActiveMQStreamMessage; */ public class ActiveMQStreamMessageTest extends ActiveMQMessageTest { - public static ActiveMQStreamMessageTest SINGLETON = new ActiveMQStreamMessageTest(); + public static final ActiveMQStreamMessageTest SINGLETON = new ActiveMQStreamMessageTest(); public Object createObject() throws Exception { ActiveMQStreamMessage info = new ActiveMQStreamMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueTest.java index 0e1d885f4c..b89981fd8c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.command.ActiveMQTempQueue; */ public class ActiveMQTempQueueTest extends ActiveMQTempDestinationTestSupport { - public static ActiveMQTempQueueTest SINGLETON = new ActiveMQTempQueueTest(); + public static final ActiveMQTempQueueTest SINGLETON = new ActiveMQTempQueueTest(); public Object createObject() throws Exception { ActiveMQTempQueue info = new ActiveMQTempQueue(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicTest.java index 8b3a43f542..f0738383f1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.command.ActiveMQTempTopic; */ public class ActiveMQTempTopicTest extends ActiveMQTempDestinationTestSupport { - public static ActiveMQTempTopicTest SINGLETON = new ActiveMQTempTopicTest(); + public static final ActiveMQTempTopicTest SINGLETON = new ActiveMQTempTopicTest(); public Object createObject() throws Exception { ActiveMQTempTopic info = new ActiveMQTempTopic(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTopicTest.java index d924ef07ce..81deb91cca 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTopicTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.command.ActiveMQTopic; */ public class ActiveMQTopicTest extends ActiveMQDestinationTestSupport { - public static ActiveMQTopicTest SINGLETON = new ActiveMQTopicTest(); + public static final ActiveMQTopicTest SINGLETON = new ActiveMQTopicTest(); public Object createObject() throws Exception { ActiveMQTopic info = new ActiveMQTopic(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerIdTest.java index 27ae573b99..59d4574a30 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerIdTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class BrokerIdTest extends DataFileGeneratorTestSupport { - public static BrokerIdTest SINGLETON = new BrokerIdTest(); + public static final BrokerIdTest SINGLETON = new BrokerIdTest(); public Object createObject() throws Exception { BrokerId info = new BrokerId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionControlTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionControlTest.java index 018dfda531..5cc036d2f2 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionControlTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionControlTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ConnectionControl; */ public class ConnectionControlTest extends BaseCommandTestSupport { - public static ConnectionControlTest SINGLETON = new ConnectionControlTest(); + public static final ConnectionControlTest SINGLETON = new ConnectionControlTest(); public Object createObject() throws Exception { ConnectionControl info = new ConnectionControl(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionErrorTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionErrorTest.java index 405f93297d..44d18cb768 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionErrorTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionErrorTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ConnectionError; */ public class ConnectionErrorTest extends BaseCommandTestSupport { - public static ConnectionErrorTest SINGLETON = new ConnectionErrorTest(); + public static final ConnectionErrorTest SINGLETON = new ConnectionErrorTest(); public Object createObject() throws Exception { ConnectionError info = new ConnectionError(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionIdTest.java index c72bcd9a17..304067dc00 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionIdTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class ConnectionIdTest extends DataFileGeneratorTestSupport { - public static ConnectionIdTest SINGLETON = new ConnectionIdTest(); + public static final ConnectionIdTest SINGLETON = new ConnectionIdTest(); public Object createObject() throws Exception { ConnectionId info = new ConnectionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionInfoTest.java index 35b35243e2..eb6732a2d7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.ConnectionInfo; */ public class ConnectionInfoTest extends BaseCommandTestSupport { - public static ConnectionInfoTest SINGLETON = new ConnectionInfoTest(); + public static final ConnectionInfoTest SINGLETON = new ConnectionInfoTest(); public Object createObject() throws Exception { ConnectionInfo info = new ConnectionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerControlTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerControlTest.java index 6f488b0c1c..8252672cd4 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerControlTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerControlTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ConsumerControl; */ public class ConsumerControlTest extends BaseCommandTestSupport { - public static ConsumerControlTest SINGLETON = new ConsumerControlTest(); + public static final ConsumerControlTest SINGLETON = new ConsumerControlTest(); public Object createObject() throws Exception { ConsumerControl info = new ConsumerControl(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerIdTest.java index d4fa2965e4..3597127c9d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerIdTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class ConsumerIdTest extends DataFileGeneratorTestSupport { - public static ConsumerIdTest SINGLETON = new ConsumerIdTest(); + public static final ConsumerIdTest SINGLETON = new ConsumerIdTest(); public Object createObject() throws Exception { ConsumerId info = new ConsumerId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerInfoTest.java index 4621e40581..4ad14f9d8b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.ConsumerInfo; */ public class ConsumerInfoTest extends BaseCommandTestSupport { - public static ConsumerInfoTest SINGLETON = new ConsumerInfoTest(); + public static final ConsumerInfoTest SINGLETON = new ConsumerInfoTest(); public Object createObject() throws Exception { ConsumerInfo info = new ConsumerInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ControlCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ControlCommandTest.java index 841549b896..6d3b3c85eb 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ControlCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ControlCommandTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ControlCommand; */ public class ControlCommandTest extends BaseCommandTestSupport { - public static ControlCommandTest SINGLETON = new ControlCommandTest(); + public static final ControlCommandTest SINGLETON = new ControlCommandTest(); public Object createObject() throws Exception { ControlCommand info = new ControlCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataArrayResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataArrayResponseTest.java index 3515f67377..f112ca08f2 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataArrayResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataArrayResponseTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.DataStructure; */ public class DataArrayResponseTest extends ResponseTest { - public static DataArrayResponseTest SINGLETON = new DataArrayResponseTest(); + public static final DataArrayResponseTest SINGLETON = new DataArrayResponseTest(); public Object createObject() throws Exception { DataArrayResponse info = new DataArrayResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataResponseTest.java index 19bc096c1d..466e2f88ee 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataResponseTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.DataResponse; */ public class DataResponseTest extends ResponseTest { - public static DataResponseTest SINGLETON = new DataResponseTest(); + public static final DataResponseTest SINGLETON = new DataResponseTest(); public Object createObject() throws Exception { DataResponse info = new DataResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DestinationInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DestinationInfoTest.java index 6d8e19e794..2c4637ea2f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DestinationInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DestinationInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.DestinationInfo; */ public class DestinationInfoTest extends BaseCommandTestSupport { - public static DestinationInfoTest SINGLETON = new DestinationInfoTest(); + public static final DestinationInfoTest SINGLETON = new DestinationInfoTest(); public Object createObject() throws Exception { DestinationInfo info = new DestinationInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DiscoveryEventTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DiscoveryEventTest.java index 82925f1188..907853b5a3 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DiscoveryEventTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DiscoveryEventTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class DiscoveryEventTest extends DataFileGeneratorTestSupport { - public static DiscoveryEventTest SINGLETON = new DiscoveryEventTest(); + public static final DiscoveryEventTest SINGLETON = new DiscoveryEventTest(); public Object createObject() throws Exception { DiscoveryEvent info = new DiscoveryEvent(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ExceptionResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ExceptionResponseTest.java index c2ad8f1b70..9b48c92948 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ExceptionResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ExceptionResponseTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ExceptionResponse; */ public class ExceptionResponseTest extends ResponseTest { - public static ExceptionResponseTest SINGLETON = new ExceptionResponseTest(); + public static final ExceptionResponseTest SINGLETON = new ExceptionResponseTest(); public Object createObject() throws Exception { ExceptionResponse info = new ExceptionResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/FlushCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/FlushCommandTest.java index 170a8fb61b..badfc9a16a 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/FlushCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/FlushCommandTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.FlushCommand; */ public class FlushCommandTest extends BaseCommandTestSupport { - public static FlushCommandTest SINGLETON = new FlushCommandTest(); + public static final FlushCommandTest SINGLETON = new FlushCommandTest(); public Object createObject() throws Exception { FlushCommand info = new FlushCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/IntegerResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/IntegerResponseTest.java index 5cbb40f1d9..50bbc1aafe 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/IntegerResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/IntegerResponseTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.IntegerResponse; */ public class IntegerResponseTest extends ResponseTest { - public static IntegerResponseTest SINGLETON = new IntegerResponseTest(); + public static final IntegerResponseTest SINGLETON = new IntegerResponseTest(); public Object createObject() throws Exception { IntegerResponse info = new IntegerResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalQueueAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalQueueAckTest.java index 6a00edfadd..d6fd10804f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalQueueAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalQueueAckTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class JournalQueueAckTest extends DataFileGeneratorTestSupport { - public static JournalQueueAckTest SINGLETON = new JournalQueueAckTest(); + public static final JournalQueueAckTest SINGLETON = new JournalQueueAckTest(); public Object createObject() throws Exception { JournalQueueAck info = new JournalQueueAck(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTopicAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTopicAckTest.java index 3b025dd207..e4fca16470 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTopicAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTopicAckTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class JournalTopicAckTest extends DataFileGeneratorTestSupport { - public static JournalTopicAckTest SINGLETON = new JournalTopicAckTest(); + public static final JournalTopicAckTest SINGLETON = new JournalTopicAckTest(); public Object createObject() throws Exception { JournalTopicAck info = new JournalTopicAck(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTraceTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTraceTest.java index b849970752..faebea246b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTraceTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTraceTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class JournalTraceTest extends DataFileGeneratorTestSupport { - public static JournalTraceTest SINGLETON = new JournalTraceTest(); + public static final JournalTraceTest SINGLETON = new JournalTraceTest(); public Object createObject() throws Exception { JournalTrace info = new JournalTrace(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTransactionTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTransactionTest.java index 7de2e39e69..4a6564a470 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTransactionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTransactionTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class JournalTransactionTest extends DataFileGeneratorTestSupport { - public static JournalTransactionTest SINGLETON = new JournalTransactionTest(); + public static final JournalTransactionTest SINGLETON = new JournalTransactionTest(); public Object createObject() throws Exception { JournalTransaction info = new JournalTransaction(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java index 2763628bb9..55c07b5aed 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.KeepAliveInfo; */ public class KeepAliveInfoTest extends BaseCommandTestSupport { - public static KeepAliveInfoTest SINGLETON = new KeepAliveInfoTest(); + public static final KeepAliveInfoTest SINGLETON = new KeepAliveInfoTest(); public Object createObject() throws Exception { KeepAliveInfo info = new KeepAliveInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LastPartialCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LastPartialCommandTest.java index 8c466104e1..1645f26d2d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LastPartialCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LastPartialCommandTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.LastPartialCommand; */ public class LastPartialCommandTest extends PartialCommandTest { - public static LastPartialCommandTest SINGLETON = new LastPartialCommandTest(); + public static final LastPartialCommandTest SINGLETON = new LastPartialCommandTest(); public Object createObject() throws Exception { LastPartialCommand info = new LastPartialCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LocalTransactionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LocalTransactionIdTest.java index 4610de785c..933fb28af1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LocalTransactionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LocalTransactionIdTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.LocalTransactionId; */ public class LocalTransactionIdTest extends TransactionIdTestSupport { - public static LocalTransactionIdTest SINGLETON = new LocalTransactionIdTest(); + public static final LocalTransactionIdTest SINGLETON = new LocalTransactionIdTest(); public Object createObject() throws Exception { LocalTransactionId info = new LocalTransactionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationTest.java index a3d27712e5..3fad732ccf 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.MessageDispatchNotification; */ public class MessageDispatchNotificationTest extends BaseCommandTestSupport { - public static MessageDispatchNotificationTest SINGLETON = new MessageDispatchNotificationTest(); + public static final MessageDispatchNotificationTest SINGLETON = new MessageDispatchNotificationTest(); public Object createObject() throws Exception { MessageDispatchNotification info = new MessageDispatchNotification(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchTest.java index ea6cb38d37..0b178dc46b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.MessageDispatch; */ public class MessageDispatchTest extends BaseCommandTestSupport { - public static MessageDispatchTest SINGLETON = new MessageDispatchTest(); + public static final MessageDispatchTest SINGLETON = new MessageDispatchTest(); public Object createObject() throws Exception { MessageDispatch info = new MessageDispatch(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageIdTest.java index 6102316ec2..c5cad88a03 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageIdTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class MessageIdTest extends DataFileGeneratorTestSupport { - public static MessageIdTest SINGLETON = new MessageIdTest(); + public static final MessageIdTest SINGLETON = new MessageIdTest(); public Object createObject() throws Exception { MessageId info = new MessageId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterTest.java index 22d6bcb820..fded457375 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class NetworkBridgeFilterTest extends DataFileGeneratorTestSupport { - public static NetworkBridgeFilterTest SINGLETON = new NetworkBridgeFilterTest(); + public static final NetworkBridgeFilterTest SINGLETON = new NetworkBridgeFilterTest(); public Object createObject() throws Exception { NetworkBridgeFilter info = new NetworkBridgeFilter(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/PartialCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/PartialCommandTest.java index af6d114228..c086e147a3 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/PartialCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/PartialCommandTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class PartialCommandTest extends DataFileGeneratorTestSupport { - public static PartialCommandTest SINGLETON = new PartialCommandTest(); + public static final PartialCommandTest SINGLETON = new PartialCommandTest(); public Object createObject() throws Exception { PartialCommand info = new PartialCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerIdTest.java index 4659a9be92..023cece015 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerIdTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class ProducerIdTest extends DataFileGeneratorTestSupport { - public static ProducerIdTest SINGLETON = new ProducerIdTest(); + public static final ProducerIdTest SINGLETON = new ProducerIdTest(); public Object createObject() throws Exception { ProducerId info = new ProducerId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerInfoTest.java index 164b3eed9a..c3ecd6a94e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.ProducerInfo; */ public class ProducerInfoTest extends BaseCommandTestSupport { - public static ProducerInfoTest SINGLETON = new ProducerInfoTest(); + public static final ProducerInfoTest SINGLETON = new ProducerInfoTest(); public Object createObject() throws Exception { ProducerInfo info = new ProducerInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveInfoTest.java index 1333bbe271..874579bf09 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveInfoTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.RemoveInfo; */ public class RemoveInfoTest extends BaseCommandTestSupport { - public static RemoveInfoTest SINGLETON = new RemoveInfoTest(); + public static final RemoveInfoTest SINGLETON = new RemoveInfoTest(); public Object createObject() throws Exception { RemoveInfo info = new RemoveInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoTest.java index 8508c3594d..f8ab22c42c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.RemoveSubscriptionInfo; */ public class RemoveSubscriptionInfoTest extends BaseCommandTestSupport { - public static RemoveSubscriptionInfoTest SINGLETON = new RemoveSubscriptionInfoTest(); + public static final RemoveSubscriptionInfoTest SINGLETON = new RemoveSubscriptionInfoTest(); public Object createObject() throws Exception { RemoveSubscriptionInfo info = new RemoveSubscriptionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ReplayCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ReplayCommandTest.java index 1b18738a9a..40fd50aede 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ReplayCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ReplayCommandTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ReplayCommand; */ public class ReplayCommandTest extends BaseCommandTestSupport { - public static ReplayCommandTest SINGLETON = new ReplayCommandTest(); + public static final ReplayCommandTest SINGLETON = new ReplayCommandTest(); public Object createObject() throws Exception { ReplayCommand info = new ReplayCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ResponseTest.java index f165f07379..f4c4f70a8b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ResponseTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.Response; */ public class ResponseTest extends BaseCommandTestSupport { - public static ResponseTest SINGLETON = new ResponseTest(); + public static final ResponseTest SINGLETON = new ResponseTest(); public Object createObject() throws Exception { Response info = new Response(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionIdTest.java index 813079f856..77e2a6b978 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionIdTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class SessionIdTest extends DataFileGeneratorTestSupport { - public static SessionIdTest SINGLETON = new SessionIdTest(); + public static final SessionIdTest SINGLETON = new SessionIdTest(); public Object createObject() throws Exception { SessionId info = new SessionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionInfoTest.java index 33c6add7bf..e107ae638c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionInfoTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.SessionInfo; */ public class SessionInfoTest extends BaseCommandTestSupport { - public static SessionInfoTest SINGLETON = new SessionInfoTest(); + public static final SessionInfoTest SINGLETON = new SessionInfoTest(); public Object createObject() throws Exception { SessionInfo info = new SessionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ShutdownInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ShutdownInfoTest.java index 8c4fc30750..7f1d8b6c17 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ShutdownInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ShutdownInfoTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ShutdownInfo; */ public class ShutdownInfoTest extends BaseCommandTestSupport { - public static ShutdownInfoTest SINGLETON = new ShutdownInfoTest(); + public static final ShutdownInfoTest SINGLETON = new ShutdownInfoTest(); public Object createObject() throws Exception { ShutdownInfo info = new ShutdownInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SubscriptionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SubscriptionInfoTest.java index 42af8ef225..a5771fb59c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SubscriptionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SubscriptionInfoTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class SubscriptionInfoTest extends DataFileGeneratorTestSupport { - public static SubscriptionInfoTest SINGLETON = new SubscriptionInfoTest(); + public static final SubscriptionInfoTest SINGLETON = new SubscriptionInfoTest(); public Object createObject() throws Exception { SubscriptionInfo info = new SubscriptionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionInfoTest.java index f12ea889d6..73bb486a06 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionInfoTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.TransactionInfo; */ public class TransactionInfoTest extends BaseCommandTestSupport { - public static TransactionInfoTest SINGLETON = new TransactionInfoTest(); + public static final TransactionInfoTest SINGLETON = new TransactionInfoTest(); public Object createObject() throws Exception { TransactionInfo info = new TransactionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java index f0fc809636..f2b8a4fa74 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class WireFormatInfoTest extends DataFileGeneratorTestSupport { - public static WireFormatInfoTest SINGLETON = new WireFormatInfoTest(); + public static final WireFormatInfoTest SINGLETON = new WireFormatInfoTest(); public Object createObject() throws Exception { WireFormatInfo info = new WireFormatInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/XATransactionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/XATransactionIdTest.java index c00c8125c9..ddef988096 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/XATransactionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/XATransactionIdTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.XATransactionId; */ public class XATransactionIdTest extends TransactionIdTestSupport { - public static XATransactionIdTest SINGLETON = new XATransactionIdTest(); + public static final XATransactionIdTest SINGLETON = new XATransactionIdTest(); public Object createObject() throws Exception { XATransactionId info = new XATransactionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQBytesMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQBytesMessageTest.java index ddef6205aa..82db208d1e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQBytesMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQBytesMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQBytesMessage; */ public class ActiveMQBytesMessageTest extends ActiveMQMessageTest { - public static ActiveMQBytesMessageTest SINGLETON = new ActiveMQBytesMessageTest(); + public static final ActiveMQBytesMessageTest SINGLETON = new ActiveMQBytesMessageTest(); public Object createObject() throws Exception { ActiveMQBytesMessage info = new ActiveMQBytesMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQMapMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQMapMessageTest.java index c7d8005f91..0d25ecd41d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQMapMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQMapMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQMapMessage; */ public class ActiveMQMapMessageTest extends ActiveMQMessageTest { - public static ActiveMQMapMessageTest SINGLETON = new ActiveMQMapMessageTest(); + public static final ActiveMQMapMessageTest SINGLETON = new ActiveMQMapMessageTest(); public Object createObject() throws Exception { ActiveMQMapMessage info = new ActiveMQMapMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQMessageTest.java index 193a42ae43..8dced58d78 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQMessage; */ public class ActiveMQMessageTest extends MessageTestSupport { - public static ActiveMQMessageTest SINGLETON = new ActiveMQMessageTest(); + public static final ActiveMQMessageTest SINGLETON = new ActiveMQMessageTest(); public Object createObject() throws Exception { ActiveMQMessage info = new ActiveMQMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQObjectMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQObjectMessageTest.java index f5dd0c7fca..c5470e6cfa 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQObjectMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQObjectMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQObjectMessage; */ public class ActiveMQObjectMessageTest extends ActiveMQMessageTest { - public static ActiveMQObjectMessageTest SINGLETON = new ActiveMQObjectMessageTest(); + public static final ActiveMQObjectMessageTest SINGLETON = new ActiveMQObjectMessageTest(); public Object createObject() throws Exception { ActiveMQObjectMessage info = new ActiveMQObjectMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQQueueTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQQueueTest.java index d5c9bf7d88..8469945d30 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQQueueTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQQueueTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQQueue; */ public class ActiveMQQueueTest extends ActiveMQDestinationTestSupport { - public static ActiveMQQueueTest SINGLETON = new ActiveMQQueueTest(); + public static final ActiveMQQueueTest SINGLETON = new ActiveMQQueueTest(); public Object createObject() throws Exception { ActiveMQQueue info = new ActiveMQQueue(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQStreamMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQStreamMessageTest.java index fce7bbfa2f..7e7096c8ab 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQStreamMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQStreamMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQStreamMessage; */ public class ActiveMQStreamMessageTest extends ActiveMQMessageTest { - public static ActiveMQStreamMessageTest SINGLETON = new ActiveMQStreamMessageTest(); + public static final ActiveMQStreamMessageTest SINGLETON = new ActiveMQStreamMessageTest(); public Object createObject() throws Exception { ActiveMQStreamMessage info = new ActiveMQStreamMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTempQueueTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTempQueueTest.java index 09b16a757f..99338f6e65 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTempQueueTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTempQueueTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQTempQueue; */ public class ActiveMQTempQueueTest extends ActiveMQTempDestinationTestSupport { - public static ActiveMQTempQueueTest SINGLETON = new ActiveMQTempQueueTest(); + public static final ActiveMQTempQueueTest SINGLETON = new ActiveMQTempQueueTest(); public Object createObject() throws Exception { ActiveMQTempQueue info = new ActiveMQTempQueue(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTempTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTempTopicTest.java index 0eee193365..51cca828e4 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTempTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTempTopicTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQTempTopic; */ public class ActiveMQTempTopicTest extends ActiveMQTempDestinationTestSupport { - public static ActiveMQTempTopicTest SINGLETON = new ActiveMQTempTopicTest(); + public static final ActiveMQTempTopicTest SINGLETON = new ActiveMQTempTopicTest(); public Object createObject() throws Exception { ActiveMQTempTopic info = new ActiveMQTempTopic(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTextMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTextMessageTest.java index 40df54186c..2b8d803b2b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTextMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTextMessageTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQTextMessage; */ public class ActiveMQTextMessageTest extends ActiveMQMessageTest { - public static ActiveMQTextMessageTest SINGLETON = new ActiveMQTextMessageTest(); + public static final ActiveMQTextMessageTest SINGLETON = new ActiveMQTextMessageTest(); public Object createObject() throws Exception { ActiveMQTextMessage info = new ActiveMQTextMessage(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTopicTest.java index eb42adf9ab..7ce89abbe3 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ActiveMQTopicTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.command.ActiveMQTopic; */ public class ActiveMQTopicTest extends ActiveMQDestinationTestSupport { - public static ActiveMQTopicTest SINGLETON = new ActiveMQTopicTest(); + public static final ActiveMQTopicTest SINGLETON = new ActiveMQTopicTest(); public Object createObject() throws Exception { ActiveMQTopic info = new ActiveMQTopic(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerIdTest.java index a307e9c1f5..341b9ddd32 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class BrokerIdTest extends DataFileGeneratorTestSupport { - public static BrokerIdTest SINGLETON = new BrokerIdTest(); + public static final BrokerIdTest SINGLETON = new BrokerIdTest(); public Object createObject() throws Exception { BrokerId info = new BrokerId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerInfoTest.java index 4c611235a5..c63034988d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerInfoTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.command.BrokerInfo; */ public class BrokerInfoTest extends BaseCommandTestSupport { - public static BrokerInfoTest SINGLETON = new BrokerInfoTest(); + public static final BrokerInfoTest SINGLETON = new BrokerInfoTest(); public Object createObject() throws Exception { BrokerInfo info = new BrokerInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionControlTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionControlTest.java index c54bfc2546..4f24a19b26 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionControlTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionControlTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ConnectionControl; public class ConnectionControlTest extends BaseCommandTestSupport { - public static ConnectionControlTest SINGLETON = new ConnectionControlTest(); + public static final ConnectionControlTest SINGLETON = new ConnectionControlTest(); public Object createObject() throws Exception { ConnectionControl info = new ConnectionControl(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionErrorTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionErrorTest.java index 9f84447a39..c26d1b873c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionErrorTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionErrorTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ConnectionError; public class ConnectionErrorTest extends BaseCommandTestSupport { - public static ConnectionErrorTest SINGLETON = new ConnectionErrorTest(); + public static final ConnectionErrorTest SINGLETON = new ConnectionErrorTest(); public Object createObject() throws Exception { ConnectionError info = new ConnectionError(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionIdTest.java index 54470c7f87..5914ef8900 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class ConnectionIdTest extends DataFileGeneratorTestSupport { - public static ConnectionIdTest SINGLETON = new ConnectionIdTest(); + public static final ConnectionIdTest SINGLETON = new ConnectionIdTest(); public Object createObject() throws Exception { ConnectionId info = new ConnectionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionInfoTest.java index 3bafbdb99f..2ae32ec072 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConnectionInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.ConnectionInfo; */ public class ConnectionInfoTest extends BaseCommandTestSupport { - public static ConnectionInfoTest SINGLETON = new ConnectionInfoTest(); + public static final ConnectionInfoTest SINGLETON = new ConnectionInfoTest(); public Object createObject() throws Exception { ConnectionInfo info = new ConnectionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerControlTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerControlTest.java index c2b009bc06..2939500915 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerControlTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerControlTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ConsumerControl; public class ConsumerControlTest extends BaseCommandTestSupport { - public static ConsumerControlTest SINGLETON = new ConsumerControlTest(); + public static final ConsumerControlTest SINGLETON = new ConsumerControlTest(); public Object createObject() throws Exception { ConsumerControl info = new ConsumerControl(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerIdTest.java index 00d9da7f75..d2ce61f4ed 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class ConsumerIdTest extends DataFileGeneratorTestSupport { - public static ConsumerIdTest SINGLETON = new ConsumerIdTest(); + public static final ConsumerIdTest SINGLETON = new ConsumerIdTest(); public Object createObject() throws Exception { ConsumerId info = new ConsumerId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerInfoTest.java index 05fe1ace2f..77daaf602c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ConsumerInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.ConsumerInfo; */ public class ConsumerInfoTest extends BaseCommandTestSupport { - public static ConsumerInfoTest SINGLETON = new ConsumerInfoTest(); + public static final ConsumerInfoTest SINGLETON = new ConsumerInfoTest(); public Object createObject() throws Exception { ConsumerInfo info = new ConsumerInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ControlCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ControlCommandTest.java index ca51023881..8c95279aae 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ControlCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ControlCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ControlCommand; public class ControlCommandTest extends BaseCommandTestSupport { - public static ControlCommandTest SINGLETON = new ControlCommandTest(); + public static final ControlCommandTest SINGLETON = new ControlCommandTest(); public Object createObject() throws Exception { ControlCommand info = new ControlCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DataArrayResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DataArrayResponseTest.java index 4835e45543..d57fa4a20f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DataArrayResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DataArrayResponseTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.DataStructure; */ public class DataArrayResponseTest extends ResponseTest { - public static DataArrayResponseTest SINGLETON = new DataArrayResponseTest(); + public static final DataArrayResponseTest SINGLETON = new DataArrayResponseTest(); public Object createObject() throws Exception { DataArrayResponse info = new DataArrayResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DataResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DataResponseTest.java index bc2f53f252..7df0628caf 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DataResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DataResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.DataResponse; public class DataResponseTest extends ResponseTest { - public static DataResponseTest SINGLETON = new DataResponseTest(); + public static final DataResponseTest SINGLETON = new DataResponseTest(); public Object createObject() throws Exception { DataResponse info = new DataResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DestinationInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DestinationInfoTest.java index d2a186aff2..54af2c1656 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DestinationInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DestinationInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.DestinationInfo; */ public class DestinationInfoTest extends BaseCommandTestSupport { - public static DestinationInfoTest SINGLETON = new DestinationInfoTest(); + public static final DestinationInfoTest SINGLETON = new DestinationInfoTest(); public Object createObject() throws Exception { DestinationInfo info = new DestinationInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DiscoveryEventTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DiscoveryEventTest.java index e9938357a1..353c296c90 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DiscoveryEventTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/DiscoveryEventTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class DiscoveryEventTest extends DataFileGeneratorTestSupport { - public static DiscoveryEventTest SINGLETON = new DiscoveryEventTest(); + public static final DiscoveryEventTest SINGLETON = new DiscoveryEventTest(); public Object createObject() throws Exception { DiscoveryEvent info = new DiscoveryEvent(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ExceptionResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ExceptionResponseTest.java index 1f1cdc62f4..5a3fac16e9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ExceptionResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ExceptionResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ExceptionResponse; public class ExceptionResponseTest extends ResponseTest { - public static ExceptionResponseTest SINGLETON = new ExceptionResponseTest(); + public static final ExceptionResponseTest SINGLETON = new ExceptionResponseTest(); public Object createObject() throws Exception { ExceptionResponse info = new ExceptionResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/FlushCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/FlushCommandTest.java index 05d5bf09e9..02ebfd8090 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/FlushCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/FlushCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.FlushCommand; public class FlushCommandTest extends BaseCommandTestSupport { - public static FlushCommandTest SINGLETON = new FlushCommandTest(); + public static final FlushCommandTest SINGLETON = new FlushCommandTest(); public Object createObject() throws Exception { FlushCommand info = new FlushCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/IntegerResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/IntegerResponseTest.java index 3af7f64c69..b5e607d54c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/IntegerResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/IntegerResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.IntegerResponse; public class IntegerResponseTest extends ResponseTest { - public static IntegerResponseTest SINGLETON = new IntegerResponseTest(); + public static final IntegerResponseTest SINGLETON = new IntegerResponseTest(); public Object createObject() throws Exception { IntegerResponse info = new IntegerResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalQueueAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalQueueAckTest.java index aae0a941f2..0d21be0de9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalQueueAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalQueueAckTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class JournalQueueAckTest extends DataFileGeneratorTestSupport { - public static JournalQueueAckTest SINGLETON = new JournalQueueAckTest(); + public static final JournalQueueAckTest SINGLETON = new JournalQueueAckTest(); public Object createObject() throws Exception { JournalQueueAck info = new JournalQueueAck(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTopicAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTopicAckTest.java index 4ae7fbb0b8..f98d267c2e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTopicAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTopicAckTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class JournalTopicAckTest extends DataFileGeneratorTestSupport { - public static JournalTopicAckTest SINGLETON = new JournalTopicAckTest(); + public static final JournalTopicAckTest SINGLETON = new JournalTopicAckTest(); public Object createObject() throws Exception { JournalTopicAck info = new JournalTopicAck(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTraceTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTraceTest.java index 042a2e64bf..8071e9ec14 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTraceTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTraceTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class JournalTraceTest extends DataFileGeneratorTestSupport { - public static JournalTraceTest SINGLETON = new JournalTraceTest(); + public static final JournalTraceTest SINGLETON = new JournalTraceTest(); public Object createObject() throws Exception { JournalTrace info = new JournalTrace(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTransactionTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTransactionTest.java index b1fa4aa7a1..105dcc6f02 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTransactionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/JournalTransactionTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class JournalTransactionTest extends DataFileGeneratorTestSupport { - public static JournalTransactionTest SINGLETON = new JournalTransactionTest(); + public static final JournalTransactionTest SINGLETON = new JournalTransactionTest(); public Object createObject() throws Exception { JournalTransaction info = new JournalTransaction(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/KeepAliveInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/KeepAliveInfoTest.java index fd5f6d275b..c677658108 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/KeepAliveInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/KeepAliveInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.KeepAliveInfo; public class KeepAliveInfoTest extends BaseCommandTestSupport { - public static KeepAliveInfoTest SINGLETON = new KeepAliveInfoTest(); + public static final KeepAliveInfoTest SINGLETON = new KeepAliveInfoTest(); public Object createObject() throws Exception { KeepAliveInfo info = new KeepAliveInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/LastPartialCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/LastPartialCommandTest.java index d9e6d8d60d..22c89788c8 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/LastPartialCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/LastPartialCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.LastPartialCommand; public class LastPartialCommandTest extends PartialCommandTest { - public static LastPartialCommandTest SINGLETON = new LastPartialCommandTest(); + public static final LastPartialCommandTest SINGLETON = new LastPartialCommandTest(); public Object createObject() throws Exception { LastPartialCommand info = new LastPartialCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/LocalTransactionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/LocalTransactionIdTest.java index fa3d10e6b4..6f6c3564a8 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/LocalTransactionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/LocalTransactionIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.LocalTransactionId; public class LocalTransactionIdTest extends TransactionIdTestSupport { - public static LocalTransactionIdTest SINGLETON = new LocalTransactionIdTest(); + public static final LocalTransactionIdTest SINGLETON = new LocalTransactionIdTest(); public Object createObject() throws Exception { LocalTransactionId info = new LocalTransactionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageAckTest.java index baf166f8be..70a285e75f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageAckTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.MessageAck; public class MessageAckTest extends BaseCommandTestSupport { - public static MessageAckTest SINGLETON = new MessageAckTest(); + public static final MessageAckTest SINGLETON = new MessageAckTest(); public Object createObject() throws Exception { MessageAck info = new MessageAck(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageDispatchNotificationTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageDispatchNotificationTest.java index 6709476906..a7311fbbbf 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageDispatchNotificationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageDispatchNotificationTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.MessageDispatchNotification; public class MessageDispatchNotificationTest extends BaseCommandTestSupport { - public static MessageDispatchNotificationTest SINGLETON = new MessageDispatchNotificationTest(); + public static final MessageDispatchNotificationTest SINGLETON = new MessageDispatchNotificationTest(); public Object createObject() throws Exception { MessageDispatchNotification info = new MessageDispatchNotification(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageDispatchTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageDispatchTest.java index e8a9e44795..4694cb1a23 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageDispatchTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageDispatchTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.MessageDispatch; public class MessageDispatchTest extends BaseCommandTestSupport { - public static MessageDispatchTest SINGLETON = new MessageDispatchTest(); + public static final MessageDispatchTest SINGLETON = new MessageDispatchTest(); public Object createObject() throws Exception { MessageDispatch info = new MessageDispatch(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageIdTest.java index 336d7861cc..457828250e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class MessageIdTest extends DataFileGeneratorTestSupport { - public static MessageIdTest SINGLETON = new MessageIdTest(); + public static final MessageIdTest SINGLETON = new MessageIdTest(); public Object createObject() throws Exception { MessageId info = new MessageId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessagePullTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessagePullTest.java index 1740ec42bc..f092e7828b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessagePullTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessagePullTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.MessagePull; public class MessagePullTest extends BaseCommandTestSupport { - public static MessagePullTest SINGLETON = new MessagePullTest(); + public static final MessagePullTest SINGLETON = new MessagePullTest(); public Object createObject() throws Exception { MessagePull info = new MessagePull(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/NetworkBridgeFilterTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/NetworkBridgeFilterTest.java index 8a420a9225..1ce2bed515 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/NetworkBridgeFilterTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/NetworkBridgeFilterTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class NetworkBridgeFilterTest extends DataFileGeneratorTestSupport { - public static NetworkBridgeFilterTest SINGLETON = new NetworkBridgeFilterTest(); + public static final NetworkBridgeFilterTest SINGLETON = new NetworkBridgeFilterTest(); public Object createObject() throws Exception { NetworkBridgeFilter info = new NetworkBridgeFilter(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/PartialCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/PartialCommandTest.java index 6fd158e717..7de9297478 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/PartialCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/PartialCommandTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class PartialCommandTest extends DataFileGeneratorTestSupport { - public static PartialCommandTest SINGLETON = new PartialCommandTest(); + public static final PartialCommandTest SINGLETON = new PartialCommandTest(); public Object createObject() throws Exception { PartialCommand info = new PartialCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerIdTest.java index 575759ff74..f4a66e198e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class ProducerIdTest extends DataFileGeneratorTestSupport { - public static ProducerIdTest SINGLETON = new ProducerIdTest(); + public static final ProducerIdTest SINGLETON = new ProducerIdTest(); public Object createObject() throws Exception { ProducerId info = new ProducerId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerInfoTest.java index cd7d45d746..8c8662b966 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.ProducerInfo; */ public class ProducerInfoTest extends BaseCommandTestSupport { - public static ProducerInfoTest SINGLETON = new ProducerInfoTest(); + public static final ProducerInfoTest SINGLETON = new ProducerInfoTest(); public Object createObject() throws Exception { ProducerInfo info = new ProducerInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/RemoveInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/RemoveInfoTest.java index 5f41ea2084..d3d1ae146f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/RemoveInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/RemoveInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.RemoveInfo; public class RemoveInfoTest extends BaseCommandTestSupport { - public static RemoveInfoTest SINGLETON = new RemoveInfoTest(); + public static final RemoveInfoTest SINGLETON = new RemoveInfoTest(); public Object createObject() throws Exception { RemoveInfo info = new RemoveInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/RemoveSubscriptionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/RemoveSubscriptionInfoTest.java index 01a2fa6392..7289b643de 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/RemoveSubscriptionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/RemoveSubscriptionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.RemoveSubscriptionInfo; public class RemoveSubscriptionInfoTest extends BaseCommandTestSupport { - public static RemoveSubscriptionInfoTest SINGLETON = new RemoveSubscriptionInfoTest(); + public static final RemoveSubscriptionInfoTest SINGLETON = new RemoveSubscriptionInfoTest(); public Object createObject() throws Exception { RemoveSubscriptionInfo info = new RemoveSubscriptionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ReplayCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ReplayCommandTest.java index 47d0f736f3..cf89f05ccb 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ReplayCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ReplayCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ReplayCommand; public class ReplayCommandTest extends BaseCommandTestSupport { - public static ReplayCommandTest SINGLETON = new ReplayCommandTest(); + public static final ReplayCommandTest SINGLETON = new ReplayCommandTest(); public Object createObject() throws Exception { ReplayCommand info = new ReplayCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ResponseTest.java index b63b3d9aeb..29d3f93b16 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.Response; public class ResponseTest extends BaseCommandTestSupport { - public static ResponseTest SINGLETON = new ResponseTest(); + public static final ResponseTest SINGLETON = new ResponseTest(); public Object createObject() throws Exception { Response info = new Response(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SessionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SessionIdTest.java index 420f57bb8f..60aedec51e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SessionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SessionIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class SessionIdTest extends DataFileGeneratorTestSupport { - public static SessionIdTest SINGLETON = new SessionIdTest(); + public static final SessionIdTest SINGLETON = new SessionIdTest(); public Object createObject() throws Exception { SessionId info = new SessionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SessionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SessionInfoTest.java index 7e04d22d0f..6046a96fd8 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SessionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SessionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.SessionInfo; public class SessionInfoTest extends BaseCommandTestSupport { - public static SessionInfoTest SINGLETON = new SessionInfoTest(); + public static final SessionInfoTest SINGLETON = new SessionInfoTest(); public Object createObject() throws Exception { SessionInfo info = new SessionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ShutdownInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ShutdownInfoTest.java index 03e7844694..feef110b19 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ShutdownInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ShutdownInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ShutdownInfo; public class ShutdownInfoTest extends BaseCommandTestSupport { - public static ShutdownInfoTest SINGLETON = new ShutdownInfoTest(); + public static final ShutdownInfoTest SINGLETON = new ShutdownInfoTest(); public Object createObject() throws Exception { ShutdownInfo info = new ShutdownInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SubscriptionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SubscriptionInfoTest.java index 2678c2999a..5a82e1d04d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SubscriptionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/SubscriptionInfoTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class SubscriptionInfoTest extends DataFileGeneratorTestSupport { - public static SubscriptionInfoTest SINGLETON = new SubscriptionInfoTest(); + public static final SubscriptionInfoTest SINGLETON = new SubscriptionInfoTest(); public Object createObject() throws Exception { SubscriptionInfo info = new SubscriptionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/TransactionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/TransactionInfoTest.java index c41a90ce4d..2428dbc330 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/TransactionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/TransactionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.TransactionInfo; public class TransactionInfoTest extends BaseCommandTestSupport { - public static TransactionInfoTest SINGLETON = new TransactionInfoTest(); + public static final TransactionInfoTest SINGLETON = new TransactionInfoTest(); public Object createObject() throws Exception { TransactionInfo info = new TransactionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/WireFormatInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/WireFormatInfoTest.java index 091acae3bf..e57dbec928 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/WireFormatInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/WireFormatInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; */ public class WireFormatInfoTest extends DataFileGeneratorTestSupport { - public static WireFormatInfoTest SINGLETON = new WireFormatInfoTest(); + public static final WireFormatInfoTest SINGLETON = new WireFormatInfoTest(); public Object createObject() throws Exception { WireFormatInfo info = new WireFormatInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/XATransactionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/XATransactionIdTest.java index 53c338e78b..78285c8000 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/XATransactionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/XATransactionIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.XATransactionId; public class XATransactionIdTest extends TransactionIdTestSupport { - public static XATransactionIdTest SINGLETON = new XATransactionIdTest(); + public static final XATransactionIdTest SINGLETON = new XATransactionIdTest(); public Object createObject() throws Exception { XATransactionId info = new XATransactionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BaseCommandTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BaseCommandTestSupport.java index 6b07ff87fb..4f9c7c3893 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BaseCommandTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BaseCommandTestSupport.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BrokerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BrokerIdTest.java index 8f3b90ad86..6e83010e90 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BrokerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BrokerIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class BrokerIdTest extends DataFileGeneratorTestSupport { - public static BrokerIdTest SINGLETON = new BrokerIdTest(); + public static final BrokerIdTest SINGLETON = new BrokerIdTest(); public Object createObject() throws Exception { BrokerId info = new BrokerId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BrokerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BrokerInfoTest.java index b6a6ea53e9..d787b892f7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BrokerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/BrokerInfoTest.java @@ -28,7 +28,7 @@ import org.apache.activemq.command.BrokerInfo; */ public class BrokerInfoTest extends BaseCommandTestSupport { - public static BrokerInfoTest SINGLETON = new BrokerInfoTest(); + public static final BrokerInfoTest SINGLETON = new BrokerInfoTest(); public Object createObject() throws Exception { BrokerInfo info = new BrokerInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionControlTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionControlTest.java index 069c3878b9..24156167b7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionControlTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionControlTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ConnectionControl; public class ConnectionControlTest extends BaseCommandTestSupport { - public static ConnectionControlTest SINGLETON = new ConnectionControlTest(); + public static final ConnectionControlTest SINGLETON = new ConnectionControlTest(); public Object createObject() throws Exception { ConnectionControl info = new ConnectionControl(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionErrorTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionErrorTest.java index eb4ccd5703..2c8960a804 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionErrorTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionErrorTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ConnectionError; public class ConnectionErrorTest extends BaseCommandTestSupport { - public static ConnectionErrorTest SINGLETON = new ConnectionErrorTest(); + public static final ConnectionErrorTest SINGLETON = new ConnectionErrorTest(); public Object createObject() throws Exception { ConnectionError info = new ConnectionError(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionIdTest.java index 457533adce..529d7caf26 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class ConnectionIdTest extends DataFileGeneratorTestSupport { - public static ConnectionIdTest SINGLETON = new ConnectionIdTest(); + public static final ConnectionIdTest SINGLETON = new ConnectionIdTest(); public Object createObject() throws Exception { ConnectionId info = new ConnectionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionInfoTest.java index 503c40ac57..d7ca13d088 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConnectionInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.ConnectionInfo; */ public class ConnectionInfoTest extends BaseCommandTestSupport { - public static ConnectionInfoTest SINGLETON = new ConnectionInfoTest(); + public static final ConnectionInfoTest SINGLETON = new ConnectionInfoTest(); public Object createObject() throws Exception { ConnectionInfo info = new ConnectionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerControlTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerControlTest.java index 2c0004b4df..769b69ce71 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerControlTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerControlTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ConsumerControl; public class ConsumerControlTest extends BaseCommandTestSupport { - public static ConsumerControlTest SINGLETON = new ConsumerControlTest(); + public static final ConsumerControlTest SINGLETON = new ConsumerControlTest(); public Object createObject() throws Exception { ConsumerControl info = new ConsumerControl(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerIdTest.java index 4e422da1f6..7a08212bf1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class ConsumerIdTest extends DataFileGeneratorTestSupport { - public static ConsumerIdTest SINGLETON = new ConsumerIdTest(); + public static final ConsumerIdTest SINGLETON = new ConsumerIdTest(); public Object createObject() throws Exception { ConsumerId info = new ConsumerId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerInfoTest.java index e1e27b5282..12054ab055 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ConsumerInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.ConsumerInfo; */ public class ConsumerInfoTest extends BaseCommandTestSupport { - public static ConsumerInfoTest SINGLETON = new ConsumerInfoTest(); + public static final ConsumerInfoTest SINGLETON = new ConsumerInfoTest(); public Object createObject() throws Exception { ConsumerInfo info = new ConsumerInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ControlCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ControlCommandTest.java index ac6f9b48f3..23737158dd 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ControlCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ControlCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ControlCommand; public class ControlCommandTest extends BaseCommandTestSupport { - public static ControlCommandTest SINGLETON = new ControlCommandTest(); + public static final ControlCommandTest SINGLETON = new ControlCommandTest(); public Object createObject() throws Exception { ControlCommand info = new ControlCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DataArrayResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DataArrayResponseTest.java index 80f54da9ef..f58f836e24 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DataArrayResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DataArrayResponseTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.DataStructure; */ public class DataArrayResponseTest extends ResponseTest { - public static DataArrayResponseTest SINGLETON = new DataArrayResponseTest(); + public static final DataArrayResponseTest SINGLETON = new DataArrayResponseTest(); public Object createObject() throws Exception { DataArrayResponse info = new DataArrayResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DataResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DataResponseTest.java index 686fcf3fff..d8dd7ab802 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DataResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DataResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.DataResponse; public class DataResponseTest extends ResponseTest { - public static DataResponseTest SINGLETON = new DataResponseTest(); + public static final DataResponseTest SINGLETON = new DataResponseTest(); public Object createObject() throws Exception { DataResponse info = new DataResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DestinationInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DestinationInfoTest.java index a42167b767..a65116a8b0 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DestinationInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DestinationInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.DestinationInfo; */ public class DestinationInfoTest extends BaseCommandTestSupport { - public static DestinationInfoTest SINGLETON = new DestinationInfoTest(); + public static final DestinationInfoTest SINGLETON = new DestinationInfoTest(); public Object createObject() throws Exception { DestinationInfo info = new DestinationInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DiscoveryEventTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DiscoveryEventTest.java index f34418cdf7..dc65901d1d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DiscoveryEventTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/DiscoveryEventTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class DiscoveryEventTest extends DataFileGeneratorTestSupport { - public static DiscoveryEventTest SINGLETON = new DiscoveryEventTest(); + public static final DiscoveryEventTest SINGLETON = new DiscoveryEventTest(); public Object createObject() throws Exception { DiscoveryEvent info = new DiscoveryEvent(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ExceptionResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ExceptionResponseTest.java index 027477d3a5..6001e25575 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ExceptionResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ExceptionResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ExceptionResponse; public class ExceptionResponseTest extends ResponseTest { - public static ExceptionResponseTest SINGLETON = new ExceptionResponseTest(); + public static final ExceptionResponseTest SINGLETON = new ExceptionResponseTest(); public Object createObject() throws Exception { ExceptionResponse info = new ExceptionResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/FlushCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/FlushCommandTest.java index d002c9f271..a1213da5ba 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/FlushCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/FlushCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.FlushCommand; public class FlushCommandTest extends BaseCommandTestSupport { - public static FlushCommandTest SINGLETON = new FlushCommandTest(); + public static final FlushCommandTest SINGLETON = new FlushCommandTest(); public Object createObject() throws Exception { FlushCommand info = new FlushCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/IntegerResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/IntegerResponseTest.java index 18cb631fc2..1a8fb927f9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/IntegerResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/IntegerResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.IntegerResponse; public class IntegerResponseTest extends ResponseTest { - public static IntegerResponseTest SINGLETON = new IntegerResponseTest(); + public static final IntegerResponseTest SINGLETON = new IntegerResponseTest(); public Object createObject() throws Exception { IntegerResponse info = new IntegerResponse(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalQueueAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalQueueAckTest.java index 0ba8910a25..e3dc4ee2f6 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalQueueAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalQueueAckTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class JournalQueueAckTest extends DataFileGeneratorTestSupport { - public static JournalQueueAckTest SINGLETON = new JournalQueueAckTest(); + public static final JournalQueueAckTest SINGLETON = new JournalQueueAckTest(); public Object createObject() throws Exception { JournalQueueAck info = new JournalQueueAck(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTopicAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTopicAckTest.java index 2bff5c413c..f3b1507ebc 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTopicAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTopicAckTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class JournalTopicAckTest extends DataFileGeneratorTestSupport { - public static JournalTopicAckTest SINGLETON = new JournalTopicAckTest(); + public static final JournalTopicAckTest SINGLETON = new JournalTopicAckTest(); public Object createObject() throws Exception { JournalTopicAck info = new JournalTopicAck(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTraceTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTraceTest.java index 913904b78e..d3cca6a971 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTraceTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTraceTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class JournalTraceTest extends DataFileGeneratorTestSupport { - public static JournalTraceTest SINGLETON = new JournalTraceTest(); + public static final JournalTraceTest SINGLETON = new JournalTraceTest(); public Object createObject() throws Exception { JournalTrace info = new JournalTrace(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTransactionTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTransactionTest.java index 2df3b7afbc..923260b9c2 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTransactionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/JournalTransactionTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class JournalTransactionTest extends DataFileGeneratorTestSupport { - public static JournalTransactionTest SINGLETON = new JournalTransactionTest(); + public static final JournalTransactionTest SINGLETON = new JournalTransactionTest(); public Object createObject() throws Exception { JournalTransaction info = new JournalTransaction(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/KeepAliveInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/KeepAliveInfoTest.java index c02b70ad56..d6672d1bde 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/KeepAliveInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/KeepAliveInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.KeepAliveInfo; public class KeepAliveInfoTest extends BaseCommandTestSupport { - public static KeepAliveInfoTest SINGLETON = new KeepAliveInfoTest(); + public static final KeepAliveInfoTest SINGLETON = new KeepAliveInfoTest(); public Object createObject() throws Exception { KeepAliveInfo info = new KeepAliveInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/LastPartialCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/LastPartialCommandTest.java index 7a86370e37..a0858be3ef 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/LastPartialCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/LastPartialCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.LastPartialCommand; public class LastPartialCommandTest extends PartialCommandTest { - public static LastPartialCommandTest SINGLETON = new LastPartialCommandTest(); + public static final LastPartialCommandTest SINGLETON = new LastPartialCommandTest(); public Object createObject() throws Exception { LastPartialCommand info = new LastPartialCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/LocalTransactionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/LocalTransactionIdTest.java index feae9fcb27..cf6db3da60 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/LocalTransactionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/LocalTransactionIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.LocalTransactionId; public class LocalTransactionIdTest extends TransactionIdTestSupport { - public static LocalTransactionIdTest SINGLETON = new LocalTransactionIdTest(); + public static final LocalTransactionIdTest SINGLETON = new LocalTransactionIdTest(); public Object createObject() throws Exception { LocalTransactionId info = new LocalTransactionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageAckTest.java index d652027cca..2ed3ad00cb 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageAckTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.MessageAck; public class MessageAckTest extends BaseCommandTestSupport { - public static MessageAckTest SINGLETON = new MessageAckTest(); + public static final MessageAckTest SINGLETON = new MessageAckTest(); public Object createObject() throws Exception { MessageAck info = new MessageAck(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageDispatchNotificationTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageDispatchNotificationTest.java index bced417ae1..3a14d869c4 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageDispatchNotificationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageDispatchNotificationTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.MessageDispatchNotification; public class MessageDispatchNotificationTest extends BaseCommandTestSupport { - public static MessageDispatchNotificationTest SINGLETON = new MessageDispatchNotificationTest(); + public static final MessageDispatchNotificationTest SINGLETON = new MessageDispatchNotificationTest(); public Object createObject() throws Exception { MessageDispatchNotification info = new MessageDispatchNotification(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageDispatchTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageDispatchTest.java index 1814b8bd6c..b4e79bb00e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageDispatchTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageDispatchTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.MessageDispatch; public class MessageDispatchTest extends BaseCommandTestSupport { - public static MessageDispatchTest SINGLETON = new MessageDispatchTest(); + public static final MessageDispatchTest SINGLETON = new MessageDispatchTest(); public Object createObject() throws Exception { MessageDispatch info = new MessageDispatch(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageIdTest.java index a35054e5dd..76dffc8a86 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessageIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class MessageIdTest extends DataFileGeneratorTestSupport { - public static MessageIdTest SINGLETON = new MessageIdTest(); + public static final MessageIdTest SINGLETON = new MessageIdTest(); public Object createObject() throws Exception { MessageId info = new MessageId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessagePullTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessagePullTest.java index 169bc5cc43..03fd3e00f7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessagePullTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/MessagePullTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.MessagePull; public class MessagePullTest extends BaseCommandTestSupport { - public static MessagePullTest SINGLETON = new MessagePullTest(); + public static final MessagePullTest SINGLETON = new MessagePullTest(); public Object createObject() throws Exception { MessagePull info = new MessagePull(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/NetworkBridgeFilterTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/NetworkBridgeFilterTest.java index b707be3a23..f842d1b056 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/NetworkBridgeFilterTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/NetworkBridgeFilterTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class NetworkBridgeFilterTest extends DataFileGeneratorTestSupport { - public static NetworkBridgeFilterTest SINGLETON = new NetworkBridgeFilterTest(); + public static final NetworkBridgeFilterTest SINGLETON = new NetworkBridgeFilterTest(); public Object createObject() throws Exception { NetworkBridgeFilter info = new NetworkBridgeFilter(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/PartialCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/PartialCommandTest.java index 8009f3e9b9..0c959e6f72 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/PartialCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/PartialCommandTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class PartialCommandTest extends DataFileGeneratorTestSupport { - public static PartialCommandTest SINGLETON = new PartialCommandTest(); + public static final PartialCommandTest SINGLETON = new PartialCommandTest(); public Object createObject() throws Exception { PartialCommand info = new PartialCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerAckTest.java index 830902a9d4..29148bf9bf 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerAckTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ProducerAck; public class ProducerAckTest extends BaseCommandTestSupport { - public static ProducerAckTest SINGLETON = new ProducerAckTest(); + public static final ProducerAckTest SINGLETON = new ProducerAckTest(); public Object createObject() throws Exception { ProducerAck info = new ProducerAck(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerIdTest.java index 60115d66b6..02a7f5955b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class ProducerIdTest extends DataFileGeneratorTestSupport { - public static ProducerIdTest SINGLETON = new ProducerIdTest(); + public static final ProducerIdTest SINGLETON = new ProducerIdTest(); public Object createObject() throws Exception { ProducerId info = new ProducerId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerInfoTest.java index 04859b232a..9ded5c979a 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ProducerInfoTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.command.ProducerInfo; */ public class ProducerInfoTest extends BaseCommandTestSupport { - public static ProducerInfoTest SINGLETON = new ProducerInfoTest(); + public static final ProducerInfoTest SINGLETON = new ProducerInfoTest(); public Object createObject() throws Exception { ProducerInfo info = new ProducerInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/RemoveInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/RemoveInfoTest.java index 6020b8a264..71f04f8190 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/RemoveInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/RemoveInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.RemoveInfo; public class RemoveInfoTest extends BaseCommandTestSupport { - public static RemoveInfoTest SINGLETON = new RemoveInfoTest(); + public static final RemoveInfoTest SINGLETON = new RemoveInfoTest(); public Object createObject() throws Exception { RemoveInfo info = new RemoveInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/RemoveSubscriptionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/RemoveSubscriptionInfoTest.java index f251401a63..1842e1a4fc 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/RemoveSubscriptionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/RemoveSubscriptionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.RemoveSubscriptionInfo; public class RemoveSubscriptionInfoTest extends BaseCommandTestSupport { - public static RemoveSubscriptionInfoTest SINGLETON = new RemoveSubscriptionInfoTest(); + public static final RemoveSubscriptionInfoTest SINGLETON = new RemoveSubscriptionInfoTest(); public Object createObject() throws Exception { RemoveSubscriptionInfo info = new RemoveSubscriptionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ReplayCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ReplayCommandTest.java index 277b055e0c..736572f490 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ReplayCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ReplayCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ReplayCommand; public class ReplayCommandTest extends BaseCommandTestSupport { - public static ReplayCommandTest SINGLETON = new ReplayCommandTest(); + public static final ReplayCommandTest SINGLETON = new ReplayCommandTest(); public Object createObject() throws Exception { ReplayCommand info = new ReplayCommand(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ResponseTest.java index 3ea384cf2e..4272231ea9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.Response; public class ResponseTest extends BaseCommandTestSupport { - public static ResponseTest SINGLETON = new ResponseTest(); + public static final ResponseTest SINGLETON = new ResponseTest(); public Object createObject() throws Exception { Response info = new Response(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SessionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SessionIdTest.java index 1568d0e6c1..c768897ba0 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SessionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SessionIdTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class SessionIdTest extends DataFileGeneratorTestSupport { - public static SessionIdTest SINGLETON = new SessionIdTest(); + public static final SessionIdTest SINGLETON = new SessionIdTest(); public Object createObject() throws Exception { SessionId info = new SessionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SessionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SessionInfoTest.java index bbd3f67a25..234057da86 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SessionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SessionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.SessionInfo; public class SessionInfoTest extends BaseCommandTestSupport { - public static SessionInfoTest SINGLETON = new SessionInfoTest(); + public static final SessionInfoTest SINGLETON = new SessionInfoTest(); public Object createObject() throws Exception { SessionInfo info = new SessionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ShutdownInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ShutdownInfoTest.java index 4f18479523..8689ca93e4 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ShutdownInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/ShutdownInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.ShutdownInfo; public class ShutdownInfoTest extends BaseCommandTestSupport { - public static ShutdownInfoTest SINGLETON = new ShutdownInfoTest(); + public static final ShutdownInfoTest SINGLETON = new ShutdownInfoTest(); public Object createObject() throws Exception { ShutdownInfo info = new ShutdownInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SubscriptionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SubscriptionInfoTest.java index 73877c160f..5c9fe4f64d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SubscriptionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/SubscriptionInfoTest.java @@ -34,7 +34,7 @@ import org.apache.activemq.openwire.DataFileGeneratorTestSupport; public class SubscriptionInfoTest extends DataFileGeneratorTestSupport { - public static SubscriptionInfoTest SINGLETON = new SubscriptionInfoTest(); + public static final SubscriptionInfoTest SINGLETON = new SubscriptionInfoTest(); public Object createObject() throws Exception { SubscriptionInfo info = new SubscriptionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/TransactionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/TransactionInfoTest.java index 417f86dda3..7e0a57ebeb 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/TransactionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/TransactionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.TransactionInfo; public class TransactionInfoTest extends BaseCommandTestSupport { - public static TransactionInfoTest SINGLETON = new TransactionInfoTest(); + public static final TransactionInfoTest SINGLETON = new TransactionInfoTest(); public Object createObject() throws Exception { TransactionInfo info = new TransactionInfo(); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/XATransactionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/XATransactionIdTest.java index 188d29a134..94ec61bb5a 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v3/XATransactionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v3/XATransactionIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.XATransactionId; public class XATransactionIdTest extends TransactionIdTestSupport { - public static XATransactionIdTest SINGLETON = new XATransactionIdTest(); + public static final XATransactionIdTest SINGLETON = new XATransactionIdTest(); public Object createObject() throws Exception { XATransactionId info = new XATransactionId(); diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/AMQStoreDurableTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/AMQStoreDurableTopicTest.java index 2477d493ab..c47d974c7c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/AMQStoreDurableTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/AMQStoreDurableTopicTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.perf; import java.io.File; diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/InactiveDurableTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/InactiveDurableTopicTest.java index 6b16be7ebb..c8081e1c6f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/InactiveDurableTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/InactiveDurableTopicTest.java @@ -1,15 +1,18 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.perf; @@ -42,8 +45,8 @@ public class InactiveDurableTopicTest extends TestCase { private static final String CLIENTID = "mytestclient"; private static final String TOPIC_NAME = "testevent"; private static final String SUBID = "subscription1"; - private static final int deliveryMode = javax.jms.DeliveryMode.PERSISTENT; - private static final int deliveryPriority = javax.jms.Message.DEFAULT_PRIORITY; + private static final int DELIVERY_MODE = javax.jms.DeliveryMode.PERSISTENT; + private static final int DELIVERY_PRIORITY = javax.jms.Message.DEFAULT_PRIORITY; private Connection connection; private MessageProducer publisher; private TopicSubscriber subscriber; @@ -128,7 +131,7 @@ public class InactiveDurableTopicTest extends TestCase { int loop; for (loop = 0; loop < MESSAGE_COUNT; loop++) { msg.setInt("key2", loop); - publisher.send(msg, deliveryMode, deliveryPriority, Message.DEFAULT_TIME_TO_LIVE); + publisher.send(msg, DELIVERY_MODE, DELIVERY_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); if (loop % 500 == 0) { LOG.debug("Sent " + loop + " messages"); } diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/InactiveQueueTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/InactiveQueueTest.java index 71d0ab65d9..5613a5e3a7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/InactiveQueueTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/InactiveQueueTest.java @@ -1,15 +1,18 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.activemq.perf; @@ -38,16 +41,17 @@ public class InactiveQueueTest extends TestCase { private static final String USERNAME = "testuser"; private static final String CLIENTID = "mytestclient"; private static final String QUEUE_NAME = "testevent"; - private static final int deliveryMode = javax.jms.DeliveryMode.PERSISTENT; - private static final int deliveryPriority = javax.jms.Message.DEFAULT_PRIORITY; + private static final int DELIVERY_MODE = javax.jms.DeliveryMode.PERSISTENT; + private static final int DELIVERY_PRIORITY = javax.jms.Message.DEFAULT_PRIORITY; + ActiveMQConnectionFactory connectionFactory; + BrokerService broker; + private Connection connection; private MessageProducer publisher; private TopicSubscriber subscriber; private Destination destination; private Session session; - ActiveMQConnectionFactory connectionFactory; - BrokerService broker; protected void setUp() throws Exception { super.setUp(); @@ -94,7 +98,7 @@ public class InactiveQueueTest extends TestCase { int loop; for (loop = 0; loop < MESSAGE_COUNT; loop++) { msg.setInt("key2", loop); - publisher.send(msg, deliveryMode, deliveryPriority, Message.DEFAULT_TIME_TO_LIVE); + publisher.send(msg, DELIVERY_MODE, DELIVERY_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); if (loop % 500 == 0) { LOG.debug("Sent " + loop + " messages"); } diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java index 9166651c01..050bce7631 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java @@ -39,7 +39,7 @@ import org.apache.commons.logging.LogFactory; */ public class MemoryAllocationTest extends TestCase { - protected static final Log LOG = LogFactory.getLog(MemoryAllocationTest.class); + private static final Log LOG = LogFactory.getLog(MemoryAllocationTest.class); protected static final int MESSAGE_COUNT = 2000; protected BrokerService broker; @@ -59,8 +59,9 @@ public class MemoryAllocationTest extends TestCase { mp.send(msg); session.close(); releaseDestination(dest); - if (i % 500 == 0) + if (i % 500 == 0) { LOG.info("Iterator " + i); + } } connection.close(); } diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/PerfProducer.java b/activemq-core/src/test/java/org/apache/activemq/perf/PerfProducer.java index 1aff344498..b945b68d6e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/PerfProducer.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/PerfProducer.java @@ -57,7 +57,7 @@ public class PerfProducer implements Runnable { return rate; } - synchronized public void start() throws JMSException { + public synchronized void start() throws JMSException { if (!running) { rate.reset(); running = true; @@ -74,7 +74,7 @@ public class PerfProducer implements Runnable { connection.stop(); } - synchronized public boolean isRunning() { + public synchronized boolean isRunning() { return running; } diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/PerfRate.java b/activemq-core/src/test/java/org/apache/activemq/perf/PerfRate.java index 2132d89b7c..42d547bd1f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/PerfRate.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/PerfRate.java @@ -32,7 +32,7 @@ public class PerfRate { return totalCount; } - synchronized public void increment() { + public synchronized void increment() { totalCount++; count++; } @@ -47,7 +47,7 @@ public class PerfRate { /** * Resets the rate sampling. */ - synchronized public PerfRate cloneAndReset() { + public synchronized PerfRate cloneAndReset() { PerfRate rc = new PerfRate(); rc.totalCount = totalCount; rc.count = count; diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/QueueConnectionMemoryTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/QueueConnectionMemoryTest.java index 151be4e6bb..cda419f64d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/QueueConnectionMemoryTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/QueueConnectionMemoryTest.java @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.3 $ */ public class QueueConnectionMemoryTest extends SimpleQueueTest { - private static final transient Log log = LogFactory.getLog(QueueConnectionMemoryTest.class); + private static final transient Log LOG = LogFactory.getLog(QueueConnectionMemoryTest.class); protected void setUp() throws Exception { } @@ -69,7 +69,7 @@ public class QueueConnectionMemoryTest extends SimpleQueueTest { Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination dest = s.createTemporaryQueue(); MessageConsumer consumer = s.createConsumer(dest); - log.debug("Created connnection: " + i); + LOG.debug("Created connnection: " + i); Thread.sleep(1000); } diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/SimpleTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/SimpleTopicTest.java index b7d392b026..6bb0f79550 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/SimpleTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/SimpleTopicTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.perf; import javax.jms.Connection; diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/SlowConsumer.java b/activemq-core/src/test/java/org/apache/activemq/perf/SlowConsumer.java index eb5ea3a44b..6b2af9b16c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/SlowConsumer.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/SlowConsumer.java @@ -28,7 +28,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.3 $ */ public class SlowConsumer extends PerfConsumer { - private static final transient Log log = LogFactory.getLog(SlowConsumer.class); + private static final transient Log LOG = LogFactory.getLog(SlowConsumer.class); public SlowConsumer(ConnectionFactory fac, Destination dest, String consumerName) throws JMSException { super(fac, dest, consumerName); @@ -40,7 +40,7 @@ public class SlowConsumer extends PerfConsumer { public void onMessage(Message msg) { super.onMessage(msg); - log.debug("GOT A MSG " + msg); + LOG.debug("GOT A MSG " + msg); try { Thread.sleep(10000); } catch (InterruptedException e) { diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/SlowConsumerTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/SlowConsumerTopicTest.java index 22317e616d..e6729c3556 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/SlowConsumerTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/SlowConsumerTopicTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.perf; import javax.jms.ConnectionFactory; @@ -31,14 +33,14 @@ import org.springframework.core.io.Resource; public class SlowConsumerTopicTest extends SimpleTopicTest { protected PerfConsumer[] slowConsumers; - protected int NUMBER_OF_SLOW_CONSUMERS = 1; + protected int numberOfSlowConsumers = 1; protected void setUp() throws Exception { numberOfConsumers = 0; playloadSize = 10 * 1024; super.setUp(); - slowConsumers = new SlowConsumer[NUMBER_OF_SLOW_CONSUMERS]; - for (int i = 0; i < NUMBER_OF_SLOW_CONSUMERS; i++) { + slowConsumers = new SlowConsumer[numberOfSlowConsumers]; + for (int i = 0; i < numberOfSlowConsumers; i++) { slowConsumers[i] = createSlowConsumer(factory, destination, i); slowConsumers[i].start(); } diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/SlowDurableConsumerTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/SlowDurableConsumerTopicTest.java index 2a5bb9a061..a0da5cd268 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/SlowDurableConsumerTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/SlowDurableConsumerTopicTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.perf; import javax.jms.ConnectionFactory; @@ -24,7 +26,7 @@ import javax.jms.JMSException; public class SlowDurableConsumerTopicTest extends SlowConsumerTopicTest { protected PerfConsumer[] slowConsumers; - protected int NUMBER_OF_SLOW_CONSUMERS = 1; + protected int numberOfSlowConsumers = 1; protected PerfConsumer createSlowConsumer(ConnectionFactory fac, Destination dest, int number) throws JMSException { return new SlowConsumer(fac, dest, "durableSlowConsumer" + number); diff --git a/activemq-core/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java b/activemq-core/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java index 4670f1847d..9760d3dbc7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java @@ -29,18 +29,18 @@ import org.apache.activemq.jaas.GroupPrincipal; * @version $Revision$ */ public class AuthorizationMapTest extends TestCase { - static final GroupPrincipal guests = new GroupPrincipal("guests"); - static final GroupPrincipal users = new GroupPrincipal("users"); - static final GroupPrincipal admins = new GroupPrincipal("admins"); - static final GroupPrincipal tempDestinationAdmins = new GroupPrincipal("tempDestAdmins"); + static final GroupPrincipal GUESTS = new GroupPrincipal("guests"); + static final GroupPrincipal USERS = new GroupPrincipal("users"); + static final GroupPrincipal ADMINS = new GroupPrincipal("admins"); + static final GroupPrincipal TEMP_DESTINATION_ADMINS = new GroupPrincipal("tempDestAdmins"); public void testAuthorizationMap() { AuthorizationMap map = createAuthorizationMap(); Set readACLs = map.getReadACLs(new ActiveMQQueue("USERS.FOO.BAR")); assertEquals("set size: " + readACLs, 2, readACLs.size()); - assertTrue("Contains users group", readACLs.contains(admins)); - assertTrue("Contains users group", readACLs.contains(users)); + assertTrue("Contains users group", readACLs.contains(ADMINS)); + assertTrue("Contains users group", readACLs.contains(USERS)); } @@ -49,12 +49,12 @@ public class AuthorizationMapTest extends TestCase { Set readACLs = map.getReadACLs(new ActiveMQQueue("USERS.FOO.BAR")); assertEquals("set size: " + readACLs, 2, readACLs.size()); - assertTrue("Contains users group", readACLs.contains(admins)); - assertTrue("Contains users group", readACLs.contains(users)); + assertTrue("Contains users group", readACLs.contains(ADMINS)); + assertTrue("Contains users group", readACLs.contains(USERS)); Set tempAdminACLs = map.getTempDestinationAdminACLs(); assertEquals("set size: " + tempAdminACLs, 1, tempAdminACLs.size()); - assertTrue("Contains users group", tempAdminACLs.contains(tempDestinationAdmins)); + assertTrue("Contains users group", tempAdminACLs.contains(TEMP_DESTINATION_ADMINS)); } diff --git a/activemq-core/src/test/java/org/apache/activemq/security/SecurityTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/security/SecurityTestSupport.java index 413b72ec95..98046d053b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/SecurityTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/SecurityTestSupport.java @@ -138,8 +138,9 @@ public class SecurityTestSupport extends JmsTestSupport { } Message m = consumer.receive(1000); - if (fail) + if (fail) { assertNull(m); + } else { assertNotNull(m); assertEquals("0", ((TextMessage)m).getText()); @@ -158,11 +159,13 @@ public class SecurityTestSupport extends JmsTestSupport { MessageConsumer consumer = null; try { consumer = session.createConsumer(destination); - if (fail) + if (fail) { fail("Expected failure due to security constraint."); + } } catch (JMSException e) { - if (fail && e.getCause() instanceof SecurityException) + if (fail && e.getCause() instanceof SecurityException) { return null; + } throw e; } diff --git a/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java b/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java index 9b5480a1f9..eb74e20ce7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java @@ -26,7 +26,7 @@ import org.apache.commons.logging.LogFactory; public class SimpleAuthenticationPluginTest extends SecurityTestSupport { - private static final Log log = LogFactory.getLog(SimpleAuthenticationPluginTest.class); + private static final Log LOG = LogFactory.getLog(SimpleAuthenticationPluginTest.class); public static Test suite() { return suite(SimpleAuthenticationPluginTest.class); @@ -41,7 +41,7 @@ public class SimpleAuthenticationPluginTest extends SecurityTestSupport { } protected BrokerService createBroker(String uri) throws Exception { - log.info("Loading broker configuration from the classpath with URI: " + uri); + LOG.info("Loading broker configuration from the classpath with URI: " + uri); return BrokerFactory.createBroker(new URI("xbean:" + uri)); } diff --git a/activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java b/activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java index e3b6b2d411..143f1e8600 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java @@ -28,8 +28,11 @@ import org.apache.activemq.broker.BrokerPlugin; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQTopic; +import org.apache.activemq.command.MessageSendTest; import org.apache.activemq.filter.DestinationMap; import org.apache.activemq.jaas.GroupPrincipal; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * Tests that the broker allows/fails access to destinations based on the @@ -38,10 +41,11 @@ import org.apache.activemq.jaas.GroupPrincipal; * @version $Revision$ */ public class SimpleSecurityBrokerSystemTest extends SecurityTestSupport { + private static final Log LOG = LogFactory.getLog(SimpleSecurityBrokerSystemTest.class); - static final GroupPrincipal guests = new GroupPrincipal("guests"); - static final GroupPrincipal users = new GroupPrincipal("users"); - static final GroupPrincipal admins = new GroupPrincipal("admins"); + static final GroupPrincipal GUESTS = new GroupPrincipal("guests"); + static final GroupPrincipal USERS = new GroupPrincipal("users"); + static final GroupPrincipal ADMINS = new GroupPrincipal("admins"); public BrokerPlugin authorizationPlugin; public BrokerPlugin authenticationPlugin; @@ -55,7 +59,7 @@ public class SimpleSecurityBrokerSystemTest extends SecurityTestSupport { System.setProperty("java.security.auth.login.config", path); } } - log.info("Path to login config: " + path); + LOG.info("Path to login config: " + path); } public static Test suite() { @@ -68,35 +72,35 @@ public class SimpleSecurityBrokerSystemTest extends SecurityTestSupport { public static AuthorizationMap createAuthorizationMap() { DestinationMap readAccess = new DestinationMap(); - readAccess.put(new ActiveMQQueue(">"), admins); - readAccess.put(new ActiveMQQueue("USERS.>"), users); - readAccess.put(new ActiveMQQueue("GUEST.>"), guests); - readAccess.put(new ActiveMQTopic(">"), admins); - readAccess.put(new ActiveMQTopic("USERS.>"), users); - readAccess.put(new ActiveMQTopic("GUEST.>"), guests); + readAccess.put(new ActiveMQQueue(">"), ADMINS); + readAccess.put(new ActiveMQQueue("USERS.>"), USERS); + readAccess.put(new ActiveMQQueue("GUEST.>"), GUESTS); + readAccess.put(new ActiveMQTopic(">"), ADMINS); + readAccess.put(new ActiveMQTopic("USERS.>"), USERS); + readAccess.put(new ActiveMQTopic("GUEST.>"), GUESTS); DestinationMap writeAccess = new DestinationMap(); - writeAccess.put(new ActiveMQQueue(">"), admins); - writeAccess.put(new ActiveMQQueue("USERS.>"), users); - writeAccess.put(new ActiveMQQueue("GUEST.>"), users); - writeAccess.put(new ActiveMQQueue("GUEST.>"), guests); - writeAccess.put(new ActiveMQTopic(">"), admins); - writeAccess.put(new ActiveMQTopic("USERS.>"), users); - writeAccess.put(new ActiveMQTopic("GUEST.>"), users); - writeAccess.put(new ActiveMQTopic("GUEST.>"), guests); + writeAccess.put(new ActiveMQQueue(">"), ADMINS); + writeAccess.put(new ActiveMQQueue("USERS.>"), USERS); + writeAccess.put(new ActiveMQQueue("GUEST.>"), USERS); + writeAccess.put(new ActiveMQQueue("GUEST.>"), GUESTS); + writeAccess.put(new ActiveMQTopic(">"), ADMINS); + writeAccess.put(new ActiveMQTopic("USERS.>"), USERS); + writeAccess.put(new ActiveMQTopic("GUEST.>"), USERS); + writeAccess.put(new ActiveMQTopic("GUEST.>"), GUESTS); - readAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), guests); - readAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), users); - writeAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), guests); - writeAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), users); + readAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), GUESTS); + readAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), USERS); + writeAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), GUESTS); + writeAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), USERS); DestinationMap adminAccess = new DestinationMap(); - adminAccess.put(new ActiveMQTopic(">"), admins); - adminAccess.put(new ActiveMQTopic(">"), users); - adminAccess.put(new ActiveMQTopic(">"), guests); - adminAccess.put(new ActiveMQQueue(">"), admins); - adminAccess.put(new ActiveMQQueue(">"), users); - adminAccess.put(new ActiveMQQueue(">"), guests); + adminAccess.put(new ActiveMQTopic(">"), ADMINS); + adminAccess.put(new ActiveMQTopic(">"), USERS); + adminAccess.put(new ActiveMQTopic(">"), GUESTS); + adminAccess.put(new ActiveMQQueue(">"), ADMINS); + adminAccess.put(new ActiveMQQueue(">"), USERS); + adminAccess.put(new ActiveMQQueue(">"), GUESTS); return new SimpleAuthorizationMap(writeAccess, readAccess, adminAccess); } @@ -110,9 +114,9 @@ public class SimpleSecurityBrokerSystemTest extends SecurityTestSupport { u.put("guest", "password"); HashMap groups = new HashMap(); - groups.put("system", new HashSet(Arrays.asList(new Object[] { admins, users }))); - groups.put("user", new HashSet(Arrays.asList(new Object[] { users }))); - groups.put("guest", new HashSet(Arrays.asList(new Object[] { guests }))); + groups.put("system", new HashSet(Arrays.asList(new Object[] { ADMINS, USERS }))); + groups.put("user", new HashSet(Arrays.asList(new Object[] { USERS }))); + groups.put("guest", new HashSet(Arrays.asList(new Object[] { GUESTS }))); return new SimpleAuthenticationBroker(broker, u, groups); } diff --git a/activemq-core/src/test/java/org/apache/activemq/security/XBeanSecurityTest.java b/activemq-core/src/test/java/org/apache/activemq/security/XBeanSecurityTest.java index 5bf326cc8f..91a9d20087 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/XBeanSecurityTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/XBeanSecurityTest.java @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; */ public class XBeanSecurityTest extends SecurityTestSupport { - private static final Log log = LogFactory.getLog(XBeanSecurityTest.class); + private static final Log LOG = LogFactory.getLog(XBeanSecurityTest.class); public static Test suite() { return suite(XBeanSecurityTest.class); @@ -46,7 +46,7 @@ public class XBeanSecurityTest extends SecurityTestSupport { } protected BrokerService createBroker(String uri) throws Exception { - log.info("Loading broker configuration from the classpath with URI: " + uri); + LOG.info("Loading broker configuration from the classpath with URI: " + uri); return BrokerFactory.createBroker(new URI("xbean:" + uri)); } diff --git a/activemq-core/src/test/java/org/apache/activemq/selector/SelectorParserTest.java b/activemq-core/src/test/java/org/apache/activemq/selector/SelectorParserTest.java index ef1718f0da..6a0be32279 100755 --- a/activemq-core/src/test/java/org/apache/activemq/selector/SelectorParserTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/selector/SelectorParserTest.java @@ -23,17 +23,20 @@ import org.apache.activemq.filter.Expression; import org.apache.activemq.filter.LogicExpression; import org.apache.activemq.filter.PropertyExpression; import org.apache.activemq.filter.XPathExpression; +import org.apache.activemq.spring.ConsumerBean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision: 1.2 $ */ public class SelectorParserTest extends TestCase { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(SelectorParserTest.class); + private static final Log LOG = LogFactory.getLog(SelectorParserTest.class); public void testParseXPath() throws Exception { BooleanExpression filter = parse("XPATH '//title[@lang=''eng'']'"); assertTrue("Created XPath expression", filter instanceof XPathExpression); - log.info("Expression: " + filter); + LOG.info("Expression: " + filter); } public void testParseWithParensAround() throws Exception { @@ -41,7 +44,7 @@ public class SelectorParserTest extends TestCase { for (int i = 0; i < values.length; i++) { String value = values[i]; - log.info("Parsing: " + value); + LOG.info("Parsing: " + value); BooleanExpression andExpression = parse(value); assertTrue("Created LogicExpression expression", andExpression instanceof LogicExpression); diff --git a/activemq-core/src/test/java/org/apache/activemq/spring/ConsumerBean.java b/activemq-core/src/test/java/org/apache/activemq/spring/ConsumerBean.java index 9e8d9439f0..303c2e2200 100755 --- a/activemq-core/src/test/java/org/apache/activemq/spring/ConsumerBean.java +++ b/activemq-core/src/test/java/org/apache/activemq/spring/ConsumerBean.java @@ -22,10 +22,13 @@ import java.util.List; import javax.jms.Message; import javax.jms.MessageListener; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import junit.framework.Assert; public class ConsumerBean extends Assert implements MessageListener { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(ConsumerBean.class); + private static final Log LOG = LogFactory.getLog(ConsumerBean.class); private List messages = new ArrayList(); private Object semaphore; private boolean verbose; @@ -63,7 +66,7 @@ public class ConsumerBean extends Assert implements MessageListener { public synchronized void onMessage(Message message) { messages.add(message); if (verbose) { - log.info("Received: " + message); + LOG.info("Received: " + message); } synchronized (semaphore) { semaphore.notifyAll(); @@ -74,7 +77,7 @@ public class ConsumerBean extends Assert implements MessageListener { * Use to wait for a single message to arrive. */ public void waitForMessageToArrive() { - log.info("Waiting for message to arrive"); + LOG.info("Waiting for message to arrive"); long start = System.currentTimeMillis(); @@ -85,11 +88,11 @@ public class ConsumerBean extends Assert implements MessageListener { } } } catch (InterruptedException e) { - log.info("Caught: " + e); + LOG.info("Caught: " + e); } long end = System.currentTimeMillis() - start; - log.info("End of wait for " + end + " millis"); + LOG.info("End of wait for " + end + " millis"); } /** @@ -98,7 +101,7 @@ public class ConsumerBean extends Assert implements MessageListener { * @param messageCount */ public void waitForMessagesToArrive(int messageCount) { - log.info("Waiting for message to arrive"); + LOG.info("Waiting for message to arrive"); long start = System.currentTimeMillis(); @@ -111,12 +114,12 @@ public class ConsumerBean extends Assert implements MessageListener { semaphore.wait(1000); } } catch (InterruptedException e) { - log.info("Caught: " + e); + LOG.info("Caught: " + e); } } long end = System.currentTimeMillis() - start; - log.info("End of wait for " + end + " millis"); + LOG.info("End of wait for " + end + " millis"); } public void assertMessagesArrived(int total) { diff --git a/activemq-core/src/test/java/org/apache/activemq/spring/SpringConsumer.java b/activemq-core/src/test/java/org/apache/activemq/spring/SpringConsumer.java index b0efe11433..6f555ec5dd 100755 --- a/activemq-core/src/test/java/org/apache/activemq/spring/SpringConsumer.java +++ b/activemq-core/src/test/java/org/apache/activemq/spring/SpringConsumer.java @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; import org.springframework.jms.core.JmsTemplate; public class SpringConsumer extends ConsumerBean implements MessageListener { - private static final Log log = LogFactory.getLog(SpringConsumer.class); + private static final Log LOG = LogFactory.getLog(SpringConsumer.class); private JmsTemplate template; private String myId = "foo"; private Destination destination; @@ -59,7 +59,7 @@ public class SpringConsumer extends ConsumerBean implements MessageListener { consumer = session.createConsumer(destination, selector, false); consumer.setMessageListener(this); } catch (JMSException ex) { - log.error("", ex); + LOG.error("", ex); throw ex; } } @@ -81,7 +81,7 @@ public class SpringConsumer extends ConsumerBean implements MessageListener { try { message.acknowledge(); } catch (JMSException e) { - log.error("Failed to acknowledge: " + e, e); + LOG.error("Failed to acknowledge: " + e, e); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/spring/SpringProducer.java b/activemq-core/src/test/java/org/apache/activemq/spring/SpringProducer.java index 67608c8241..297f99f07c 100755 --- a/activemq-core/src/test/java/org/apache/activemq/spring/SpringProducer.java +++ b/activemq-core/src/test/java/org/apache/activemq/spring/SpringProducer.java @@ -22,12 +22,13 @@ import javax.jms.Message; import javax.jms.Session; import javax.jms.TextMessage; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.jms.core.JmsTemplate; import org.springframework.jms.core.MessageCreator; public class SpringProducer { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory - .getLog(SpringProducer.class); + private static final Log LOG = LogFactory.getLog(SpringProducer.class); private JmsTemplate template; private Destination destination; private int messageCount = 10; @@ -37,7 +38,7 @@ public class SpringProducer { final String text = "Text for message: " + i; template.send(destination, new MessageCreator() { public Message createMessage(Session session) throws JMSException { - log.info("Sending message: " + text); + LOG.info("Sending message: " + text); TextMessage message = session.createTextMessage(text); message.setStringProperty("next", "foo"); return message; diff --git a/activemq-core/src/test/java/org/apache/activemq/spring/SpringTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/spring/SpringTestSupport.java index b5befa27cf..f1b9c9ce0c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/spring/SpringTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/spring/SpringTestSupport.java @@ -20,6 +20,9 @@ import java.util.Iterator; import java.util.List; import junit.framework.TestCase; +import org.apache.activemq.test.JmsTopicSendReceiveTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -27,7 +30,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; * @version $Revision: 1.1 $ */ public class SpringTestSupport extends TestCase { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(SpringTest.class); + private static final Log LOG = LogFactory.getLog(SpringTest.class); protected AbstractApplicationContext context; protected SpringConsumer consumer; protected SpringProducer producer; @@ -62,10 +65,10 @@ public class SpringTestSupport extends TestCase { // now lets check that the consumer has received some messages List messages = consumer.flushMessages(); - log.info("Consumer has received messages...."); + LOG.info("Consumer has received messages...."); for (Iterator iter = messages.iterator(); iter.hasNext();) { Object message = iter.next(); - log.info("Received: " + message); + LOG.info("Received: " + message); } assertEquals("Message count", producer.getMessageCount(), messages.size()); diff --git a/activemq-core/src/test/java/org/apache/activemq/streams/JMSInputStreamTest.java b/activemq-core/src/test/java/org/apache/activemq/streams/JMSInputStreamTest.java index b8b708f274..80cfd8a6b1 100755 --- a/activemq-core/src/test/java/org/apache/activemq/streams/JMSInputStreamTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/streams/JMSInputStreamTest.java @@ -91,22 +91,22 @@ public class JMSInputStreamTest extends JmsTestSupport { } public void testLarge() throws Exception { - final int TEST_DATA = 23; - final int DATA_LENGTH = 4096; - final int COUNT = 1024; - byte[] data = new byte[DATA_LENGTH]; + final int testData = 23; + final int dataLength = 4096; + final int count = 1024; + byte[] data = new byte[dataLength]; for (int i = 0; i < data.length; i++) { - data[i] = TEST_DATA; + data[i] = testData; } final AtomicBoolean complete = new AtomicBoolean(false); Thread runner = new Thread(new Runnable() { public void run() { try { - for (int x = 0; x < COUNT; x++) { + for (int x = 0; x < count; x++) { byte[] b = new byte[2048]; in.readFully(b); for (int i = 0; i < b.length; i++) { - assertTrue(b[i] == TEST_DATA); + assertTrue(b[i] == testData); } } complete.set(true); @@ -119,7 +119,7 @@ public class JMSInputStreamTest extends JmsTestSupport { } }); runner.start(); - for (int i = 0; i < COUNT; i++) { + for (int i = 0; i < count; i++) { out.write(data); } out.flush(); diff --git a/activemq-core/src/test/java/org/apache/activemq/test/JmsResourceProvider.java b/activemq-core/src/test/java/org/apache/activemq/test/JmsResourceProvider.java index 6679151a40..f51cacdff3 100755 --- a/activemq-core/src/test/java/org/apache/activemq/test/JmsResourceProvider.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/JmsResourceProvider.java @@ -112,10 +112,11 @@ public class JmsResourceProvider { * java.lang.String) */ public Destination createDestination(Session session, String name) throws JMSException { - if (isTopic) + if (isTopic) { return session.createTopic("TOPIC." + name); - else + } else { return session.createQueue("QUEUE." + name); + } } /** diff --git a/activemq-core/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java index 1510523ba0..05ec903c2a 100755 --- a/activemq-core/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java @@ -40,7 +40,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.2 $ */ public abstract class JmsSendReceiveTestSupport extends TestSupport implements MessageListener { - protected static final Log LOG = LogFactory.getLog(JmsSendReceiveTestSupport.class); + private static final Log LOG = LogFactory.getLog(JmsSendReceiveTestSupport.class); protected int messageCount = 100; protected String[] data; diff --git a/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveTest.java b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveTest.java index b26f79da6d..52eee19988 100755 --- a/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveTest.java @@ -23,11 +23,14 @@ import javax.jms.MessageConsumer; import javax.jms.Session; import javax.jms.Topic; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** * @version $Revision: 1.2 $ */ public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(JmsTopicSendReceiveTest.class); + private static final Log LOG = LogFactory.getLog(JmsTopicSendReceiveTest.class); protected Connection connection; @@ -40,17 +43,17 @@ public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport { connection.setClientID(getClass().getName()); } - log.info("Created connection: " + connection); + LOG.info("Created connection: " + connection); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); consumeSession = createConsumerSession(); - log.info("Created session: " + session); - log.info("Created consumeSession: " + consumeSession); + LOG.info("Created session: " + session); + LOG.info("Created consumeSession: " + consumeSession); producer = session.createProducer(null); producer.setDeliveryMode(deliveryMode); - log.info("Created producer: " + producer + " delivery mode = " + (deliveryMode == DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON_PERSISTENT")); + LOG.info("Created producer: " + producer + " delivery mode = " + (deliveryMode == DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON_PERSISTENT")); if (topic) { consumerDestination = session.createTopic(getConsumerSubject()); @@ -60,13 +63,13 @@ public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport { producerDestination = session.createQueue(getProducerSubject()); } - log.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); - log.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); + LOG.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); + LOG.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); consumer = createConsumer(); consumer.setMessageListener(this); startConnection(); - log.info("Created connection: " + connection); + LOG.info("Created connection: " + connection); } protected void startConnection() throws JMSException { @@ -74,11 +77,11 @@ public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport { } protected void tearDown() throws Exception { - log.info("Dumping stats..."); + LOG.info("Dumping stats..."); // TODO // connectionFactory.getFactoryStats().dump(new IndentPrinter()); - log.info("Closing down connection"); + LOG.info("Closing down connection"); /** TODO we should be able to shut down properly */ session.close(); @@ -107,7 +110,7 @@ public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport { */ protected MessageConsumer createConsumer() throws JMSException { if (durable) { - log.info("Creating durable consumer"); + LOG.info("Creating durable consumer"); return consumeSession.createDurableSubscriber((Topic)consumerDestination, getName()); } return consumeSession.createConsumer(consumerDestination); diff --git a/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.java b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.java index ea7848b3ab..c459090fd5 100644 --- a/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.java @@ -24,16 +24,18 @@ import javax.jms.Message; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.security.SimpleSecurityBrokerSystemTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** - * * @version $Revision: 1.1 $ */ -public class JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest extends - JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest { +public class JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest extends JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest { + private static final Log log = LogFactory.getLog(JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.class); protected String userName = "James"; - + protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { ActiveMQConnectionFactory answer = super.createConnectionFactory(); answer.setUserName(userName); @@ -50,7 +52,7 @@ public class JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest extends // lets assert that the user ID is set for (Iterator iter = receivedMessages.iterator(); iter.hasNext();) { - Message message = (Message) iter.next(); + Message message = (Message)iter.next(); String userID = message.getStringProperty("JMSXUserID"); log.info("Received message with userID: " + userID); diff --git a/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java index 26b2c45072..94c3b42057 100755 --- a/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java @@ -31,7 +31,7 @@ import org.apache.commons.logging.LogFactory; */ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTestSupport { - protected static final Log log = LogFactory.getLog(JmsTopicSendReceiveWithTwoConnectionsTest.class); + private static final Log LOG = LogFactory.getLog(JmsTopicSendReceiveWithTwoConnectionsTest.class); protected Connection sendConnection; protected Connection receiveConnection; @@ -47,29 +47,29 @@ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTes connectionFactory = createConnectionFactory(); - log.info("Creating send connection"); + LOG.info("Creating send connection"); sendConnection = createSendConnection(); - log.info("Starting send connection"); + LOG.info("Starting send connection"); sendConnection.start(); - log.info("Creating receive connection"); + LOG.info("Creating receive connection"); receiveConnection = createReceiveConnection(); - log.info("Starting receive connection"); + LOG.info("Starting receive connection"); receiveConnection.start(); - log.info("Created sendConnection: " + sendConnection); - log.info("Created receiveConnection: " + receiveConnection); + LOG.info("Created sendConnection: " + sendConnection); + LOG.info("Created receiveConnection: " + receiveConnection); session = sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); receiveSession = receiveConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - log.info("Created sendSession: " + session); - log.info("Created receiveSession: " + receiveSession); + LOG.info("Created sendSession: " + session); + LOG.info("Created receiveSession: " + receiveSession); producer = session.createProducer(null); producer.setDeliveryMode(deliveryMode); - log.info("Created producer: " + producer + " delivery mode = " + (deliveryMode == DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON_PERSISTENT")); + LOG.info("Created producer: " + producer + " delivery mode = " + (deliveryMode == DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON_PERSISTENT")); if (topic) { consumerDestination = session.createTopic(getConsumerSubject()); @@ -79,13 +79,13 @@ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTes producerDestination = session.createQueue(getProducerSubject()); } - log.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); - log.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); + LOG.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); + LOG.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); consumer = createConsumer(); consumer.setMessageListener(this); - log.info("Started connections"); + LOG.info("Started connections"); } protected MessageConsumer createConsumer() throws JMSException { diff --git a/activemq-core/src/test/java/org/apache/activemq/test/TemporaryDestinationToFromNameTest.java b/activemq-core/src/test/java/org/apache/activemq/test/TemporaryDestinationToFromNameTest.java index 52a59cfe82..699a70c065 100644 --- a/activemq-core/src/test/java/org/apache/activemq/test/TemporaryDestinationToFromNameTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/TemporaryDestinationToFromNameTest.java @@ -21,11 +21,17 @@ import javax.jms.Session; import javax.jms.Topic; import org.apache.activemq.EmbeddedBrokerAndConnectionTestSupport; +import org.apache.activemq.broker.jmx.PurgeTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision: 1.1 $ */ public class TemporaryDestinationToFromNameTest extends EmbeddedBrokerAndConnectionTestSupport { + + private static final Log LOG = LogFactory.getLog(TemporaryDestinationToFromNameTest.class); + public void testCreateTemporaryQueueThenCreateAQueueFromItsName() throws Exception { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); diff --git a/activemq-core/src/test/java/org/apache/activemq/test/TestSupport.java b/activemq-core/src/test/java/org/apache/activemq/test/TestSupport.java index 65a000e3ad..9d6110a642 100755 --- a/activemq-core/src/test/java/org/apache/activemq/test/TestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/TestSupport.java @@ -39,7 +39,8 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.4 $ */ public abstract class TestSupport extends TestCase { - final static protected Log log = LogFactory.getLog(TestSupport.class); + private static final Log LOG = LogFactory.getLog(TestSupport.class); + protected ActiveMQConnectionFactory connectionFactory; protected boolean topic = true; diff --git a/activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapAndListPropertyTest.java b/activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapAndListPropertyTest.java index ddd5ee72da..5fbd1add39 100644 --- a/activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapAndListPropertyTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapAndListPropertyTest.java @@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory; */ public class NestedMapAndListPropertyTest extends JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest { - private static final Log log = LogFactory.getLog(NestedMapAndListPropertyTest.class); + private static final Log LOG = LogFactory.getLog(NestedMapAndListPropertyTest.class); protected void assertMessageValid(int index, Message message) throws JMSException { Object value = message.getObjectProperty("textField"); @@ -55,13 +55,13 @@ public class NestedMapAndListPropertyTest extends JmsTopicSendReceiveWithTwoConn value = map.get("y"); assertTrue("mapField.d.y is a List", value instanceof List); List list = (List) value; - log.debug("mapField.d.y: " + list); + LOG.debug("mapField.d.y: " + list); assertEquals("listField.size", 3, list.size()); - log.debug("Found map: " + map); + LOG.debug("Found map: " + map); list = (List) message.getObjectProperty("listField"); - log.debug("listField: " + list); + LOG.debug("listField: " + list); assertEquals("listField.size", 3, list.size()); assertEquals("listField[0]", "a", list.get(0)); assertEquals("listField[1]", "b", list.get(1)); diff --git a/activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java index 166e916aeb..4a58b6f2e9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java @@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory; */ public class NestedMapMessageTest extends JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest { - private static final Log log = LogFactory.getLog(NestedMapMessageTest.class); + private static final Log LOG = LogFactory.getLog(NestedMapMessageTest.class); protected void assertMessageValid(int index, Message message) throws JMSException { assertTrue("Should be a MapMessage: " + message, message instanceof MapMessage); @@ -59,13 +59,13 @@ public class NestedMapMessageTest extends JmsTopicSendReceiveWithTwoConnectionsA value = map.get("y"); assertTrue("mapField.d.y is a List", value instanceof List); List list = (List) value; - log.debug("mapField.d.y: " + list); + LOG.debug("mapField.d.y: " + list); assertEquals("listField.size", 3, list.size()); - log.debug("Found map: " + map); + LOG.debug("Found map: " + map); list = (List) mapMessage.getObject("listField"); - log.debug("listField: " + list); + LOG.debug("listField: " + list); assertEquals("listField.size", 3, list.size()); assertEquals("listField[0]", "a", list.get(0)); assertEquals("listField[1]", "b", list.get(1)); diff --git a/activemq-core/src/test/java/org/apache/activemq/test/retroactive/DummyMessageQuery.java b/activemq-core/src/test/java/org/apache/activemq/test/retroactive/DummyMessageQuery.java index a05ea6ebd3..4c12ee1cbd 100644 --- a/activemq-core/src/test/java/org/apache/activemq/test/retroactive/DummyMessageQuery.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/retroactive/DummyMessageQuery.java @@ -31,13 +31,13 @@ import org.apache.commons.logging.LogFactory; */ public class DummyMessageQuery implements MessageQuery { - protected static final Log log = LogFactory.getLog(DummyMessageQuery.class); + private static final Log LOG = LogFactory.getLog(DummyMessageQuery.class); - public static final int messageCount = 10; + public static final int MESSAGE_COUNT = 10; public void execute(ActiveMQDestination destination, MessageListener listener) throws Exception { - log.info("Initial query is creating: " + messageCount + " messages"); - for (int i = 0; i < messageCount; i++) { + LOG.info("Initial query is creating: " + MESSAGE_COUNT + " messages"); + for (int i = 0; i < MESSAGE_COUNT; i++) { ActiveMQTextMessage message = new ActiveMQTextMessage(); message.setText("Initial message: " + i + " loaded from query"); listener.onMessage(message); diff --git a/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java b/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java index 02087db788..2c9b16c0f9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java @@ -31,12 +31,17 @@ import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.EmbeddedBrokerTestSupport; import org.apache.activemq.broker.BrokerFactory; import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.test.TemporaryDestinationToFromNameTest; import org.apache.activemq.util.MessageIdList; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision: 1.1 $ */ public class RetroactiveConsumerTestWithSimpleMessageListTest extends EmbeddedBrokerTestSupport { + private static final Log LOG = LogFactory.getLog(RetroactiveConsumerTestWithSimpleMessageListTest.class); + protected int messageCount = 20; protected Connection connection; protected Session session; diff --git a/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerWithMessageQueryTest.java b/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerWithMessageQueryTest.java index 9a0ed676a0..19b49321a7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerWithMessageQueryTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerWithMessageQueryTest.java @@ -30,12 +30,17 @@ import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.EmbeddedBrokerTestSupport; import org.apache.activemq.broker.BrokerFactory; import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.usecases.CreateLotsOfTemporaryQueuesTest; import org.apache.activemq.util.MessageIdList; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision$ */ public class RetroactiveConsumerWithMessageQueryTest extends EmbeddedBrokerTestSupport { + private static final Log LOG = LogFactory.getLog(RetroactiveConsumerWithMessageQueryTest.class); + protected int messageCount = 20; protected Connection connection; protected Session session; @@ -53,7 +58,7 @@ public class RetroactiveConsumerWithMessageQueryTest extends EmbeddedBrokerTestS consumer.setMessageListener(listener); MessageProducer producer = session.createProducer(destination); - int updateMessageCount = messageCount - DummyMessageQuery.messageCount; + int updateMessageCount = messageCount - DummyMessageQuery.MESSAGE_COUNT; for (int i = 0; i < updateMessageCount; i++) { TextMessage message = session.createTextMessage("Update Message: " + i + " sent at: " + new Date()); producer.send(message); diff --git a/activemq-core/src/test/java/org/apache/activemq/test/rollback/DelegatingTransactionalMessageListener.java b/activemq-core/src/test/java/org/apache/activemq/test/rollback/DelegatingTransactionalMessageListener.java index 0e7e9b9da6..c563923b46 100644 --- a/activemq-core/src/test/java/org/apache/activemq/test/rollback/DelegatingTransactionalMessageListener.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/rollback/DelegatingTransactionalMessageListener.java @@ -28,7 +28,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class DelegatingTransactionalMessageListener implements MessageListener { - private static final transient Log log = LogFactory.getLog(DelegatingTransactionalMessageListener.class); + private static final transient Log LOG = LogFactory.getLog(DelegatingTransactionalMessageListener.class); private final MessageListener underlyingListener; private boolean transacted = true; @@ -60,7 +60,7 @@ public class DelegatingTransactionalMessageListener implements MessageListener { try { session.rollback(); } catch (JMSException e) { - log.error("Failed to rollback: " + e, e); + LOG.error("Failed to rollback: " + e, e); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/test/rollback/RollbacksWhileConsumingLargeQueueTest.java b/activemq-core/src/test/java/org/apache/activemq/test/rollback/RollbacksWhileConsumingLargeQueueTest.java index 05c211f296..f2f88e7413 100644 --- a/activemq-core/src/test/java/org/apache/activemq/test/rollback/RollbacksWhileConsumingLargeQueueTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/rollback/RollbacksWhileConsumingLargeQueueTest.java @@ -38,7 +38,7 @@ import org.springframework.jms.core.MessageCreator; */ public class RollbacksWhileConsumingLargeQueueTest extends EmbeddedBrokerTestSupport implements MessageListener { - private static final transient Log log = LogFactory.getLog(RollbacksWhileConsumingLargeQueueTest.class); + private static final transient Log LOG = LogFactory.getLog(RollbacksWhileConsumingLargeQueueTest.class); protected int numberOfMessagesOnQueue = 6500; private Connection connection; @@ -59,12 +59,14 @@ public class RollbacksWhileConsumingLargeQueueTest extends EmbeddedBrokerTestSup } // Are we done receiving all the messages. - if (ackCounter.get() == numberOfMessagesOnQueue) + if (ackCounter.get() == numberOfMessagesOnQueue) { return; + } Message message = consumer.receive(1000); - if (message == null) + if (message == null) { continue; + } try { onMessage(message); @@ -89,7 +91,7 @@ public class RollbacksWhileConsumingLargeQueueTest extends EmbeddedBrokerTestSup } if (latch.await(1, TimeUnit.SECONDS)) { - log.debug("Received: " + deliveryCounter.get() + " message(s)"); + LOG.debug("Received: " + deliveryCounter.get() + " message(s)"); return; } @@ -147,11 +149,11 @@ public class RollbacksWhileConsumingLargeQueueTest extends EmbeddedBrokerTestSup int value = deliveryCounter.incrementAndGet(); if (value % 2 == 0) { - log.info("Rolling Back message: " + ackCounter.get() + " id: " + msgId + ", content: " + msgText); + LOG.info("Rolling Back message: " + ackCounter.get() + " id: " + msgId + ", content: " + msgText); throw new RuntimeException("Dummy exception on message: " + value); } - log.info("Received message: " + ackCounter.get() + " id: " + msgId + ", content: " + msgText); + LOG.info("Received message: " + ackCounter.get() + " id: " + msgId + ", content: " + msgText); ackCounter.incrementAndGet(); latch.countDown(); } diff --git a/activemq-core/src/test/java/org/apache/activemq/thread/TaskRunnerTest.java b/activemq-core/src/test/java/org/apache/activemq/thread/TaskRunnerTest.java index e30d35e7db..af1c8cd9ce 100755 --- a/activemq-core/src/test/java/org/apache/activemq/thread/TaskRunnerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/thread/TaskRunnerTest.java @@ -22,11 +22,14 @@ import java.util.concurrent.CyclicBarrier; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.activemq.transport.TopicClusterTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import junit.framework.TestCase; public class TaskRunnerTest extends TestCase { - - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(TaskRunnerTest.class); + private static final Log LOG = LogFactory.getLog(TaskRunnerTest.class); public void testWakeupPooled() throws InterruptedException, BrokenBarrierException { System.setProperty("org.apache.activemq.UseDedicatedTaskRunner", "false"); @@ -47,11 +50,11 @@ public class TaskRunnerTest extends TestCase { */ public void doTestWakeup() throws InterruptedException, BrokenBarrierException { + final int enqueueCount = 100000; final AtomicInteger iterations = new AtomicInteger(0); final AtomicInteger counter = new AtomicInteger(0); final AtomicInteger queue = new AtomicInteger(0); final CountDownLatch doneCountDownLatch = new CountDownLatch(1); - final int ENQUEUE_COUNT = 100000; TaskRunnerFactory factory = new TaskRunnerFactory(); final TaskRunner runner = factory.createTaskRunner(new Task() { @@ -64,22 +67,23 @@ public class TaskRunnerTest extends TestCase { counter.incrementAndGet(); } iterations.incrementAndGet(); - if (counter.get() == ENQUEUE_COUNT) + if (counter.get() == enqueueCount) { doneCountDownLatch.countDown(); + } return true; } } }, "Thread Name"); long start = System.currentTimeMillis(); - final int WORKER_COUNT = 5; - final CyclicBarrier barrier = new CyclicBarrier(WORKER_COUNT + 1); - for (int i = 0; i < WORKER_COUNT; i++) { + final int workerCount = 5; + final CyclicBarrier barrier = new CyclicBarrier(workerCount + 1); + for (int i = 0; i < workerCount; i++) { new Thread() { public void run() { try { barrier.await(); - for (int i = 0; i < ENQUEUE_COUNT / WORKER_COUNT; i++) { + for (int i = 0; i < enqueueCount / workerCount; i++) { queue.incrementAndGet(); runner.wakeup(); yield(); @@ -94,10 +98,10 @@ public class TaskRunnerTest extends TestCase { boolean b = doneCountDownLatch.await(30, TimeUnit.SECONDS); long end = System.currentTimeMillis(); - log.info("Iterations: " + iterations.get()); - log.info("counter: " + counter.get()); - log.info("Dequeues/s: " + (1000.0 * ENQUEUE_COUNT / (end - start))); - log.info("duration: " + ((end - start) / 1000.0)); + LOG.info("Iterations: " + iterations.get()); + LOG.info("counter: " + counter.get()); + LOG.info("Dequeues/s: " + (1000.0 * enqueueCount / (end - start))); + LOG.info("duration: " + ((end - start) / 1000.0)); assertTrue(b); runner.shutdown(); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java index d1bbac5d1b..a39e9c7286 100755 --- a/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java @@ -48,12 +48,14 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class TopicClusterTest extends TestCase implements MessageListener { - protected final static Log log = LogFactory.getLog(TopicClusterTest.class); + + private static final Log LOG = LogFactory.getLog(TopicClusterTest.class); + protected static final int MESSAGE_COUNT = 50; + protected static final int NUMBER_IN_CLUSTER = 3; + protected Destination destination; protected boolean topic = true; protected AtomicInteger receivedMessageCount = new AtomicInteger(0); - protected static final int MESSAGE_COUNT = 50; - protected static final int NUMBER_IN_CLUSTER = 3; protected int deliveryMode = DeliveryMode.NON_PERSISTENT; protected MessageProducer[] producers; protected Connection[] connections; @@ -82,7 +84,7 @@ public class TopicClusterTest extends TestCase implements MessageListener { consumer.setMessageListener(this); } - log.info("Sleeping to ensure cluster is fully connected"); + LOG.info("Sleeping to ensure cluster is fully connected"); Thread.sleep(5000); } finally { System.setProperty("activemq.store.dir", root); @@ -169,7 +171,7 @@ public class TopicClusterTest extends TestCase implements MessageListener { } // sleep a little - to check we don't get too many messages Thread.sleep(2000); - log.info("GOT: " + receivedMessageCount.get()); + LOG.info("GOT: " + receivedMessageCount.get()); assertEquals("Expected message count not correct", expectedReceiveCount(), receivedMessageCount.get()); } diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java index b85165e6cf..d2c4b6845f 100755 --- a/activemq-core/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java @@ -26,7 +26,7 @@ import org.apache.activemq.broker.BrokerTest; import org.apache.activemq.broker.StubConnection; import org.apache.activemq.broker.TransportConnector; -abstract public class TransportBrokerTestSupport extends BrokerTest { +public abstract class TransportBrokerTestSupport extends BrokerTest { private TransportConnector connector; ArrayList connections = new ArrayList(); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportBrokerTest.java index 80d18b3341..9142dedfdf 100755 --- a/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportBrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportBrokerTest.java @@ -41,7 +41,7 @@ import org.apache.commons.logging.LogFactory; public class DiscoveryTransportBrokerTest extends NetworkTestSupport { - static final private Log log = LogFactory.getLog(DiscoveryTransportBrokerTest.class); + private static final Log LOG = LogFactory.getLog(DiscoveryTransportBrokerTest.class); public void setUp() throws Exception { super.setAutoFail(true); @@ -103,10 +103,10 @@ public class DiscoveryTransportBrokerTest extends NetworkTestSupport { assertNoMessagesLeft(connectionB); // Dispose the server so that it fails over to the other server. - log.info("Disconnecting active server"); + LOG.info("Disconnecting active server"); serverA.stop(); - log.info("Sending request that should failover"); + LOG.info("Sending request that should failover"); connection3.request(createMessage(producerInfo3, destination, deliveryMode)); assertNotNull(receiveMessage(connectionB)); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/failover/BadConnectionTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/failover/BadConnectionTest.java index e61e84cfb5..e1cf048234 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/failover/BadConnectionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/failover/BadConnectionTest.java @@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory; */ public class BadConnectionTest extends TestCase { - protected static final Log log = LogFactory.getLog(BadConnectionTest.class); + private static final Log LOG = LogFactory.getLog(BadConnectionTest.class); protected Transport transport; @@ -41,7 +41,7 @@ public class BadConnectionTest extends TestCase { transport.asyncRequest(new ActiveMQMessage(), null); fail("This should never succeed"); } catch (IOException e) { - log.info("Caught expected exception: " + e, e); + LOG.info("Caught expected exception: " + e, e); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerTest.java index f6ff0abf44..fc2858d91d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerTest.java @@ -28,13 +28,14 @@ import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQPrefetchPolicy; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.network.NetworkTestSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public class FailoverConsumerTest extends NetworkTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory - .getLog(FailoverConsumerTest.class); - public static final int MSG_COUNT = 100; + private static final Log LOG = LogFactory.getLog(FailoverConsumerTest.class); + public void testPublisherFailsOver() throws Exception { // Uncomment this if you want to use remote broker created by @@ -70,7 +71,7 @@ public class FailoverConsumerTest extends NetworkTestSupport { // after restart, javadoc says, that messages should be received // though). // So we must use external broker ant restart it manually. - log.info("You should restart remote broker now and press enter!"); + LOG.info("You should restart remote broker now and press enter!"); System.in.read(); // Thread.sleep(20000); restartRemoteBroker(); @@ -80,7 +81,7 @@ public class FailoverConsumerTest extends NetworkTestSupport { for (int idx = 1; idx < MSG_COUNT; ++idx) { msg = consumer.receive(3000); if (msg == null) { - log.error("No messages received! Received:" + count); + LOG.error("No messages received! Received:" + count); break; } msg.acknowledge(); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java index db1297bd1b..9cf77cc23d 100755 --- a/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java @@ -33,10 +33,13 @@ import org.apache.activemq.command.SessionInfo; import org.apache.activemq.network.NetworkTestSupport; import org.apache.activemq.transport.Transport; import org.apache.activemq.transport.TransportFactory; +import org.apache.activemq.transport.multicast.MulticastTransportTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public class FailoverTransportBrokerTest extends NetworkTestSupport { - private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(FailoverTransportBrokerTest.class); + private static final Log LOG = LogFactory.getLog(FailoverTransportBrokerTest.class); public ActiveMQDestination destination; public int deliveryMode; @@ -67,7 +70,7 @@ public class FailoverTransportBrokerTest extends NetworkTestSupport { connection2.request(consumerInfo2); // Start a failover publisher. - log.info("Starting the failover connection."); + LOG.info("Starting the failover connection."); StubConnection connection3 = createFailoverConnection(); ConnectionInfo connectionInfo3 = createConnectionInfo(); SessionInfo sessionInfo3 = createSessionInfo(connectionInfo3); @@ -100,7 +103,7 @@ public class FailoverTransportBrokerTest extends NetworkTestSupport { assertNoMessagesLeft(connectionB); // Dispose the server so that it fails over to the other server. - log.info("Disconnecting the active connection"); + LOG.info("Disconnecting the active connection"); serverA.stop(); connection3.request(createMessage(producerInfo3, destination, deliveryMode)); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/failover/ReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/failover/ReconnectTest.java index b6b919cce5..662a0182a4 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/failover/ReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/failover/ReconnectTest.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -48,10 +48,11 @@ import org.apache.commons.logging.LogFactory; */ public class ReconnectTest extends TestCase { - protected static final Log log = LogFactory.getLog(ReconnectTest.class); - public static final int MESSAGES_PER_ITTERATION = 10; public static final int WORKER_COUNT = 10; + + private static final Log LOG = LogFactory.getLog(ReconnectTest.class); + private BrokerService bs; private URI tcpUri; private AtomicInteger interruptedCount = new AtomicInteger(); @@ -161,20 +162,20 @@ public class ReconnectTest extends TestCase { for (int k = 1; k < 5; k++) { - log.info("Test run: " + k); + LOG.info("Test run: " + k); // Wait for at least one iteration to occur... for (int i = 0; i < WORKER_COUNT; i++) { for (int j = 0; workers[i].iterations.get() == 0 && j < 5; j++) { workers[i].assertNoErrors(); - log.info("Waiting for worker " + i + " to finish an iteration."); + LOG.info("Waiting for worker " + i + " to finish an iteration."); Thread.sleep(1000); } assertTrue("Worker " + i + " never completed an interation.", workers[i].iterations.get() != 0); workers[i].assertNoErrors(); } - log.info("Simulating transport error to cause reconnect."); + LOG.info("Simulating transport error to cause reconnect."); // Simulate a transport failure. for (int i = 0; i < WORKER_COUNT; i++) { @@ -183,12 +184,12 @@ public class ReconnectTest extends TestCase { // Wait for the connections to get interrupted... while (interruptedCount.get() < WORKER_COUNT) { - log.info("Waiting for connections to get interrupted.. at: " + interruptedCount.get()); + LOG.info("Waiting for connections to get interrupted.. at: " + interruptedCount.get()); Thread.sleep(1000); } // let things stablize.. - log.info("Pausing before starting next iterations..."); + LOG.info("Pausing before starting next iterations..."); Thread.sleep(1000); // Reset the counters.. diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java index 26f84e28ec..9e0e990f61 100755 --- a/activemq-core/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; public class FanoutTransportBrokerTest extends NetworkTestSupport { - private static final Log log = LogFactory.getLog(FanoutTransportBrokerTest.class); + private static final Log LOG = LogFactory.getLog(FanoutTransportBrokerTest.class); public ActiveMQDestination destination; public int deliveryMode; @@ -83,7 +83,7 @@ public class FanoutTransportBrokerTest extends NetworkTestSupport { connection2.request(consumerInfo2); // Start a fanout publisher. - log.info("Starting the fanout connection."); + LOG.info("Starting the fanout connection."); StubConnection connection3 = createFanoutConnection(); ConnectionInfo connectionInfo3 = createConnectionInfo(); SessionInfo sessionInfo3 = createSessionInfo(connectionInfo3); @@ -129,7 +129,7 @@ public class FanoutTransportBrokerTest extends NetworkTestSupport { connection2.request(consumerInfo2); // Start a fanout publisher. - log.info("Starting the fanout connection."); + LOG.info("Starting the fanout connection."); final StubConnection connection3 = createFanoutConnection(); ConnectionInfo connectionInfo3 = createConnectionInfo(); SessionInfo sessionInfo3 = createSessionInfo(connectionInfo3); @@ -154,7 +154,7 @@ public class FanoutTransportBrokerTest extends NetworkTestSupport { MockTransport mt = (MockTransport)connection3.getTransport().narrow(MockTransport.class); mt.install(new TransportFilter(mt.getNext()) { public void oneway(Object command) throws IOException { - log.info("Dropping: " + command); + LOG.info("Dropping: " + command); // just eat it! to simulate a recent failure. } }); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/multicast/MulticastTransportTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/multicast/MulticastTransportTest.java index 97719edc57..ee75f2cddf 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/multicast/MulticastTransportTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/multicast/MulticastTransportTest.java @@ -32,13 +32,13 @@ import org.apache.commons.logging.LogFactory; */ public class MulticastTransportTest extends UdpTransportTest { - protected static final Log log = LogFactory.getLog(MulticastTransportTest.class); + private static final Log LOG = LogFactory.getLog(MulticastTransportTest.class); private String multicastURI = "multicast://224.1.2.3:6255"; protected Transport createProducer() throws Exception { - log.info("Producer using URI: " + multicastURI); + LOG.info("Producer using URI: " + multicastURI); // we are not using the TransportFactory as this assumes that // transports talk to a server using a WireFormat Negotiation step diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/DropCommandStrategy.java b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/DropCommandStrategy.java index a950620a8b..d7d0ce0cb3 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/DropCommandStrategy.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/DropCommandStrategy.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/ReliableTransportTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/ReliableTransportTest.java index 12ce0cd7c1..43ae179895 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/ReliableTransportTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/ReliableTransportTest.java @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; */ public class ReliableTransportTest extends TestCase { - protected static final Log log = LogFactory.getLog(ReliableTransportTest.class); + private static final Log LOG = LogFactory.getLog(ReliableTransportTest.class); protected ReliableTransport transport; protected StubTransportListener listener = new StubTransportListener(); @@ -49,7 +49,7 @@ public class ReliableTransportTest extends TestCase { transport.setExpectedCounter(value); for (int i = 0; i < 10; i++) { - log.info("command: " + i + " = " + value); + LOG.info("command: " + i + " = " + value); sequenceNumbers[i] = value++; } @@ -117,7 +117,7 @@ public class ReliableTransportTest extends TestCase { } else { assertTrue("Should have received an exception!", exceptions.size() > 0); Exception e = (Exception)exceptions.remove(); - log.info("Caught expected response: " + e); + LOG.info("Caught expected response: " + e); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableCommandDatagramChannel.java b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableCommandDatagramChannel.java index 06c6b4b814..15c5f23940 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableCommandDatagramChannel.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableCommandDatagramChannel.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -34,7 +34,7 @@ import org.apache.commons.logging.LogFactory; */ public class UnreliableCommandDatagramChannel extends CommandDatagramChannel { - private static final Log log = LogFactory.getLog(UnreliableCommandDatagramChannel.class); + private static final Log LOG = LogFactory.getLog(UnreliableCommandDatagramChannel.class); private DropCommandStrategy dropCommandStrategy; @@ -48,7 +48,7 @@ public class UnreliableCommandDatagramChannel extends CommandDatagramChannel { protected void sendWriteBuffer(int commandId, SocketAddress address, ByteBuffer writeBuffer, boolean redelivery) throws IOException { if (dropCommandStrategy.shouldDropCommand(commandId, address, redelivery)) { writeBuffer.flip(); - log.info("Dropping datagram with command: " + commandId); + LOG.info("Dropping datagram with command: " + commandId); // lets still add it to the replay buffer though! getReplayBuffer().addBuffer(commandId, writeBuffer); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableCommandDatagramSocket.java b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableCommandDatagramSocket.java index 4fecadd482..ac23443ba7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableCommandDatagramSocket.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableCommandDatagramSocket.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -31,7 +31,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: $ */ public class UnreliableCommandDatagramSocket extends CommandDatagramSocket { - private static final Log log = LogFactory.getLog(UnreliableCommandDatagramSocket.class); + private static final Log LOG = LogFactory.getLog(UnreliableCommandDatagramSocket.class); private DropCommandStrategy dropCommandStrategy; @@ -43,7 +43,7 @@ public class UnreliableCommandDatagramSocket extends CommandDatagramSocket { protected void sendWriteBuffer(int commandId, SocketAddress address, byte[] data, boolean redelivery) throws IOException { if (dropCommandStrategy.shouldDropCommand(commandId, address, redelivery)) { - log.info("Dropping datagram with command: " + commandId); + LOG.info("Dropping datagram with command: " + commandId); // lets still add it to the replay buffer though! ReplayBuffer bufferCache = getReplayBuffer(); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableUdpTransport.java b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableUdpTransport.java index 755eb454a2..a1aa4f7a04 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableUdpTransport.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableUdpTransport.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableUdpTransportTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableUdpTransportTest.java index 148920e0ec..fdc513a352 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableUdpTransportTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/reliable/UnreliableUdpTransportTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -20,17 +20,21 @@ import java.net.SocketAddress; import java.net.URI; import org.apache.activemq.openwire.OpenWireFormat; +import org.apache.activemq.test.JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest; import org.apache.activemq.transport.CommandJoiner; import org.apache.activemq.transport.Transport; import org.apache.activemq.transport.udp.ResponseRedirectInterceptor; import org.apache.activemq.transport.udp.UdpTransport; import org.apache.activemq.transport.udp.UdpTransportTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * * @version $Revision: $ */ public class UnreliableUdpTransportTest extends UdpTransportTest { + private static final Log LOG = LogFactory.getLog(UnreliableUdpTransportTest.class); protected DropCommandStrategy dropStrategy = new DropCommandStrategy() { @@ -43,7 +47,7 @@ public class UnreliableUdpTransportTest extends UdpTransportTest { }; protected Transport createProducer() throws Exception { - log.info("Producer using URI: " + producerURI); + LOG.info("Producer using URI: " + producerURI); OpenWireFormat wireFormat = createWireFormat(); UnreliableUdpTransport transport = new UnreliableUdpTransport(wireFormat, new URI(producerURI)); @@ -57,7 +61,7 @@ public class UnreliableUdpTransportTest extends UdpTransportTest { } protected Transport createConsumer() throws Exception { - log.info("Consumer on port: " + consumerPort); + LOG.info("Consumer on port: " + consumerPort); OpenWireFormat wireFormat = createWireFormat(); UdpTransport transport = new UdpTransport(wireFormat, consumerPort); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java index 7c0a8c99d7..dbc6956a7d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java @@ -38,7 +38,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class StompSubscriptionRemoveTest extends TestCase { - private static final Log log = LogFactory.getLog(StompSubscriptionRemoveTest.class); + private static final Log LOG = LogFactory.getLog(StompSubscriptionRemoveTest.class); private static final String COMMAND_MESSAGE = "MESSAGE"; private static final String HEADER_MESSAGE_ID = "message-id"; private static final int STOMP_PORT = 61613; @@ -60,7 +60,7 @@ public class StompSubscriptionRemoveTest extends TestCase { Message message = session.createTextMessage("Testas"); for (int idx = 0; idx < 2000; ++idx) { producer.send(message); - log.debug("Sending: " + idx); + LOG.debug("Sending: " + idx); } producer.close(); session.close(); @@ -68,8 +68,8 @@ public class StompSubscriptionRemoveTest extends TestCase { stompConnection.open("localhost", STOMP_PORT); - String connect_frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n"; - stompConnection.sendFrame(connect_frame); + String connectFrame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n"; + stompConnection.sendFrame(connectFrame); stompConnection.receiveFrame(); String frame = "SUBSCRIBE\n" + "destination:/queue/" + getDestinationName() + "\n" + "ack:client\n\n"; @@ -79,7 +79,7 @@ public class StompSubscriptionRemoveTest extends TestCase { int count = 0; while (count < 2) { String receiveFrame = stompConnection.receiveFrame(); - log.debug("Received: " + receiveFrame); + LOG.debug("Received: " + receiveFrame); assertEquals("Unexpected frame received", COMMAND_MESSAGE, getCommand(receiveFrame)); String messageId = getHeaderValue(receiveFrame, HEADER_MESSAGE_ID); String ackmessage = "ACK\n" + HEADER_MESSAGE_ID + ":" + messageId + "\n\n"; @@ -95,8 +95,8 @@ public class StompSubscriptionRemoveTest extends TestCase { stompConnection.open("localhost", STOMP_PORT); - connect_frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n"; - stompConnection.sendFrame(connect_frame); + connectFrame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n"; + stompConnection.sendFrame(connectFrame); stompConnection.receiveFrame(); @@ -105,7 +105,7 @@ public class StompSubscriptionRemoveTest extends TestCase { try { while (count != 2000) { String receiveFrame = stompConnection.receiveFrame(); - log.debug("Received: " + receiveFrame); + LOG.debug("Received: " + receiveFrame); assertEquals("Unexpected frame received", COMMAND_MESSAGE, getCommand(receiveFrame)); String messageId = getHeaderValue(receiveFrame, HEADER_MESSAGE_ID); String ackmessage = "ACK\n" + HEADER_MESSAGE_ID + ":" + messageId.trim() + "\n\n"; @@ -122,7 +122,7 @@ public class StompSubscriptionRemoveTest extends TestCase { stompConnection.close(); broker.stop(); - log.info("Total messages received: " + messagesCount); + LOG.info("Total messages received: " + messagesCount); assertTrue("Messages received after connection loss: " + messagesCount, messagesCount >= 2000); // The first ack messages has no chance complete, so we receiving more diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java index 165e3a3067..2ef7b4cca7 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java @@ -37,8 +37,12 @@ import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.TransportConnector; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQTextMessage; +import org.apache.activemq.transport.reliable.UnreliableUdpTransportTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public class StompTest extends CombinationTestSupport { + private static final Log LOG = LogFactory.getLog(StompTest.class); private BrokerService broker; private TransportConnector connector; @@ -99,8 +103,8 @@ public class StompTest extends CombinationTestSupport { public void testConnect() throws Exception { - String connect_frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "request-id: 1\n" + "\n" + Stomp.NULL; - stompConnection.sendFrame(connect_frame); + String connectFrame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "request-id: 1\n" + "\n" + Stomp.NULL; + stompConnection.sendFrame(connectFrame); String f = stompConnection.receiveFrame(); assertTrue(f.startsWith("CONNECTED")); @@ -239,9 +243,9 @@ public class StompTest extends CombinationTestSupport { assertTrue(frame.startsWith("MESSAGE")); Pattern cl = Pattern.compile("Content-length:\\s*(\\d+)", Pattern.CASE_INSENSITIVE); - Matcher cl_matcher = cl.matcher(frame); - assertTrue(cl_matcher.find()); - assertEquals("5", cl_matcher.group(1)); + Matcher clMmatcher = cl.matcher(frame); + assertTrue(clMmatcher.find()); + assertEquals("5", clMmatcher.group(1)); assertFalse(Pattern.compile("type:\\s*null", Pattern.CASE_INSENSITIVE).matcher(frame).find()); @@ -396,7 +400,7 @@ public class StompTest extends CombinationTestSupport { try { frame = stompConnection.receiveFrame(); - log.info("Received frame: " + frame); + LOG.info("Received frame: " + frame); fail("No message should have been received since subscription was removed"); } catch (SocketTimeoutException e) { diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java index eabf69850b..4b8a62225f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -6,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -32,8 +32,12 @@ import org.apache.activemq.transport.TransportAcceptListener; import org.apache.activemq.transport.TransportFactory; import org.apache.activemq.transport.TransportListener; import org.apache.activemq.transport.TransportServer; +import org.apache.activemq.transport.stomp.StompTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public class InactivityMonitorTest extends CombinationTestSupport implements TransportAcceptListener { + private static final Log LOG = LogFactory.getLog(InactivityMonitorTest.class); private TransportServer server; private Transport clientTransport; @@ -71,7 +75,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra public void onException(IOException error) { if (!ignoreClientError.get()) { - log.info("Client transport error:"); + LOG.info("Client transport error:"); error.printStackTrace(); clientErrorCount.incrementAndGet(); } @@ -101,12 +105,15 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra ignoreClientError.set(true); ignoreServerError.set(true); try { - if (clientTransport != null) + if (clientTransport != null) { clientTransport.stop(); - if (serverTransport != null) + } + if (serverTransport != null) { serverTransport.stop(); - if (server != null) + } + if (server != null) { server.stop(); + } } catch (Throwable e) { e.printStackTrace(); } @@ -115,7 +122,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra public void onAccept(Transport transport) { try { - log.info("[" + getName() + "] Server Accepted a Connection"); + LOG.info("[" + getName() + "] Server Accepted a Connection"); serverTransport = transport; serverTransport.setTransportListener(new TransportListener() { public void onCommand(Object command) { @@ -127,7 +134,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra public void onException(IOException error) { if (!ignoreClientError.get()) { - log.info("Server transport error:"); + LOG.info("Server transport error:"); error.printStackTrace(); serverErrorCount.incrementAndGet(); } @@ -166,7 +173,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra public void onException(IOException error) { if (!ignoreClientError.get()) { - log.info("Client transport error:"); + LOG.info("Client transport error:"); error.printStackTrace(); clientErrorCount.incrementAndGet(); } @@ -222,7 +229,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra addCombinationValues("serverRunOnCommand", new Object[] {new Runnable() { public void run() { try { - log.info("Sleeping"); + LOG.info("Sleeping"); Thread.sleep(4000); } catch (InterruptedException e) { } diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportBrokerTest.java index dc39173de1..c7f087d164 100755 --- a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportBrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportBrokerTest.java @@ -35,7 +35,7 @@ public class SslTransportBrokerTest extends TransportBrokerTestSupport { System.setProperty("javax.net.ssl.keyStoreType", "jks"); //System.setProperty("javax.net.debug", "ssl,handshake,data,trustmanager"); - MAX_WAIT = 10000; + maxWait = 10000; super.setUp(); } diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java index e812605009..e1dfe1acc5 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java @@ -28,7 +28,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class SslTransportFactoryTest extends TestCase { - private static final transient Log log = LogFactory.getLog(SslTransportFactoryTest.class); + private static final Log LOG = LogFactory.getLog(SslTransportFactoryTest.class); private SslTransportFactory factory; private boolean verbose; @@ -111,11 +111,11 @@ public class SslTransportFactoryTest extends TestCase { } if (verbose) { - log.info(""); - log.info("Iteration: " + i); - log.info("Map settings: " + options); + LOG.info(""); + LOG.info("Iteration: " + i); + LOG.info("Map settings: " + options); for (int x = 0; x < optionSettings.length; x++) { - log.info("optionSetting[" + x + "] = " + optionSettings[x]); + LOG.info("optionSetting[" + x + "] = " + optionSettings[x]); } } @@ -129,7 +129,7 @@ public class SslTransportFactoryTest extends TestCase { } if (socketStub.getWantClientAuthStatus() != optionSettings[2]) { - log.info("sheiite"); + LOG.info("sheiite"); } assertEquals("wantClientAuth was not properly set for iteration: " + i, optionSettings[0], diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/StubSSLSession.java b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/StubSSLSession.java index a68b3b3b75..7c0a70b071 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/StubSSLSession.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/StubSSLSession.java @@ -45,10 +45,11 @@ class StubSSLSession implements SSLSession { } public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException { - if (this.isVerified) + if (this.isVerified) { return new X509Certificate[] {this.cert}; - else + } else { throw new SSLPeerUnverifiedException("Socket is unverified."); + } } // --- Stubbed methods --- diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TcpTransportBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TcpTransportBrokerTest.java index 1dca333e9b..9ce2e8bbcb 100755 --- a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TcpTransportBrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TcpTransportBrokerTest.java @@ -26,7 +26,7 @@ public class TcpTransportBrokerTest extends TransportBrokerTestSupport { } protected void setUp() throws Exception { - MAX_WAIT = 2000; + maxWait = 2000; super.setUp(); } diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TransportUriTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TransportUriTest.java index 1bd1f22421..ecc2d87c00 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TransportUriTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TransportUriTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java index 01869680e2..5496b8a557 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -6,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -32,8 +32,11 @@ import org.apache.activemq.transport.TransportAcceptListener; import org.apache.activemq.transport.TransportFactory; import org.apache.activemq.transport.TransportListener; import org.apache.activemq.transport.TransportServer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public class WireformatNegociationTest extends CombinationTestSupport { + private static final Log LOG = LogFactory.getLog(WireformatNegociationTest.class); private TransportServer server; private Transport clientTransport; @@ -66,7 +69,7 @@ public class WireformatNegociationTest extends CombinationTestSupport { public void onException(IOException error) { if (!ignoreAsycError.get()) { - log.info("Client transport error: ", error); + LOG.info("Client transport error: ", error); asyncError.set(error); negociationCounter.countDown(); } @@ -91,7 +94,7 @@ public class WireformatNegociationTest extends CombinationTestSupport { server.setAcceptListener(new TransportAcceptListener() { public void onAccept(Transport transport) { try { - log.info("[" + getName() + "] Server Accepted a Connection"); + LOG.info("[" + getName() + "] Server Accepted a Connection"); serverTransport = transport; serverTransport.setTransportListener(new TransportListener() { public void onCommand(Object command) { @@ -103,7 +106,7 @@ public class WireformatNegociationTest extends CombinationTestSupport { public void onException(IOException error) { if (!ignoreAsycError.get()) { - log.info("Server transport error: ", error); + LOG.info("Server transport error: ", error); asyncError.set(error); negociationCounter.countDown(); } @@ -131,12 +134,15 @@ public class WireformatNegociationTest extends CombinationTestSupport { protected void tearDown() throws Exception { ignoreAsycError.set(true); try { - if (clientTransport != null) + if (clientTransport != null) { clientTransport.stop(); - if (serverTransport != null) + } + if (serverTransport != null) { serverTransport.stop(); - if (server != null) + } + if (server != null) { server.stop(); + } } catch (Throwable e) { e.printStackTrace(); } diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTestSupport.java index 36fac516f4..43a0239cd3 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTestSupport.java @@ -41,7 +41,7 @@ import org.apache.commons.logging.LogFactory; */ public abstract class UdpTestSupport extends TestCase implements TransportListener { - protected static final Log log = LogFactory.getLog(UdpTestSupport.class); + private static final Log LOG = LogFactory.getLog(UdpTestSupport.class); protected Transport producer; protected Transport consumer; @@ -62,7 +62,7 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen expected.setPrefetchSize(3456); try { - log.info("About to send: " + expected); + LOG.info("About to send: " + expected); producer.oneway(expected); Command received = assertCommandReceived(); @@ -72,7 +72,7 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen assertEquals("isExclusive", expected.isExclusive(), actual.isExclusive()); assertEquals("getPrefetchSize", expected.getPrefetchSize(), actual.getPrefetchSize()); } catch (Exception e) { - log.info("Caught: " + e); + LOG.info("Caught: " + e); e.printStackTrace(); fail("Failed to send to transport: " + e); } @@ -99,7 +99,7 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen expected.setDestination(destination); try { - log.info("About to send message of type: " + expected.getClass()); + LOG.info("About to send message of type: " + expected.getClass()); producer.oneway(expected); // lets send a dummy command to ensure things don't block if we @@ -116,9 +116,9 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen assertEquals("getDestination", expected.getDestination(), actual.getDestination()); assertEquals("getText", expected.getText(), actual.getText()); - log.info("Received text message with: " + actual.getText().length() + " character(s)"); + LOG.info("Received text message with: " + actual.getText().length() + " character(s)"); } catch (Exception e) { - log.info("Caught: " + e); + LOG.info("Caught: " + e); e.printStackTrace(); fail("Failed to send to transport: " + e); } @@ -162,11 +162,11 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen producer = createProducer(); producer.setTransportListener(new TransportListener() { public void onCommand(Object command) { - log.info("Producer received: " + command); + LOG.info("Producer received: " + command); } public void onException(IOException error) { - log.info("Producer exception: " + error); + LOG.info("Producer exception: " + error); error.printStackTrace(); } @@ -195,7 +195,7 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen public void onCommand(Object o) { final Command command = (Command)o; if (command instanceof WireFormatInfo) { - log.info("Got WireFormatInfo: " + command); + LOG.info("Got WireFormatInfo: " + command); } else { if (command.isResponseRequired()) { // lets send a response back... @@ -203,16 +203,16 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen } if (large) { - log.info("### Received command: " + command.getClass() + " with id: " + command.getCommandId()); + LOG.info("### Received command: " + command.getClass() + " with id: " + command.getCommandId()); } else { - log.info("### Received command: " + command); + LOG.info("### Received command: " + command); } synchronized (lock) { if (receivedCommand == null) { receivedCommand = command; } else { - log.info("Ignoring superfluous command: " + command); + LOG.info("Ignoring superfluous command: " + command); } lock.notifyAll(); } @@ -225,23 +225,23 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen try { consumer.oneway(response); } catch (IOException e) { - log.info("Caught: " + e); + LOG.info("Caught: " + e); e.printStackTrace(); throw new RuntimeException(e); } } public void onException(IOException error) { - log.info("### Received error: " + error); + LOG.info("### Received error: " + error); error.printStackTrace(); } public void transportInterupted() { - log.info("### Transport interrupted"); + LOG.info("### Transport interrupted"); } public void transportResumed() { - log.info("### Transport resumed"); + LOG.info("### Transport resumed"); } protected Command assertCommandReceived() throws InterruptedException { diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportTest.java index 72794ab69f..f625ba4815 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportTest.java @@ -31,13 +31,13 @@ import org.apache.commons.logging.LogFactory; */ public class UdpTransportTest extends UdpTestSupport { - protected static final Log log = LogFactory.getLog(UdpTransportTest.class); + private static final Log LOG = LogFactory.getLog(UdpTransportTest.class); protected int consumerPort = 9123; protected String producerURI = "udp://localhost:" + consumerPort; protected Transport createProducer() throws Exception { - log.info("Producer using URI: " + producerURI); + LOG.info("Producer using URI: " + producerURI); // we are not using the TransportFactory as this assumes that // UDP transports talk to a server using a WireFormat Negotiation step @@ -50,7 +50,7 @@ public class UdpTransportTest extends UdpTestSupport { } protected Transport createConsumer() throws Exception { - log.info("Consumer on port: " + consumerPort); + LOG.info("Consumer on port: " + consumerPort); OpenWireFormat wireFormat = createWireFormat(); UdpTransport transport = new UdpTransport(wireFormat, consumerPort); transport.setSequenceGenerator(new IntSequenceGenerator()); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportUsingServerTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportUsingServerTest.java index 400cb61cdf..427d4af05e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportUsingServerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportUsingServerTest.java @@ -23,12 +23,16 @@ import org.apache.activemq.command.Response; import org.apache.activemq.transport.Transport; import org.apache.activemq.transport.TransportFactory; import org.apache.activemq.transport.TransportServer; +import org.apache.activemq.transport.tcp.WireformatNegociationTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * * @version $Revision$ */ public class UdpTransportUsingServerTest extends UdpTestSupport { + private static final Log LOG = LogFactory.getLog(UdpTransportUsingServerTest.class); protected int consumerPort = 9123; protected String producerURI = "udp://localhost:" + consumerPort; @@ -38,16 +42,16 @@ public class UdpTransportUsingServerTest extends UdpTestSupport { ConsumerInfo expected = new ConsumerInfo(); expected.setSelector("Edam"); expected.setResponseRequired(true); - log.info("About to send: " + expected); + LOG.info("About to send: " + expected); Response response = (Response) producer.request(expected, 2000); - log.info("Received: " + response); + LOG.info("Received: " + response); assertNotNull("Received a response", response); assertTrue("Should not be an exception", !response.isException()); } protected Transport createProducer() throws Exception { - log.info("Producer using URI: " + producerURI); + LOG.info("Producer using URI: " + producerURI); URI uri = new URI(producerURI); return TransportFactory.connect(uri); } diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java b/activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java index 1244b84c1d..b8b5cd72ee 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java @@ -1,12 +1,12 @@ /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -50,7 +50,7 @@ import org.springframework.jms.core.MessageCreator; import org.springframework.jms.listener.DefaultMessageListenerContainer; public class AMQDeadlockTestW4Brokers extends TestCase { - private static final transient Log log = LogFactory.getLog(AMQDeadlockTestW4Brokers.class); + private static final transient Log LOG = LogFactory.getLog(AMQDeadlockTestW4Brokers.class); private static final String BROKER_URL1 = "tcp://localhost:61616"; private static final String BROKER_URL2 = "tcp://localhost:61617"; @@ -67,7 +67,7 @@ public class AMQDeadlockTestW4Brokers extends TestCase { private static final String QUEUE1_NAME = "test.queue.1"; private static final int MAX_CONSUMERS = 5; private static final int NUM_MESSAGE_TO_SEND = 10000; - private static final CountDownLatch latch = new CountDownLatch(MAX_CONSUMERS * NUM_MESSAGE_TO_SEND); + private static final CountDownLatch LATCH = new CountDownLatch(MAX_CONSUMERS * NUM_MESSAGE_TO_SEND); @Override public void setUp() throws Exception { @@ -143,8 +143,8 @@ public class AMQDeadlockTestW4Brokers extends TestCase { executor.submit(task[i]); } - latch.await(15, TimeUnit.SECONDS); - assertTrue(latch.getCount() == MAX_CONSUMERS * NUM_MESSAGE_TO_SEND); + LATCH.await(15, TimeUnit.SECONDS); + assertTrue(LATCH.getCount() == MAX_CONSUMERS * NUM_MESSAGE_TO_SEND); } catch (Exception e) { e.printStackTrace(); } finally { @@ -249,11 +249,11 @@ public class AMQDeadlockTestW4Brokers extends TestCase { */ int value = count.incrementAndGet(); if (value % 1000 == 0) { - log.info("Consumed message: " + value); + LOG.info("Consumed message: " + value); } Thread.sleep(waitTime); - latch.countDown(); + LATCH.countDown(); /* * } catch (JMSException e) { e.printStackTrace(); */ @@ -309,7 +309,7 @@ public class AMQDeadlockTestW4Brokers extends TestCase { // Thread.sleep(1000); } } catch (final Throwable e) { - log.error("Producer 1 is exiting", e); + LOG.error("Producer 1 is exiting", e); } } } diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java b/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java index 260d1ac4c9..0900e78bee 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.usecases; import java.net.URI; diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/CompositeConsumeTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/CompositeConsumeTest.java index 9e1b005d61..7191ce859e 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/CompositeConsumeTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/CompositeConsumeTest.java @@ -21,11 +21,15 @@ import javax.jms.Message; import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest; +import org.apache.activemq.transport.udp.UdpTransportUsingServerTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision: 1.1.1.1 $ */ public class CompositeConsumeTest extends JmsTopicSendReceiveWithTwoConnectionsTest { + private static final Log LOG = LogFactory.getLog(CompositeConsumeTest.class); public void testSendReceive() throws Exception { messages.clear(); @@ -37,7 +41,7 @@ public class CompositeConsumeTest extends JmsTopicSendReceiveWithTwoConnectionsT Message message = session.createTextMessage(data[i]); if (verbose) { - log.info("About to send a message: " + message + " with text: " + data[i]); + LOG.info("About to send a message: " + message + " with text: " + data[i]); } producer.send(destinations[destIdx], message); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/CompositePublishTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/CompositePublishTest.java index 8535549e5a..e77040c517 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/CompositePublishTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/CompositePublishTest.java @@ -29,11 +29,15 @@ import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.test.JmsSendReceiveTestSupport; +import org.apache.activemq.test.retroactive.RetroactiveConsumerTestWithSimpleMessageListTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision: 1.1.1.1 $ */ public class CompositePublishTest extends JmsSendReceiveTestSupport { + private static final Log LOG = LogFactory.getLog(CompositePublishTest.class); protected Connection sendConnection; protected Connection receiveConnection; diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/CreateLotsOfTemporaryQueuesTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/CreateLotsOfTemporaryQueuesTest.java index 9bcfdf3b30..4376ee07f8 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/CreateLotsOfTemporaryQueuesTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/CreateLotsOfTemporaryQueuesTest.java @@ -23,12 +23,15 @@ import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.apache.activemq.EmbeddedBrokerAndConnectionTestSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * * @version $Revision: 1.1 $ */ public class CreateLotsOfTemporaryQueuesTest extends EmbeddedBrokerAndConnectionTestSupport { + private static final Log LOG = LogFactory.getLog(CreateLotsOfTemporaryQueuesTest.class); private static int numberToCreate = 500; private static long sleep = 20; diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/CreateTemporaryQueueBeforeStartTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/CreateTemporaryQueueBeforeStartTest.java index 527544a027..da638661ce 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/CreateTemporaryQueueBeforeStartTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/CreateTemporaryQueueBeforeStartTest.java @@ -63,9 +63,9 @@ public class CreateTemporaryQueueBeforeStartTest extends TestCase { } public void testTemporaryQueueConsumer() throws Exception { - final int NUMBER = 20; + final int number = 20; final AtomicInteger count = new AtomicInteger(0); - for (int i = 0; i < NUMBER; i++) { + for (int i = 0; i < number; i++) { Thread thread = new Thread(new Runnable() { public void run() { try { @@ -75,7 +75,7 @@ public class CreateTemporaryQueueBeforeStartTest extends TestCase { QueueReceiver consumer = session.createReceiver(queue); connection.start(); - if (count.incrementAndGet() >= NUMBER) { + if (count.incrementAndGet() >= number) { synchronized (count) { count.notify(); } @@ -91,7 +91,7 @@ public class CreateTemporaryQueueBeforeStartTest extends TestCase { synchronized (count) { long waitTime = maxWaitTime; long start = System.currentTimeMillis(); - while (count.get() < NUMBER) { + while (count.get() < number) { if (waitTime <= 0) { break; } else { @@ -100,7 +100,7 @@ public class CreateTemporaryQueueBeforeStartTest extends TestCase { } } } - assertTrue("Unexpected count: " + count, count.get() == NUMBER); + assertTrue("Unexpected count: " + count, count.get() == number); } protected QueueConnection createConnection() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java index 9e07214d0b..988b163610 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java @@ -29,12 +29,15 @@ import javax.jms.Topic; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.test.TestSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision: 1.1.1.1 $ */ public class DurableConsumerCloseAndReconnectTest extends TestSupport { protected static final long RECEIVE_TIMEOUT = 5000L; + private static final Log LOG = LogFactory.getLog(DurableConsumerCloseAndReconnectTest.class); private Connection connection; private Session session; @@ -81,7 +84,7 @@ public class DurableConsumerCloseAndReconnectTest extends TestSupport { closeConsumer(); - log.info("Now lets create the consumer again and because we didn't ack, we should get it again"); + LOG.info("Now lets create the consumer again and because we didn't ack, we should get it again"); makeConsumer(); message = consumer.receive(RECEIVE_TIMEOUT); @@ -90,7 +93,7 @@ public class DurableConsumerCloseAndReconnectTest extends TestSupport { closeConsumer(); - log.info("Now lets create the consumer again and because we didn't ack, we should get it again"); + LOG.info("Now lets create the consumer again and because we didn't ack, we should get it again"); makeConsumer(); message = consumer.receive(2000); @@ -98,7 +101,7 @@ public class DurableConsumerCloseAndReconnectTest extends TestSupport { closeConsumer(); - log.info("Lets publish one more message now"); + LOG.info("Lets publish one more message now"); publish(); makeConsumer(); @@ -154,7 +157,7 @@ public class DurableConsumerCloseAndReconnectTest extends TestSupport { protected void makeConsumer() throws Exception { String durableName = getName(); String clientID = getSubject(); - log.info("Creating a durable subscribe for clientID: " + clientID + " and durable name: " + durableName); + LOG.info("Creating a durable subscribe for clientID: " + clientID + " and durable name: " + durableName); createSession(clientID); consumer = createConsumer(durableName); } diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java index 2accd6a00b..759ed1fe69 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java @@ -36,7 +36,7 @@ import org.apache.activemq.store.PersistenceAdapter; /** * @version $Revision: 1.1.1.1 $ */ -abstract public class DurableSubscriptionTestSupport extends TestSupport { +public abstract class DurableSubscriptionTestSupport extends TestSupport { private Connection connection; private Session session; @@ -101,15 +101,17 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport { } private void destroyBroker() throws Exception { - if (connection != null) + if (connection != null) { connection.close(); - if (broker != null) + } + if (broker != null) { broker.stop(); + } } - abstract protected PersistenceAdapter createPersistenceAdapter() throws Exception; + protected abstract PersistenceAdapter createPersistenceAdapter() throws Exception; - public void XtestUnsubscribeSubscription() throws Exception { + public void xtestUnsubscribeSubscription() throws Exception { session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic("TestTopic"); consumer = session.createDurableSubscriber(topic, "sub1"); @@ -142,7 +144,7 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport { assertTextMessageEquals("Msg:3", consumer.receive(5000)); } - public void XtestInactiveDurableSubscriptionTwoConnections() throws Exception { + public void xtestInactiveDurableSubscriptionTwoConnections() throws Exception { session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic("TestTopic"); consumer = session.createDurableSubscriber(topic, "sub1"); @@ -173,7 +175,7 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport { assertTextMessageEquals("Msg:2", consumer.receive(5000)); } - public void XtestInactiveDurableSubscriptionBrokerRestart() throws Exception { + public void xtestInactiveDurableSubscriptionBrokerRestart() throws Exception { session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic("TestTopic"); consumer = session.createDurableSubscriber(topic, "sub1"); @@ -239,7 +241,7 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport { assertNull(consumer.receive(5000)); } - public void XtestInactiveDurableSubscriptionOneConnection() throws Exception { + public void xtestInactiveDurableSubscriptionOneConnection() throws Exception { session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic("TestTopic"); consumer = session.createDurableSubscriber(topic, "sub1"); @@ -264,7 +266,7 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport { assertTextMessageEquals("Msg:2", consumer.receive(5000)); } - public void XtestSelectorChange() throws Exception { + public void xtestSelectorChange() throws Exception { session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic("TestTopic"); consumer = session.createDurableSubscriber(topic, "sub1", "color='red'", false); @@ -299,7 +301,7 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport { assertTextMessageEquals("Msg:4", consumer.receive(5000)); } - public void XtestDurableSubWorksInNewSession() throws JMSException { + public void xtestDurableSubWorksInNewSession() throws JMSException { // Create the consumer. connection.start(); @@ -326,7 +328,7 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport { } - public void XtestDurableSubWorksInNewConnection() throws Exception { + public void xtestDurableSubWorksInNewConnection() throws Exception { // Create the consumer. connection.start(); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/KahaDurableSubscriptionTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/KahaDurableSubscriptionTest.java index 5acc233a44..a4b153096c 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/KahaDurableSubscriptionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/KahaDurableSubscriptionTest.java @@ -1,17 +1,19 @@ /** - * - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.usecases; import java.io.File; diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java index d0201062f3..90ac2357a2 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java @@ -42,7 +42,7 @@ public class MultiBrokersMultiClientsUsingTcpTest extends MultiBrokersMultiClien } } - MAX_SETUP_TIME = 5000; + maxSetupTime = 5000; } protected void bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker) throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/NewConsumerCreatesDestinationTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/NewConsumerCreatesDestinationTest.java index e461c9ad5b..3bdecd23a6 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/NewConsumerCreatesDestinationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/NewConsumerCreatesDestinationTest.java @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: $ */ public class NewConsumerCreatesDestinationTest extends EmbeddedBrokerAndConnectionTestSupport { - private static final transient Log log = LogFactory.getLog(NewConsumerCreatesDestinationTest.class); + private static final Log LOG = LogFactory.getLog(NewConsumerCreatesDestinationTest.class); private ActiveMQQueue wildcard; @@ -42,8 +42,8 @@ public class NewConsumerCreatesDestinationTest extends EmbeddedBrokerAndConnecti String wildcardText = "org.*" + getDestinationString().substring("org.apache".length()); wildcard = new ActiveMQQueue(wildcardText); - log.info("Using wildcard: " + wildcard); - log.info("on destination: " + destination); + LOG.info("Using wildcard: " + wildcard); + LOG.info("on destination: " + destination); assertDestinationCreated(destination, false); assertDestinationCreated(wildcard, false); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageInTransactionTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageInTransactionTest.java index e4f809908a..3b95fce8e1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageInTransactionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageInTransactionTest.java @@ -53,7 +53,7 @@ public final class PublishOnQueueConsumedMessageInTransactionTest extends TestCa private List messages = createConcurrentList(); private final Object lock = new Object(); private String[] data; - private String DATAFILE_ROOT = IOHelper.getDefaultDataDirectory(); + private String dataFileRoot = IOHelper.getDefaultDataDirectory(); private int messageCount = 3; private String url = "vm://localhost"; @@ -63,7 +63,7 @@ public final class PublishOnQueueConsumedMessageInTransactionTest extends TestCa // private String url = "tcp://localhost:61616"; protected void setUp() throws Exception { - File dataFile = new File(DATAFILE_ROOT); + File dataFile = new File(dataFileRoot); recursiveDelete(dataFile); try { factory = new ActiveMQConnectionFactory(url); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java index 2106c8cc78..cbd92c430a 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java @@ -32,8 +32,8 @@ import org.springframework.core.io.Resource; * @version $Revision: 1.2 $ */ public class PublishOnQueueConsumedMessageUsingActivemqXMLTest extends PublishOnTopicConsumedMessageTest { - private static final transient Log log = LogFactory.getLog(PublishOnQueueConsumedMessageUsingActivemqXMLTest.class); protected static final String JOURNAL_ROOT = "../data/"; + private static final transient Log LOG = LogFactory.getLog(PublishOnQueueConsumedMessageUsingActivemqXMLTest.class); BrokerService broker; /** @@ -55,9 +55,9 @@ public class PublishOnQueueConsumedMessageUsingActivemqXMLTest extends PublishOn File journalFile = new File(JOURNAL_ROOT); recursiveDelete(journalFile); // Create broker from resource - log.info("Creating broker... "); + LOG.info("Creating broker... "); broker = createBroker("org/apache/activemq/usecases/activemq.xml"); - log.info("Success"); + LOG.info("Success"); super.setUp(); } @@ -66,11 +66,11 @@ public class PublishOnQueueConsumedMessageUsingActivemqXMLTest extends PublishOn * @see junit.framework.TestCase#tearDown() */ protected void tearDown() throws Exception { - log.info("Closing Broker"); + LOG.info("Closing Broker"); if (broker != null) { broker.stop(); } - log.info("Broker closed..."); + LOG.info("Broker closed..."); } /* diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumedMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumedMessageTest.java index f53ee583b3..d1f8dc8171 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumedMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumedMessageTest.java @@ -22,11 +22,16 @@ import javax.jms.Message; import javax.jms.MessageProducer; import org.apache.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision: 1.1.1.1 $ */ public class PublishOnTopicConsumedMessageTest extends JmsTopicSendReceiveWithTwoConnectionsTest { + + private static final Log LOG = LogFactory.getLog(PublishOnTopicConsumedMessageTest.class); + private MessageProducer replyProducer; public synchronized void onMessage(Message message) { @@ -39,7 +44,7 @@ public class PublishOnTopicConsumedMessageTest extends JmsTopicSendReceiveWithTw // log.info("Sending reply: " + message); super.onMessage(message); } catch (JMSException e) { - log.info("Failed to send message: " + e); + LOG.info("Failed to send message: " + e); e.printStackTrace(); } } @@ -56,7 +61,7 @@ public class PublishOnTopicConsumedMessageTest extends JmsTopicSendReceiveWithTw } replyProducer = receiveSession.createProducer(replyDestination); - log.info("Created replyProducer: " + replyProducer); + LOG.info("Created replyProducer: " + replyProducer); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java index 41870300a8..98ea88ac9c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java @@ -32,8 +32,9 @@ import org.springframework.core.io.Resource; * @version $Revision: 1.2 $ */ public class PublishOnTopicConsumerMessageUsingActivemqXMLTest extends PublishOnTopicConsumedMessageTest { - private static final transient Log log = LogFactory.getLog(PublishOnTopicConsumerMessageUsingActivemqXMLTest.class); protected static final String JOURNAL_ROOT = "../data/"; + private static final transient Log LOG = LogFactory.getLog(PublishOnTopicConsumerMessageUsingActivemqXMLTest.class); + BrokerService broker; /** @@ -55,9 +56,9 @@ public class PublishOnTopicConsumerMessageUsingActivemqXMLTest extends PublishOn File journalFile = new File(JOURNAL_ROOT); recursiveDelete(journalFile); // Create broker from resource - log.info("Creating broker... "); + LOG.info("Creating broker... "); broker = createBroker("org/apache/activemq/usecases/activemq.xml"); - log.info("Success"); + LOG.info("Success"); super.setUp(); } @@ -66,11 +67,11 @@ public class PublishOnTopicConsumerMessageUsingActivemqXMLTest extends PublishOn * @see junit.framework.TestCase#tearDown() */ protected void tearDown() throws Exception { - log.info("Closing Broker"); + LOG.info("Closing Broker"); if (broker != null) { broker.stop(); } - log.info("Broker closed..."); + LOG.info("Broker closed..."); } /* diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java index 2778e198ca..eea96c2da7 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; public class QueueDuplicatesTest extends TestCase { - private static final Log log = LogFactory.getLog(QueueDuplicatesTest.class); + private static final Log LOG = LogFactory.getLog(QueueDuplicatesTest.class); private static DateFormat formatter = new SimpleDateFormat("HH:mm:ss SSS"); private String brokerUrl; @@ -133,7 +133,7 @@ public class QueueDuplicatesTest extends TestCase { String txt = "Text Message: " + i; TextMessage msg = session.createTextMessage(txt); producer.send(msg); - log.info(formatter.format(new Date()) + " Sent ==> " + msg + " to " + subject); + LOG.info(formatter.format(new Date()) + " Sent ==> " + msg + " to " + subject); Thread.sleep(1000); } session.close(); @@ -147,7 +147,7 @@ public class QueueDuplicatesTest extends TestCase { private Map msgs = new HashMap(); public void onMessage(Message message) { - log.info(formatter.format(new Date()) + " SimpleConsumer Message Received: " + message); + LOG.info(formatter.format(new Date()) + " SimpleConsumer Message Received: " + message); try { String id = message.getJMSMessageID(); assertNull("Message is duplicate: " + id, msgs.get(id)); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/QueueRepeaterTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/QueueRepeaterTest.java index 976f087dab..1aada3f0e0 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/QueueRepeaterTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/QueueRepeaterTest.java @@ -41,7 +41,7 @@ import org.apache.commons.logging.LogFactory; */ public final class QueueRepeaterTest extends TestCase { - private static final Log log = LogFactory.getLog(QueueRepeaterTest.class); + private static final Log LOG = LogFactory.getLog(QueueRepeaterTest.class); private volatile String receivedText; @@ -74,18 +74,18 @@ public final class QueueRepeaterTest extends TestCase { receivedText = tm.getText(); latch.countDown(); - log.info("consumer received message :" + receivedText); + LOG.info("consumer received message :" + receivedText); consumerSession.commit(); - log.info("committed transaction"); + LOG.info("committed transaction"); } catch (JMSException e) { try { consumerSession.rollback(); - log.info("rolled back transaction"); + LOG.info("rolled back transaction"); } catch (JMSException e1) { - log.info(e1); + LOG.info(e1); e1.printStackTrace(); } - log.info(e); + LOG.info(e); e.printStackTrace(); } } @@ -98,15 +98,15 @@ public final class QueueRepeaterTest extends TestCase { tm = producerSession.createTextMessage(); tm.setText("Hello, " + new Date()); producer.send(tm); - log.info("producer sent message :" + tm.getText()); + LOG.info("producer sent message :" + tm.getText()); } catch (JMSException e) { e.printStackTrace(); } - log.info("Waiting for latch"); + LOG.info("Waiting for latch"); latch.await(); - log.info("test completed, destination=" + receivedText); + LOG.info("test completed, destination=" + receivedText); } protected void tearDown() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/StartAndStopClientAndBrokerDoesNotLeaveThreadsRunningTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/StartAndStopClientAndBrokerDoesNotLeaveThreadsRunningTest.java index eaf0edc383..6cfb5d5b27 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/StartAndStopClientAndBrokerDoesNotLeaveThreadsRunningTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/StartAndStopClientAndBrokerDoesNotLeaveThreadsRunningTest.java @@ -1,9 +1,10 @@ -/* - * Copyright 2005-2006 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -34,7 +35,7 @@ import org.apache.activemq.spring.ConsumerBean; public class StartAndStopClientAndBrokerDoesNotLeaveThreadsRunningTest extends TestCase { public static interface Task { - public void execute() throws Exception; + void execute() throws Exception; } public void setUp() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/SubscribeClosePublishThenConsumeTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/SubscribeClosePublishThenConsumeTest.java index 3fb5187abb..fa74878089 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/SubscribeClosePublishThenConsumeTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/SubscribeClosePublishThenConsumeTest.java @@ -27,12 +27,15 @@ import javax.jms.TopicSubscriber; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.test.TestSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @author Paul Smith * @version $Revision: 1.1.1.1 $ */ public class SubscribeClosePublishThenConsumeTest extends TestSupport { + private static final Log LOG = LogFactory.getLog(SubscribeClosePublishThenConsumeTest.class); public void testDurableTopic() throws Exception { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://locahost"); @@ -92,13 +95,13 @@ public class SubscribeClosePublishThenConsumeTest extends TestSupport { subscriber = session.createDurableSubscriber(topic, subscriberName); connection.start(); - log.info("Started connection - now about to try receive the textMessage"); + LOG.info("Started connection - now about to try receive the textMessage"); long time = System.currentTimeMillis(); Message message = subscriber.receive(15000L); long elapsed = System.currentTimeMillis() - time; - log.info("Waited for: " + elapsed + " millis"); + LOG.info("Waited for: " + elapsed + " millis"); assertNotNull("Should have received the message we published by now", message); assertTrue("should be text textMessage", message instanceof TextMessage); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/TestSupport.java b/activemq-core/src/test/java/org/apache/activemq/usecases/TestSupport.java index 2cedaaca36..7c51e80980 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/TestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/TestSupport.java @@ -89,8 +89,9 @@ public class TestSupport extends TestCase { */ protected void assertTextMessageEqual(String message, TextMessage m1, TextMessage m2) throws JMSException { assertFalse(message + ": expected {" + m1 + "}, but was {" + m2 + "}", m1 == null ^ m2 == null); - if (m1 == null) + if (m1 == null) { return; + } assertEquals(message, m1.getText(), m2.getText()); } @@ -105,8 +106,9 @@ public class TestSupport extends TestCase { */ protected void assertEquals(String message, Message m1, Message m2) throws JMSException { assertFalse(message + ": expected {" + m1 + "}, but was {" + m2 + "}", m1 == null ^ m2 == null); - if (m1 == null) + if (m1 == null) { return; + } assertTrue(message + ": expected {" + m1 + "}, but was {" + m2 + "}", m1.getClass() == m2.getClass()); if (m1 instanceof TextMessage) { assertTextMessageEqual(message, (TextMessage)m1, (TextMessage)m2); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java index f5abdb0fff..7be215b179 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java @@ -33,7 +33,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport { /** * BrokerA -> BrokerB -> BrokerC */ - public void test_AB_BC_BrokerNetwork() throws Exception { + public void testABandBCbrokerNetwork() throws Exception { // Setup broker networks bridgeBrokers("BrokerA", "BrokerB"); bridgeBrokers("BrokerB", "BrokerC"); @@ -60,7 +60,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport { /** * BrokerA <- BrokerB -> BrokerC */ - public void test_BA_BC_BrokerNetwork() throws Exception { + public void testBAandBCbrokerNetwork() throws Exception { // Setup broker networks bridgeBrokers("BrokerB", "BrokerA"); bridgeBrokers("BrokerB", "BrokerC"); @@ -91,7 +91,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport { /** * BrokerA -> BrokerB <- BrokerC */ - public void test_AB_CB_BrokerNetwork() throws Exception { + public void testABandCBbrokerNetwork() throws Exception { // Setup broker networks bridgeBrokers("BrokerA", "BrokerB"); bridgeBrokers("BrokerC", "BrokerB"); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java index 537b3ab112..2f95a19287 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java @@ -56,7 +56,7 @@ public class ThreeBrokerQueueNetworkUsingTcpTest extends ThreeBrokerQueueNetwork throw new Exception("Remote broker or local broker has no registered connectors."); } - MAX_SETUP_TIME = 2000; + maxSetupTime = 2000; } public void setUp() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java index 02271398f0..df2c0c4d1e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java @@ -33,7 +33,7 @@ public class ThreeBrokerTopicNetworkTest extends JmsMultipleBrokersTestSupport { /** * BrokerA -> BrokerB -> BrokerC */ - public void test_AB_BC_BrokerNetwork() throws Exception { + public void testABandBCbrokerNetwork() throws Exception { // Setup broker networks bridgeBrokers("BrokerA", "BrokerB"); bridgeBrokers("BrokerB", "BrokerC"); @@ -72,7 +72,7 @@ public class ThreeBrokerTopicNetworkTest extends JmsMultipleBrokersTestSupport { /** * BrokerA <- BrokerB -> BrokerC */ - public void test_BA_BC_BrokerNetwork() throws Exception { + public void testBAandBCbrokerNetwork() throws Exception { // Setup broker networks bridgeBrokers("BrokerB", "BrokerA"); bridgeBrokers("BrokerB", "BrokerC"); @@ -111,7 +111,7 @@ public class ThreeBrokerTopicNetworkTest extends JmsMultipleBrokersTestSupport { /** * BrokerA -> BrokerB <- BrokerC */ - public void test_AB_CB_BrokerNetwork() throws Exception { + public void testABandCBbrokerNetwork() throws Exception { // Setup broker networks bridgeBrokers("BrokerA", "BrokerB"); bridgeBrokers("BrokerC", "BrokerB"); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java index cedc879d44..c4ff7a3505 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java @@ -56,7 +56,7 @@ public class ThreeBrokerTopicNetworkUsingTcpTest extends ThreeBrokerTopicNetwork throw new Exception("Remote broker or local broker has no registered connectors."); } - MAX_SETUP_TIME = 2000; + maxSetupTime = 2000; } public void setUp() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/TopicRedeliverTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/TopicRedeliverTest.java index a480a4e831..04f02d5c61 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/TopicRedeliverTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/TopicRedeliverTest.java @@ -146,7 +146,7 @@ public class TopicRedeliverTest extends TestSupport { * @throws Exception */ - public void XtestTransactionRollbackOnSessionClose() throws Exception { + public void xtestTransactionRollbackOnSessionClose() throws Exception { Destination destination = createDestination(getClass().getName()); Connection connection = createConnection(); connection.setClientID(idGen.generateId()); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java index 1bbf984b7a..b55dfbb2bd 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java @@ -43,7 +43,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision: 1.1 $ */ public final class TransactionRollbackOrderTest extends TestCase { - private static final Log log = LogFactory.getLog(TransactionRollbackOrderTest.class); + private static final Log LOG = LogFactory.getLog(TransactionRollbackOrderTest.class); private volatile String receivedText; @@ -55,7 +55,7 @@ public final class TransactionRollbackOrderTest extends TestCase { private MessageConsumer consumer; private Connection connection; private CountDownLatch latch = new CountDownLatch(1); - private int NUM_MESSAGES = 5; + private int numMessages = 5; private List msgSent = new ArrayList(); private List msgCommitted = new ArrayList(); private List msgRolledBack = new ArrayList(); @@ -89,29 +89,29 @@ public final class TransactionRollbackOrderTest extends TestCase { msgRedelivered.add(receivedText); } - log.info("consumer received message: " + receivedText + (tm.getJMSRedelivered() ? " ** Redelivered **" : "")); + LOG.info("consumer received message: " + receivedText + (tm.getJMSRedelivered() ? " ** Redelivered **" : "")); if (msgCount == 3) { msgRolledBack.add(receivedText); consumerSession.rollback(); - log.info("[msg: " + receivedText + "] ** rolled back **"); + LOG.info("[msg: " + receivedText + "] ** rolled back **"); } else { msgCommittedCount++; msgCommitted.add(receivedText); consumerSession.commit(); - log.info("[msg: " + receivedText + "] committed transaction "); + LOG.info("[msg: " + receivedText + "] committed transaction "); } - if (msgCommittedCount == NUM_MESSAGES) { + if (msgCommittedCount == numMessages) { latch.countDown(); } } catch (JMSException e) { try { consumerSession.rollback(); - log.info("rolled back transaction"); + LOG.info("rolled back transaction"); } catch (JMSException e1) { - log.info(e1); + LOG.info(e1); e1.printStackTrace(); } - log.info(e); + LOG.info(e); e.printStackTrace(); } } @@ -120,30 +120,30 @@ public final class TransactionRollbackOrderTest extends TestCase { TextMessage tm = null; try { - for (int i = 1; i <= NUM_MESSAGES; i++) { + for (int i = 1; i <= numMessages; i++) { tm = producerSession.createTextMessage(); tm.setText("Hello " + i); msgSent.add(tm.getText()); producer.send(tm); - log.info("producer sent message: " + tm.getText()); + LOG.info("producer sent message: " + tm.getText()); } } catch (JMSException e) { e.printStackTrace(); } - log.info("Waiting for latch"); + LOG.info("Waiting for latch"); latch.await(); assertEquals(1, msgRolledBack.size()); assertEquals(1, msgRedelivered.size()); - log.info("msg RolledBack = " + msgRolledBack.get(0)); - log.info("msg Redelivered = " + msgRedelivered.get(0)); + LOG.info("msg RolledBack = " + msgRolledBack.get(0)); + LOG.info("msg Redelivered = " + msgRedelivered.get(0)); assertEquals(msgRolledBack.get(0), msgRedelivered.get(0)); - assertEquals(NUM_MESSAGES, msgSent.size()); - assertEquals(NUM_MESSAGES, msgCommitted.size()); + assertEquals(numMessages, msgSent.size()); + assertEquals(numMessages, msgCommitted.size()); assertEquals(msgSent, msgCommitted); @@ -151,7 +151,7 @@ public final class TransactionRollbackOrderTest extends TestCase { protected void tearDown() throws Exception { if (connection != null) { - log.info("Closing the connection"); + LOG.info("Closing the connection"); connection.close(); } super.tearDown(); diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionTest.java index 63a600749f..e293b45824 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionTest.java @@ -41,7 +41,7 @@ import org.apache.commons.logging.LogFactory; */ public final class TransactionTest extends TestCase { - private static final Log log = LogFactory.getLog(TransactionTest.class); + private static final Log LOG = LogFactory.getLog(TransactionTest.class); private volatile String receivedText; @@ -74,18 +74,18 @@ public final class TransactionTest extends TestCase { receivedText = tm.getText(); latch.countDown(); - log.info("consumer received message :" + receivedText); + LOG.info("consumer received message :" + receivedText); consumerSession.commit(); - log.info("committed transaction"); + LOG.info("committed transaction"); } catch (JMSException e) { try { consumerSession.rollback(); - log.info("rolled back transaction"); + LOG.info("rolled back transaction"); } catch (JMSException e1) { - log.info(e1); + LOG.info(e1); e1.printStackTrace(); } - log.info(e); + LOG.info(e); e.printStackTrace(); } } @@ -98,15 +98,15 @@ public final class TransactionTest extends TestCase { tm = producerSession.createTextMessage(); tm.setText("Hello, " + new Date()); producer.send(tm); - log.info("producer sent message :" + tm.getText()); + LOG.info("producer sent message :" + tm.getText()); } catch (JMSException e) { e.printStackTrace(); } - log.info("Waiting for latch"); + LOG.info("Waiting for latch"); latch.await(); - log.info("test completed, destination=" + receivedText); + LOG.info("test completed, destination=" + receivedText); } protected void tearDown() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java index 28e69986ca..2b5e977fa2 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java @@ -138,7 +138,7 @@ public class TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest extends JmsMultip throw new Exception("Remote broker or local broker has no registered connectors."); } - MAX_SETUP_TIME = 2000; + maxSetupTime = 2000; } public void setUp() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java index 3f4d9046d2..9d8b982fbd 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java @@ -27,6 +27,8 @@ import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQPrefetchPolicy; import org.apache.activemq.JmsMultipleBrokersTestSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @version $Revision: 1.1.1.1 $ @@ -34,6 +36,8 @@ import org.apache.activemq.JmsMultipleBrokersTestSupport; public class TwoBrokerQueueClientsReconnectTest extends JmsMultipleBrokersTestSupport { protected static final int MESSAGE_COUNT = 100; // Best if a factor of 100 protected static final int PREFETCH_COUNT = 1; + private static final Log LOG = LogFactory.getLog(TwoBrokerQueueClientsReconnectTest.class); + protected int msgsClient1, msgsClient2; protected String broker1, broker2; @@ -313,7 +317,7 @@ public class TwoBrokerQueueClientsReconnectTest extends JmsMultipleBrokersTestSu for (i = 0; i < msgCount; i++) { msg = consumer.receive(1000); if (msg == null) { - log.error("Consumer failed to receive exactly " + msgCount + " messages. Actual messages received is: " + i); + LOG.error("Consumer failed to receive exactly " + msgCount + " messages. Actual messages received is: " + i); break; } } diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java index 940dd16f81..cbc65e9a07 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java @@ -27,12 +27,15 @@ import org.apache.activemq.broker.BrokerService; import org.apache.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest; import org.apache.activemq.util.ServiceSupport; import org.apache.activemq.xbean.BrokerFactoryBean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.core.io.ClassPathResource; /** * @version $Revision: 1.1.1.1 $ */ public class TwoBrokerTopicSendReceiveTest extends JmsTopicSendReceiveWithTwoConnectionsTest { + private static final Log LOG = LogFactory.getLog(TwoBrokerTopicSendReceiveTest.class); protected ActiveMQConnectionFactory sendFactory; protected ActiveMQConnectionFactory receiveFactory; @@ -44,9 +47,9 @@ public class TwoBrokerTopicSendReceiveTest extends JmsTopicSendReceiveWithTwoCon // Give server enough time to setup, // so we don't lose messages when connection fails - log.info("Waiting for brokers Initialize."); + LOG.info("Waiting for brokers Initialize."); Thread.sleep(5000); - log.info("Brokers should be initialized by now.. starting test."); + LOG.info("Brokers should be initialized by now.. starting test."); super.setUp(); } diff --git a/activemq-core/src/test/java/org/apache/activemq/util/MarshallingSupportTest.java b/activemq-core/src/test/java/org/apache/activemq/util/MarshallingSupportTest.java index c551a9fc0e..aa29dbf518 100644 --- a/activemq-core/src/test/java/org/apache/activemq/util/MarshallingSupportTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/util/MarshallingSupportTest.java @@ -1,7 +1,19 @@ /** - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package org.apache.activemq.util; import java.util.Properties; diff --git a/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java b/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java index b600003d3d..126eddd201 100644 --- a/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java +++ b/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; */ public class MessageIdList extends Assert implements MessageListener { - protected static final Log log = LogFactory.getLog(MessageIdList.class); + private static final Log LOG = LogFactory.getLog(MessageIdList.class); private List messageIds = new ArrayList(); private Object semaphore; @@ -101,16 +101,17 @@ public class MessageIdList extends Assert implements MessageListener { public void onMessage(Message message) { String id = null; try { - if (countDownLatch != null) + if (countDownLatch != null) { countDownLatch.countDown(); + } id = message.getJMSMessageID(); synchronized (semaphore) { messageIds.add(id); semaphore.notifyAll(); } - if (log.isDebugEnabled()) { - log.debug("Received message: " + message); + if (LOG.isDebugEnabled()) { + LOG.debug("Received message: " + message); } } catch (JMSException e) { e.printStackTrace(); @@ -133,7 +134,7 @@ public class MessageIdList extends Assert implements MessageListener { } public void waitForMessagesToArrive(int messageCount) { - log.info("Waiting for " + messageCount + " message(s) to arrive"); + LOG.info("Waiting for " + messageCount + " message(s) to arrive"); long start = System.currentTimeMillis(); @@ -150,12 +151,12 @@ public class MessageIdList extends Assert implements MessageListener { semaphore.wait(maximumDuration - duration); } } catch (InterruptedException e) { - log.info("Caught: " + e); + LOG.info("Caught: " + e); } } long end = System.currentTimeMillis() - start; - log.info("End of wait for " + end + " millis and received: " + getMessageCount() + " messages"); + LOG.info("End of wait for " + end + " millis and received: " + getMessageCount() + " messages"); } /** diff --git a/activemq-core/src/test/java/org/apache/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java index 5f6df74ec9..b4b7ecdb6f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java @@ -19,6 +19,9 @@ package org.apache.activemq.xbean; import javax.jms.Connection; import org.apache.activemq.EmbeddedBrokerTestSupport; +import org.apache.activemq.test.retroactive.RetroactiveConsumerWithMessageQueryTest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @@ -26,6 +29,8 @@ import org.apache.activemq.EmbeddedBrokerTestSupport; * @version $Revision$ */ public class MultipleTestsWithEmbeddedBrokerTest extends EmbeddedBrokerTestSupport { + private static final Log LOG = LogFactory.getLog(MultipleTestsWithEmbeddedBrokerTest.class); + protected Connection connection; public void test1() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java b/activemq-core/src/test/java/org/apache/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java index 4e4381df7b..fc12c36e74 100644 --- a/activemq-core/src/test/java/org/apache/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java @@ -35,7 +35,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; */ public class MultipleTestsWithSpringFactoryBeanTest extends TestCase { - protected static final Log log = LogFactory.getLog(MultipleTestsWithSpringFactoryBeanTest.class); + private static final Log LOG = LogFactory.getLog(MultipleTestsWithSpringFactoryBeanTest.class); protected AbstractApplicationContext context; protected BrokerService service; @@ -48,7 +48,7 @@ public class MultipleTestsWithSpringFactoryBeanTest extends TestCase { } protected void setUp() throws Exception { - log.info("### starting up the test case: " + getName()); + LOG.info("### starting up the test case: " + getName()); super.setUp(); context = new ClassPathXmlApplicationContext("org/apache/activemq/xbean/spring2.xml"); @@ -59,7 +59,7 @@ public class MultipleTestsWithSpringFactoryBeanTest extends TestCase { connection = createConnectionFactory().createConnection(); connection.start(); - log.info("### started up the test case: " + getName()); + LOG.info("### started up the test case: " + getName()); } protected void tearDown() throws Exception { @@ -70,7 +70,7 @@ public class MultipleTestsWithSpringFactoryBeanTest extends TestCase { context.close(); super.tearDown(); - log.info("### closed down the test case: " + getName()); + LOG.info("### closed down the test case: " + getName()); } protected ConnectionFactory createConnectionFactory() { diff --git a/activemq-core/src/test/java/org/apache/activemq/xbean/XBeanConfigTest.java b/activemq-core/src/test/java/org/apache/activemq/xbean/XBeanConfigTest.java index 1fb7134423..9a2a8e071e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/xbean/XBeanConfigTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/xbean/XBeanConfigTest.java @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; */ public class XBeanConfigTest extends TestCase { - protected static final Log log = LogFactory.getLog(XBeanConfigTest.class); + private static final Log LOG = LogFactory.getLog(XBeanConfigTest.class); protected BrokerService brokerService; protected Broker broker; @@ -62,9 +62,9 @@ public class XBeanConfigTest extends TestCase { assertTrue("subscriptionRecoveryPolicy should be LastImageSubscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy, subscriptionRecoveryPolicy instanceof LastImageSubscriptionRecoveryPolicy); - log.info("destination: " + topic); - log.info("dispatchPolicy: " + dispatchPolicy); - log.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy); + LOG.info("destination: " + topic); + LOG.info("dispatchPolicy: " + dispatchPolicy); + LOG.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy); topic = (Topic)broker.addDestination(context, new ActiveMQTopic("ORDERS.BOOKS")); dispatchPolicy = topic.getDispatchPolicy(); @@ -76,9 +76,9 @@ public class XBeanConfigTest extends TestCase { TimedSubscriptionRecoveryPolicy timedSubcriptionPolicy = (TimedSubscriptionRecoveryPolicy)subscriptionRecoveryPolicy; assertEquals("getRecoverDuration()", 60000, timedSubcriptionPolicy.getRecoverDuration()); - log.info("destination: " + topic); - log.info("dispatchPolicy: " + dispatchPolicy); - log.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy); + LOG.info("destination: " + topic); + LOG.info("dispatchPolicy: " + dispatchPolicy); + LOG.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy); } protected void setUp() throws Exception { @@ -114,7 +114,7 @@ public class XBeanConfigTest extends TestCase { protected BrokerService createBroker() throws Exception { String uri = "org/apache/activemq/xbean/activemq-policy.xml"; - log.info("Loading broker configuration from the classpath with URI: " + uri); + LOG.info("Loading broker configuration from the classpath with URI: " + uri); return BrokerFactory.createBroker(new URI("xbean:" + uri)); } diff --git a/activemq-core/src/test/resources/login.config b/activemq-core/src/test/resources/login.config index 3d6065582a..11a2b5009f 100644 --- a/activemq-core/src/test/resources/login.config +++ b/activemq-core/src/test/resources/login.config @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -6,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java b/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java index 73f5880462..c0ea107636 100755 --- a/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java +++ b/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java @@ -29,7 +29,7 @@ public class HttpTransportBrokerTest extends TransportBrokerTestSupport { } protected void setUp() throws Exception { - MAX_WAIT = 2000; + maxWait = 2000; super.setUp(); }