mirror of
https://github.com/apache/activemq-artemis.git
synced 2025-02-22 02:05:13 +00:00
merge PR #7 - Cleanup issues reported by error prone
This commit is contained in:
commit
79803f17c2
@ -91,7 +91,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint
|
||||
}
|
||||
internalOpen();
|
||||
receiver = new JGroupsReceiver();
|
||||
channel.setReceiver(receiver);
|
||||
channel.addReceiver(receiver);
|
||||
clientOpened = true;
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint
|
||||
int refCount = 1;
|
||||
JChannel channel;
|
||||
String channelName;
|
||||
List<JGroupsReceiver> receivers = new ArrayList<JGroupsReceiver>();
|
||||
final List<JGroupsReceiver> receivers = new ArrayList<JGroupsReceiver>();
|
||||
|
||||
public JChannelWrapper(String channelName, JChannel channel) throws Exception
|
||||
{
|
||||
@ -211,7 +211,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint
|
||||
channel.connect(channelName);
|
||||
}
|
||||
|
||||
public void setReceiver(JGroupsReceiver jGroupsReceiver)
|
||||
public void addReceiver(JGroupsReceiver jGroupsReceiver)
|
||||
{
|
||||
synchronized (receivers)
|
||||
{
|
||||
|
@ -110,13 +110,13 @@ public final class ClientConsumerImpl implements ClientConsumerInternal
|
||||
|
||||
private volatile boolean closed;
|
||||
|
||||
private volatile int creditsToSend;
|
||||
private int creditsToSend;
|
||||
|
||||
private volatile boolean failedOver;
|
||||
|
||||
private volatile Exception lastException;
|
||||
|
||||
private volatile int ackBytes;
|
||||
private int ackBytes;
|
||||
|
||||
private volatile ClientMessageInternal lastAckedMessage;
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
*/
|
||||
package org.apache.activemq.artemis.core.client.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectStreamException;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Array;
|
||||
@ -47,9 +45,9 @@ import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.Interceptor;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
|
||||
import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
import org.apache.activemq.artemis.api.core.client.TopologyMember;
|
||||
import org.apache.activemq.artemis.api.core.client.loadbalance.ConnectionLoadBalancingPolicy;
|
||||
import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
|
||||
@ -62,8 +60,8 @@ import org.apache.activemq.artemis.core.remoting.FailureListener;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManager;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManagerFactory;
|
||||
import org.apache.activemq.artemis.spi.core.remoting.Connector;
|
||||
import org.apache.activemq.artemis.utils.ClassloadingUtil;
|
||||
import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
|
||||
import org.apache.activemq.artemis.utils.ClassloadingUtil;
|
||||
import org.apache.activemq.artemis.utils.UUIDGenerator;
|
||||
|
||||
/**
|
||||
@ -103,8 +101,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
|
||||
|
||||
private final Topology topology;
|
||||
|
||||
//needs to be serializable and not final for retrocompatibility
|
||||
private String topologyArrayGuard = new String();
|
||||
private final Object topologyArrayGuard = new Object();
|
||||
|
||||
private volatile Pair<TransportConfiguration, TransportConfiguration>[] topologyArray;
|
||||
|
||||
@ -181,8 +178,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
|
||||
|
||||
private int initialMessagePacketSize;
|
||||
|
||||
//needs to be serializable and not final for retrocompatibility
|
||||
private String stateGuard = new String();
|
||||
private final Object stateGuard = new Object();
|
||||
private transient STATE state;
|
||||
private transient CountDownLatch latch;
|
||||
|
||||
@ -1824,19 +1820,6 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
|
||||
}
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException
|
||||
{
|
||||
is.defaultReadObject();
|
||||
if (stateGuard == null)
|
||||
{
|
||||
stateGuard = new String();
|
||||
}
|
||||
if (topologyArrayGuard == null)
|
||||
{
|
||||
topologyArrayGuard = new String();
|
||||
}
|
||||
}
|
||||
|
||||
private final class StaticConnector implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 6772279632415242634L;
|
||||
|
@ -92,7 +92,7 @@ public final class ChannelImpl implements Channel
|
||||
|
||||
private final java.util.Queue<Packet> resendCache;
|
||||
|
||||
private volatile int firstStoredCommandID;
|
||||
private int firstStoredCommandID;
|
||||
|
||||
private final AtomicInteger lastConfirmedCommandID = new AtomicInteger(-1);
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class TokenBucketLimiterImpl implements TokenBucketLimiter
|
||||
Even thought we don't use TokenBucket in multiThread
|
||||
the implementation should keep this volatile for correctness
|
||||
*/
|
||||
private volatile int tokens;
|
||||
private int tokens;
|
||||
|
||||
public TokenBucketLimiterImpl(final int rate, final boolean spin)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public class TransactionCallback implements IOAsyncTask
|
||||
|
||||
private final AtomicInteger up = new AtomicInteger();
|
||||
|
||||
private volatile int done = 0;
|
||||
private int done = 0;
|
||||
|
||||
private volatile IOAsyncTask delegateCompletion;
|
||||
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||
|
||||
public class TestClusterManager implements TestClusterManagerMBean
|
||||
{
|
||||
private List<TestNode> testNodes = new ArrayList<TestNode>();
|
||||
private final List<TestNode> testNodes = new ArrayList<TestNode>();
|
||||
|
||||
@Override
|
||||
public int getNumNodes()
|
||||
|
@ -47,6 +47,7 @@ public final class ActiveMQRaUtils
|
||||
* @param you Second value
|
||||
* @return True if object equals else false.
|
||||
*/
|
||||
@SuppressWarnings("StringEquality")
|
||||
public static boolean compare(final String me, final String you)
|
||||
{
|
||||
// If both null or intern equals
|
||||
|
@ -58,7 +58,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>javacc-maven-plugin</artifactId>
|
||||
<version>2.4.1</version>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
|
@ -28,7 +28,6 @@ import org.junit.Test;
|
||||
/**
|
||||
* @version $Revision: 1.7 $
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class SelectorTest
|
||||
{
|
||||
|
||||
@ -129,9 +128,9 @@ public class SelectorTest
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
public <T> T getDestination()
|
||||
public Object getDestination()
|
||||
{
|
||||
return (T) destination;
|
||||
return destination;
|
||||
}
|
||||
|
||||
public Object getLocalConnectionId()
|
||||
|
@ -16,6 +16,25 @@
|
||||
*/
|
||||
package org.apache.activemq.artemis.core.paging.impl;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.journal.SequentialFile;
|
||||
import org.apache.activemq.artemis.core.journal.SequentialFileFactory;
|
||||
@ -43,25 +62,6 @@ import org.apache.activemq.artemis.core.transaction.TransactionOperation;
|
||||
import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes;
|
||||
import org.apache.activemq.artemis.utils.FutureLatch;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
|
||||
/**
|
||||
* @see PagingStore
|
||||
*/
|
||||
@ -100,9 +100,9 @@ public class PagingStoreImpl implements PagingStore
|
||||
// Bytes consumed by the queue on the memory
|
||||
private final AtomicLong sizeInBytes = new AtomicLong();
|
||||
|
||||
private volatile int numberOfPages;
|
||||
private int numberOfPages;
|
||||
|
||||
private volatile int firstPageId;
|
||||
private int firstPageId;
|
||||
|
||||
private volatile int currentPageId;
|
||||
|
||||
|
@ -16,6 +16,43 @@
|
||||
*/
|
||||
package org.apache.activemq.artemis.tests.util;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.transaction.xa.XAException;
|
||||
import javax.transaction.xa.Xid;
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
|
||||
@ -93,43 +130,6 @@ import org.junit.rules.TestRule;
|
||||
import org.junit.rules.TestWatcher;
|
||||
import org.junit.runner.Description;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.transaction.xa.XAException;
|
||||
import javax.transaction.xa.Xid;
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* Base class with basic utilities on starting up a basic server
|
||||
*/
|
||||
@ -2387,6 +2387,8 @@ public abstract class ActiveMQTestBase extends Assert
|
||||
|
||||
private void checkFilesUsage()
|
||||
{
|
||||
|
||||
|
||||
long timeout = System.currentTimeMillis() + 15000;
|
||||
|
||||
while (AsynchronousFileImpl.getTotalMaxIO() != 0 && System.currentTimeMillis() > timeout)
|
||||
|
9
pom.xml
9
pom.xml
@ -705,8 +705,11 @@
|
||||
<compilerId>javac-with-errorprone</compilerId>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<compilerArgs>
|
||||
<!-- DepAnn fail for generated sources. Changing to WARN instead -->
|
||||
<arg>-Xep:DepAnn:WARN</arg>
|
||||
<arg>-Xep:NonAtomicVolatileUpdate:ERROR</arg>
|
||||
<arg>-Xep:SynchronizeOnNonFinalField:ERROR</arg>
|
||||
<arg>-Xep:StaticAccessedFromInstance:ERROR</arg>
|
||||
<arg>-Xep:SynchronizeOnNonFinalField:ERROR</arg>
|
||||
<arg>-Xep:WaitNotInLoop:ERROR</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
@ -881,6 +884,8 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!-- those were some common errors we used to have on the codebase,
|
||||
this should eliminate that -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
|
@ -16,6 +16,10 @@
|
||||
*/
|
||||
package org.apache.activemq.artemis.tests.extras.byteman;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
|
||||
@ -35,16 +39,12 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@RunWith(BMUnitRunner.class)
|
||||
public class StompInternalStateTest extends ActiveMQTestBase
|
||||
{
|
||||
private static final String STOMP_QUEUE_NAME = "jms.queue.StompTestQueue";
|
||||
|
||||
private static volatile String resultTestStompProtocolManagerLeak = null;
|
||||
private String resultTestStompProtocolManagerLeak = null;
|
||||
|
||||
protected ActiveMQServer server = null;
|
||||
|
||||
|
@ -207,7 +207,7 @@ public class AutogroupIdTest extends ActiveMQTestBase
|
||||
|
||||
private static class MyMessageHandler implements MessageHandler
|
||||
{
|
||||
volatile int messagesReceived = 0;
|
||||
int messagesReceived = 0;
|
||||
|
||||
private final CountDownLatch latch;
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class FlowControlOnIgnoreLargeMessageBodyTest extends JMSTestBase
|
||||
|
||||
private volatile boolean stopped = false;
|
||||
|
||||
private volatile int sentMessages = 0;
|
||||
private int sentMessages = 0;
|
||||
|
||||
LoadProducer(final String name, final Topic topic, final ConnectionFactory cf, final int messagesCount) throws Exception
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ public class OrderReattachTest extends ActiveMQTestBase
|
||||
{
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
volatile int count;
|
||||
int count;
|
||||
|
||||
Exception failure;
|
||||
|
||||
|
@ -16,6 +16,14 @@
|
||||
*/
|
||||
package org.apache.activemq.artemis.tests.integration.cluster.reattach;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
@ -39,14 +47,6 @@ import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class RandomReattachTest extends ActiveMQTestBase
|
||||
{
|
||||
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
|
||||
@ -318,7 +318,7 @@ public class RandomReattachTest extends ActiveMQTestBase
|
||||
{
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
volatile int count;
|
||||
int count;
|
||||
|
||||
@Override
|
||||
public void onMessageAssert(final ClientMessage message)
|
||||
@ -440,7 +440,7 @@ public class RandomReattachTest extends ActiveMQTestBase
|
||||
{
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
volatile int count;
|
||||
int count;
|
||||
|
||||
@Override
|
||||
public void onMessageAssert(final ClientMessage message)
|
||||
@ -567,7 +567,7 @@ public class RandomReattachTest extends ActiveMQTestBase
|
||||
{
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
volatile int count;
|
||||
int count;
|
||||
|
||||
@Override
|
||||
public void onMessageAssert(final ClientMessage message)
|
||||
@ -736,7 +736,7 @@ public class RandomReattachTest extends ActiveMQTestBase
|
||||
{
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
volatile int count;
|
||||
int count;
|
||||
|
||||
@Override
|
||||
public void onMessageAssert(final ClientMessage message)
|
||||
|
@ -44,7 +44,7 @@ public class MultipleThreadsOpeningTest extends JMSClusteredTestBase
|
||||
|
||||
class ThreadOpen extends Thread
|
||||
{
|
||||
volatile int errors = 0;
|
||||
int errors = 0;
|
||||
|
||||
public void run()
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ public class JournalPerfTuneTest extends ActiveMQTestBase
|
||||
final int bufferTimeout = (int)(1000000000d / 2000);
|
||||
final boolean logRates = true;
|
||||
|
||||
super.recreateDirectory(journalDir);
|
||||
recreateDirectory(journalDir);
|
||||
|
||||
SequentialFileFactory fileFactory = new AIOSequentialFileFactory(journalDir, bufferSize, bufferTimeout, logRates);
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class JmsCreateConsumerInOnMessageTest extends BasicOpenWireTest implemen
|
||||
private MessageConsumer testConsumer;
|
||||
private MessageProducer producer;
|
||||
private Topic topic;
|
||||
private Object lock = new Object();
|
||||
private final Object lock = new Object();
|
||||
|
||||
/**
|
||||
* Tests if a consumer can be created asynchronusly
|
||||
@ -63,11 +63,12 @@ public class JmsCreateConsumerInOnMessageTest extends BasicOpenWireTest implemen
|
||||
producer.send(msg);
|
||||
|
||||
System.out.println("message sent: " + msg);
|
||||
if (testConsumer == null)
|
||||
synchronized (lock)
|
||||
{
|
||||
synchronized (lock)
|
||||
long timeout = System.currentTimeMillis() + 3000;
|
||||
while (testConsumer == null && timeout > System.currentTimeMillis())
|
||||
{
|
||||
lock.wait(3000);
|
||||
lock.wait(1000);
|
||||
}
|
||||
}
|
||||
assertTrue(testConsumer != null);
|
||||
@ -83,10 +84,10 @@ public class JmsCreateConsumerInOnMessageTest extends BasicOpenWireTest implemen
|
||||
System.out.println("____________onmessage " + message);
|
||||
try
|
||||
{
|
||||
testConsumer = consumerSession.createConsumer(topic);
|
||||
consumerSession.createProducer(topic);
|
||||
synchronized (lock)
|
||||
{
|
||||
testConsumer = consumerSession.createConsumer(topic);
|
||||
consumerSession.createProducer(topic);
|
||||
lock.notify();
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase
|
||||
}
|
||||
|
||||
boolean running = true;
|
||||
Object waitNotify = new Object();
|
||||
final Object waitNotify = new Object();
|
||||
private boolean failed = false;
|
||||
|
||||
public void failed(String message)
|
||||
@ -171,7 +171,11 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase
|
||||
{
|
||||
if (timeWait > 0)
|
||||
{
|
||||
waitNotify.wait(timeWait);
|
||||
long timeout = System.currentTimeMillis() + timeWait;
|
||||
while (running && timeout > System.currentTimeMillis())
|
||||
{
|
||||
waitNotify.wait(timeWait);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
|
@ -82,10 +82,10 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase
|
||||
* keytool -export -keystore server-side-keystore.jceks -file activemq-jceks.cer -storetype jceks -storepass secureexample
|
||||
* keytool -import -keystore client-side-truststore.jceks -storetype JCEKS -file activemq-jceks.cer -storepass secureexample -keypass secureexample -noprompt
|
||||
*/
|
||||
private static String storeType;
|
||||
private static String SERVER_SIDE_KEYSTORE;
|
||||
private static String CLIENT_SIDE_TRUSTSTORE;
|
||||
private static final String PASSWORD = "secureexample";
|
||||
private String storeType;
|
||||
private String SERVER_SIDE_KEYSTORE;
|
||||
private String CLIENT_SIDE_TRUSTSTORE;
|
||||
private final String PASSWORD = "secureexample";
|
||||
|
||||
private ActiveMQServer server;
|
||||
|
||||
@ -427,7 +427,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase
|
||||
Assert.assertEquals(text, m.getBodyBuffer().readString());
|
||||
}
|
||||
|
||||
public static String getSuitableCipherSuite() throws Exception
|
||||
public String getSuitableCipherSuite() throws Exception
|
||||
{
|
||||
String result = "";
|
||||
|
||||
@ -460,7 +460,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String[] getEnabledCipherSuites() throws Exception
|
||||
public String[] getEnabledCipherSuites() throws Exception
|
||||
{
|
||||
SSLContext context = SSLSupport.createContext(storeType, SERVER_SIDE_KEYSTORE, PASSWORD, storeType, CLIENT_SIDE_TRUSTSTORE, PASSWORD);
|
||||
SSLEngine engine = context.createSSLEngine();
|
||||
|
@ -87,12 +87,12 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase
|
||||
* keytool -import -keystore server-side-truststore.jceks -storetype JCEKS -file activemq-jceks.cer -storepass secureexample -keypass secureexample -noprompt
|
||||
*/
|
||||
|
||||
private static String storeType;
|
||||
private static String SERVER_SIDE_KEYSTORE;
|
||||
private static String SERVER_SIDE_TRUSTSTORE;
|
||||
private static String CLIENT_SIDE_TRUSTSTORE;
|
||||
private static String CLIENT_SIDE_KEYSTORE;
|
||||
private static final String PASSWORD = "secureexample";
|
||||
private String storeType;
|
||||
private String SERVER_SIDE_KEYSTORE;
|
||||
private String SERVER_SIDE_TRUSTSTORE;
|
||||
private String CLIENT_SIDE_TRUSTSTORE;
|
||||
private String CLIENT_SIDE_KEYSTORE;
|
||||
private final String PASSWORD = "secureexample";
|
||||
|
||||
private ActiveMQServer server;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public abstract class AbstractStompClientConnection implements StompClientConnec
|
||||
protected BlockingQueue<ClientStompFrame> frameQueue = new LinkedBlockingQueue<ClientStompFrame>();
|
||||
|
||||
protected boolean connected = false;
|
||||
private volatile int serverPingCounter;
|
||||
private int serverPingCounter;
|
||||
|
||||
public AbstractStompClientConnection(String version, String host, int port) throws IOException
|
||||
{
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package org.apache.activemq.artemis.tests.integration.vertx;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
@ -43,8 +45,6 @@ import org.vertx.java.platform.PlatformLocator;
|
||||
import org.vertx.java.platform.PlatformManager;
|
||||
import org.vertx.java.spi.cluster.impl.hazelcast.HazelcastClusterManagerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* This class tests the basics of ActiveMQ
|
||||
* vertx integration
|
||||
@ -715,7 +715,7 @@ public class ActiveMQVertxUnitTest extends ActiveMQTestBase
|
||||
private class VertxTestHandler implements Handler<BaseMessage<?>>
|
||||
{
|
||||
private volatile BaseMessage<?> vertxMsg = null;
|
||||
private Object lock = new Object();
|
||||
private final Object lock = new Object();
|
||||
|
||||
@Override
|
||||
public void handle(BaseMessage<?> arg0)
|
||||
@ -833,11 +833,12 @@ public class ActiveMQVertxUnitTest extends ActiveMQTestBase
|
||||
BaseMessage<?> msg = null;
|
||||
synchronized (lock)
|
||||
{
|
||||
if (vertxMsg == null)
|
||||
long timeout = System.currentTimeMillis() + 10000;
|
||||
while (vertxMsg == null && timeout > System.currentTimeMillis())
|
||||
{
|
||||
try
|
||||
{
|
||||
lock.wait(10000);
|
||||
lock.wait(1000);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
|
@ -16,9 +16,6 @@
|
||||
*/
|
||||
package org.apache.activemq.artemis.jms.tests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Message;
|
||||
@ -38,6 +35,8 @@ import javax.jms.XAQueueConnection;
|
||||
import javax.jms.XAQueueConnectionFactory;
|
||||
import javax.jms.XATopicConnection;
|
||||
import javax.jms.XATopicConnectionFactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
@ -224,7 +223,7 @@ public class ConnectionFactoryTest extends JMSTestCase
|
||||
|
||||
class FastListener implements MessageListener
|
||||
{
|
||||
volatile int processed;
|
||||
int processed;
|
||||
|
||||
public void onMessage(final Message msg)
|
||||
{
|
||||
@ -244,7 +243,7 @@ public class ConnectionFactoryTest extends JMSTestCase
|
||||
|
||||
class SlowListener implements MessageListener
|
||||
{
|
||||
volatile int processed;
|
||||
int processed;
|
||||
|
||||
public void onMessage(final Message msg)
|
||||
{
|
||||
|
@ -42,6 +42,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.activemq.artemis.jms.tests.util.ProxyAssertSupport;
|
||||
@ -2200,14 +2201,17 @@ public class MessageConsumerTest extends JMSTestCase
|
||||
private class ThreadCloser extends Thread
|
||||
{
|
||||
|
||||
Object waitMonitor;
|
||||
final Object waitMonitor;
|
||||
|
||||
long timeToSleep;
|
||||
|
||||
MessageConsumer topicConsumer;
|
||||
|
||||
public ThreadCloser(final Object waitMonitor, final long timeToSleep, final MessageConsumer topicConsumer)
|
||||
final AtomicBoolean running;
|
||||
|
||||
public ThreadCloser(final AtomicBoolean running, final Object waitMonitor, final long timeToSleep, final MessageConsumer topicConsumer)
|
||||
{
|
||||
this.running = running;
|
||||
this.waitMonitor = waitMonitor;
|
||||
this.timeToSleep = timeToSleep;
|
||||
this.topicConsumer = topicConsumer;
|
||||
@ -2220,7 +2224,10 @@ public class MessageConsumerTest extends JMSTestCase
|
||||
{
|
||||
synchronized (waitMonitor)
|
||||
{
|
||||
waitMonitor.wait();
|
||||
while (running.get())
|
||||
{
|
||||
waitMonitor.wait();
|
||||
}
|
||||
}
|
||||
|
||||
Thread.sleep(timeToSleep);
|
||||
@ -2242,7 +2249,7 @@ public class MessageConsumerTest extends JMSTestCase
|
||||
|
||||
long timeToWait;
|
||||
|
||||
Object waitMonitor;
|
||||
final Object waitMonitor;
|
||||
|
||||
long t1;
|
||||
|
||||
@ -2252,8 +2259,11 @@ public class MessageConsumerTest extends JMSTestCase
|
||||
|
||||
MessageConsumer topicConsumer;
|
||||
|
||||
public ThreadReceiver(final Object waitMonitor, final long timeToWait, final MessageConsumer topicConsumer)
|
||||
final AtomicBoolean running;
|
||||
|
||||
public ThreadReceiver(final AtomicBoolean running, final Object waitMonitor, final long timeToWait, final MessageConsumer topicConsumer)
|
||||
{
|
||||
this.running = running;
|
||||
this.waitMonitor = waitMonitor;
|
||||
this.timeToWait = timeToWait;
|
||||
this.topicConsumer = topicConsumer;
|
||||
@ -2266,7 +2276,10 @@ public class MessageConsumerTest extends JMSTestCase
|
||||
{
|
||||
synchronized (waitMonitor)
|
||||
{
|
||||
waitMonitor.wait();
|
||||
while (running.get())
|
||||
{
|
||||
waitMonitor.wait();
|
||||
}
|
||||
}
|
||||
t1 = System.currentTimeMillis();
|
||||
receivedObject = topicConsumer.receive(timeToWait);
|
||||
@ -2306,13 +2319,16 @@ public class MessageConsumerTest extends JMSTestCase
|
||||
ThreadCloser closer = null;
|
||||
ThreadReceiver receiver = null;
|
||||
|
||||
closer = new ThreadCloser(monitor, 1000, topicConsumer);
|
||||
receiver = new ThreadReceiver(monitor, 2000, topicConsumer);
|
||||
AtomicBoolean running = new AtomicBoolean(true);
|
||||
|
||||
closer = new ThreadCloser(running, monitor, 1000, topicConsumer);
|
||||
receiver = new ThreadReceiver(running, monitor, 2000, topicConsumer);
|
||||
closer.start();
|
||||
receiver.start();
|
||||
Thread.sleep(2000);
|
||||
synchronized (monitor)
|
||||
{
|
||||
running.set(false);
|
||||
monitor.notifyAll();
|
||||
}
|
||||
closer.join();
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package org.apache.activemq.artemis.jms.tests.tools.container;
|
||||
|
||||
import javax.management.MBeanServerInvocationHandler;
|
||||
import javax.management.ObjectName;
|
||||
import javax.naming.InitialContext;
|
||||
import java.io.File;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.ArrayList;
|
||||
@ -25,10 +28,6 @@ import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.management.MBeanServerInvocationHandler;
|
||||
import javax.management.ObjectName;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
|
||||
@ -393,20 +392,6 @@ public class LocalTestServer implements Server, Runnable
|
||||
// bootstrap.run();
|
||||
|
||||
started = true;
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
notify();
|
||||
try
|
||||
{
|
||||
wait();
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -214,7 +214,7 @@ public class ConnectionTest extends PTPTestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
wait(1000);
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ public class MessageHeaderTest extends PTPTestCase
|
||||
message.setJMSMessageID("ID:foo");
|
||||
sender.send(message);
|
||||
Assert.assertTrue("sec. 3.4.3 When a message is sent this value is ignored.\n",
|
||||
message.getJMSMessageID() != "ID:foo");
|
||||
!message.getJMSMessageID().equals("ID:foo"));
|
||||
receiver.receive(TestConfig.TIMEOUT);
|
||||
}
|
||||
catch (JMSException e)
|
||||
|
@ -15,11 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.objectweb.jtests.jms.framework;
|
||||
import javax.jms.JMSException;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@ -59,11 +58,11 @@ public abstract class JMSTestCase extends Assert
|
||||
{
|
||||
message += " [linked exception: " + linkedException + "]";
|
||||
}
|
||||
super.fail(message);
|
||||
Assert.fail(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.fail(e.getMessage());
|
||||
Assert.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public abstract class ClientAbstract extends Thread
|
||||
|
||||
protected volatile boolean running = true;
|
||||
|
||||
protected volatile int errors = 0;
|
||||
protected int errors = 0;
|
||||
|
||||
/**
|
||||
* A commit was called
|
||||
|
@ -15,13 +15,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.artemis.tests.timing.core.server.impl;
|
||||
import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeQueueFactory;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
import org.junit.Before;
|
||||
import org.junit.After;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -33,6 +26,11 @@ import org.apache.activemq.artemis.core.server.ServerMessage;
|
||||
import org.apache.activemq.artemis.core.server.impl.QueueImpl;
|
||||
import org.apache.activemq.artemis.tests.unit.UnitTestLogger;
|
||||
import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeConsumer;
|
||||
import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeQueueFactory;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -128,7 +126,7 @@ public class QueueConcurrentTest extends ActiveMQTestBase
|
||||
|
||||
private final long testTime;
|
||||
|
||||
private volatile int i;
|
||||
private int i;
|
||||
|
||||
public Exception getException()
|
||||
{
|
||||
@ -181,7 +179,7 @@ public class QueueConcurrentTest extends ActiveMQTestBase
|
||||
|
||||
private boolean toggle;
|
||||
|
||||
private volatile int numToggles;
|
||||
private int numToggles;
|
||||
|
||||
public int getNumToggles()
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ public abstract class AIOTestBase extends ActiveMQTestBase
|
||||
|
||||
volatile boolean doneCalled = false;
|
||||
|
||||
volatile int errorCalled = 0;
|
||||
int errorCalled = 0;
|
||||
|
||||
final AtomicInteger timesDoneCalled = new AtomicInteger(0);
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class SSLSupportTest extends ActiveMQTestBase
|
||||
trustStorePath = "server-side-truststore." + storeType.toLowerCase();
|
||||
}
|
||||
|
||||
private static String storeType;
|
||||
private String storeType;
|
||||
|
||||
private String keyStorePath;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user