This closes #679

This commit is contained in:
Clebert Suconic 2016-07-28 12:32:36 -04:00
commit 85878513a5
44 changed files with 18 additions and 89 deletions

View File

@ -340,6 +340,7 @@ public final class JsonUtil {
return getString();
}
@Override
public String toString() {
if (this.value == null) {
return null;

View File

@ -374,7 +374,7 @@ public class ClientProducerImpl implements ClientProducerInternal {
for (long pos = 0; pos < bodySize; ) {
final boolean lastChunk;
final int chunkLength = (int) Math.min((bodySize - pos), (long) minLargeMessageSize);
final int chunkLength = (int) Math.min((bodySize - pos), minLargeMessageSize);
final ActiveMQBuffer bodyBuffer = ActiveMQBuffers.fixedBuffer(chunkLength);

View File

@ -254,7 +254,7 @@ public class JDBCSequentialFileFactoryDriver extends AbstractJDBCDriver {
if (rs.next()) {
Blob blob = rs.getBlob(1);
readLength = (int) calculateReadLength(blob.length(), bytes.remaining(), file.position());
byte[] data = blob.getBytes(file.position() + 1, (int) readLength);
byte[] data = blob.getBytes(file.position() + 1, readLength);
bytes.put(data);
}
connection.commit();

View File

@ -146,7 +146,7 @@ final class MappedFile implements AutoCloseable {
* then the position is updated with the number of bytes actually read.
*/
public int read(ByteBuf dst, int dstStart, int dstLength) throws IOException {
final int remaining = (int) Math.min(this.length - this.position, (long) Integer.MAX_VALUE);
final int remaining = (int) Math.min(this.length - this.position, Integer.MAX_VALUE);
final int read = Math.min(remaining, dstLength);
final int bufferPosition = checkOffset(position, read);
final long srcAddress = PlatformDependent.directBufferAddress(lastMapped) + bufferPosition;
@ -172,7 +172,7 @@ final class MappedFile implements AutoCloseable {
* then the position is updated with the number of bytes actually read.
*/
public int read(ByteBuffer dst, int dstStart, int dstLength) throws IOException {
final int remaining = (int) Math.min(this.length - this.position, (long) Integer.MAX_VALUE);
final int remaining = (int) Math.min(this.length - this.position, Integer.MAX_VALUE);
final int read = Math.min(remaining, dstLength);
final int bufferPosition = checkOffset(position, read);
final long srcAddress = PlatformDependent.directBufferAddress(lastMapped) + bufferPosition;

View File

@ -153,7 +153,6 @@ public class TimeoutTask implements Runnable {
// Finally, freely shutdown all expired consumers.
if (expiredCallbacks.size() > 0) {
long startTime = System.currentTimeMillis();
List<String> tokens = new ArrayList<>(expiredCallbacks.size());
for (String token : expiredCallbacks.keySet()) {
tokens.add(token);

View File

@ -68,7 +68,6 @@ public class ColocatedActiveMQServer extends ActiveMQServerImpl {
@Override
protected NodeManager createNodeManager(final File directory, boolean replicatingBackup) {
if (replicatingBackup) {
NodeManager manager;
if (getConfiguration().getJournalType() == JournalType.ASYNCIO && LibaioContext.isLoaded()) {
return new AIOFileLockNodeManager(directory, replicatingBackup, getConfiguration().getJournalLockAcquisitionTimeout());
}

View File

@ -11,7 +11,7 @@ still unsolved. This is specially true for the ['site' plugin](https://maven.apa
#### Upgrading the `gitbook` version and regenerating the `npm-shrinkwrap.json` file
The full release uses `gitbook` to build a static website from the documentation. This is automatically installed using
an `NPM` plugin and is controled via a package.json file.
an `NPM` plugin and is controlled via a package.json file.
Install `NPM` using the instructions below

View File

@ -367,7 +367,7 @@ application state) using a database. N.B. Address full policy Paging (See: [The
supported with the JDBC persistence layer.
Using the ActiveMQ Artemis File Journal is the recommended configuration as it offers higher levels of performance and is
more mature. The JDBC persistence layer is targetted to those users who must use a database e.g. due to internal company
more mature. The JDBC persistence layer is targeted to those users who must use a database e.g. due to internal company
policy.
ActiveMQ Artemis currently has support for a limited number of database vendors (older versions may work but mileage may

View File

@ -23,7 +23,6 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.InitialContext;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
@ -39,10 +38,6 @@ public class ClusteredTopicExample {
Connection connection1 = null;
InitialContext ic0 = null;
InitialContext ic1 = null;
try {
// Step 1. Instantiate topic
@ -116,14 +111,6 @@ public class ClusteredTopicExample {
if (connection1 != null) {
connection1.close();
}
if (ic0 != null) {
ic0.close();
}
if (ic1 != null) {
ic1.close();
}
}
}
}

View File

@ -1241,9 +1241,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.16</version>
<version>2.17</version>
<configuration>
<configLocation>${activemq.basedir}/etc/checkstyle.xml</configLocation>
<suppressionsLocation>${activemq.basedir}/etc/checkstyle-suppressions.xml</suppressionsLocation>
<failsOnError>false</failsOnError>
</configuration>
</plugin>

View File

@ -31,7 +31,6 @@ import org.apache.activemq.TransportLoggerSupport;
import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper;
import org.apache.activemq.broker.BrokerRegistry;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper;
import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.activemq.transport.*;
import org.apache.activemq.util.IOExceptionSupport;

View File

@ -26,7 +26,6 @@ import javax.jms.Session;
import junit.framework.TestCase;
import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.transport.tcp.TcpTransportFactory;

View File

@ -36,7 +36,6 @@ import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.test.JmsResourceProvider;
import org.apache.activemq.test.TestSupport;
import org.apache.activemq.transport.tcp.TcpTransportFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -26,7 +26,6 @@ import javax.jms.Session;
import junit.framework.TestCase;
import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.transport.tcp.TcpTransportFactory;

View File

@ -23,14 +23,10 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.jms.TransactionRolledBackException;
import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.transaction.Synchronization;
import org.apache.activemq.transport.tcp.TcpTransportFactory;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class TransactionContextTest {

View File

@ -35,7 +35,6 @@ public class SpringPartitionBrokerTest extends TestCase {
Partitioning config = plugin.getConfig();
assertEquals(2, config.getBrokers().size());
Object o;
String json = "{\n" +
" \"by_client_id\":{\n" +
" \"client1\":{\"ids\":[\"broker1\"]},\n" +

View File

@ -169,7 +169,7 @@ public class QueueDuplicatesFromStoreTest extends TestCase {
@Override
public void destroy() {
};
}
@Override
public void gc() {

View File

@ -104,9 +104,7 @@ public class OpenTypeSupportTest {
private String extractText(CompositeData message) {
Byte content[] = (Byte[]) message.get(CompositeDataConstants.BODY_PREVIEW);
byte out[] = new byte[content.length];
for (int i = 0; i < content.length; i++) {
out[i] = content[i];
}
System.arraycopy(content, 0, out, 0, content.length);
return new String(out);
}

View File

@ -24,7 +24,6 @@ import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javax.jms.BytesMessage;

View File

@ -31,7 +31,6 @@ import junit.framework.Test;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.JmsTestSupport;
import org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManagerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter;

View File

@ -27,7 +27,6 @@ import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -22,8 +22,6 @@ import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Session;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.api.jms.management.JMSServerControl;

View File

@ -20,7 +20,6 @@ import static org.junit.Assert.assertTrue;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@ -41,7 +40,6 @@ import org.apache.activemq.ActiveMQMessageTransformation;
import org.apache.activemq.ActiveMQSession;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection;
import org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConnectionContext;
import org.apache.activemq.artemis.core.server.impl.QueueImpl;
import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;

View File

@ -17,7 +17,6 @@
package org.apache.activemq.transport.failover;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@ -34,7 +33,6 @@ import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection;
import org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConnectionContext;
import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;
import org.apache.activemq.util.Wait;

View File

@ -25,14 +25,12 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection;
import org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConnectionContext;
import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;
import org.jboss.byteman.contrib.bmunit.BMRule;

View File

@ -18,7 +18,6 @@ package org.apache.activemq.transport.failover;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.broker.region.policy.PolicyMap;
import org.junit.Test;

View File

@ -29,16 +29,11 @@ import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.TransportConnector;
import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;
import org.apache.activemq.network.NetworkConnector;
import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Assert;

View File

@ -76,7 +76,7 @@ public class InitalReconnectDelayTest extends OpenwireArtemisBaseTest {
producer.send(session.createTextMessage("TEST"));
end = (new Date()).getTime();
//Inital reconnection should kick in and be darned close to what we expected
//Initial reconnection should kick in and be darned close to what we expected
LOG.info("Failover took " + (end - start) + " ms.");
assertTrue("Failover took " + (end - start) + " ms and should be > 14000.", (end - start) > 14000);
connection.close();

View File

@ -23,12 +23,8 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;
import org.apache.activemq.util.MessageIdList;
import org.junit.After;

View File

@ -217,7 +217,7 @@ public class FanoutTransportBrokerTest extends OpenwireArtemisBaseTest {
// The MockTransport is on the remote connection.
// Slip in a new transport filter after the MockTransport
MockTransport mt = (MockTransport) connection3.getTransport().narrow(MockTransport.class);
MockTransport mt = connection3.getTransport().narrow(MockTransport.class);
mt.install(new TransportFilter(mt.getNext()) {
@Override
public void oneway(Object command) throws IOException {

View File

@ -21,7 +21,6 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.apache.activemq.EmbeddedBrokerTestSupport;

View File

@ -293,7 +293,7 @@ public abstract class AmqpAbstractResource<E extends Endpoint> implements AmqpRe
}
/**
* When aborting the open operation, and there isnt an error condition,
* When aborting the open operation, and there isn't an error condition,
* provided by the peer, the returned exception will be used instead.
* A subclass may override this method to provide alternative behaviour.
*/

View File

@ -25,10 +25,10 @@ import org.apache.qpid.proton.amqp.UnsignedLong;
*/
public class AmqpUnknownFilterType implements DescribedType {
public static final AmqpUnknownFilterType UNKOWN_FILTER = new AmqpUnknownFilterType();
public static final AmqpUnknownFilterType UNKNOWN_FILTER = new AmqpUnknownFilterType();
public static final UnsignedLong UNKNOWN_FILTER_CODE = UnsignedLong.valueOf(0x0000468C00000099L);
public static final Symbol UNKNOWN_FILTER_NAME = Symbol.valueOf("apache.org:unkown-filter:string");
public static final Symbol UNKNOWN_FILTER_NAME = Symbol.valueOf("apache.org:unknown-filter:string");
public static final Object[] UNKNOWN_FILTER_IDS = new Object[]{UNKNOWN_FILTER_CODE, UNKNOWN_FILTER_NAME};
private final String payload;

View File

@ -88,7 +88,7 @@ public class FailureXATest extends ActiveMQTestBase {
private void doTestCrashServerAfterXACommit(boolean onePhase) throws Exception {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
XAConnection connection = (XAConnection) connectionFactory.createXAConnection();
XAConnection connection = connectionFactory.createXAConnection();
try {
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);

View File

@ -91,8 +91,6 @@ public class GroupingTest extends JMSTestBase {
connection.start();
connection2.start();
final String jmsxgroupID = null;
Thread t = new Thread(new Runnable() {
@Override
public void run() {

View File

@ -89,7 +89,7 @@ public class SendingAndReceivingTest extends ActiveMQTestBase {
private static String createMessage(int messageSize) {
final String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Random rnd = new Random();
StringBuilder sb = new StringBuilder((int) messageSize);
StringBuilder sb = new StringBuilder(messageSize);
for (int j = 0; j < messageSize; j++ ) {
sb.append(AB.charAt(rnd.nextInt(AB.length())));
}

View File

@ -484,7 +484,6 @@ public class WildCardRoutingTest extends ActiveMQTestBase {
public void testWildcardRoutingWithHashMultiLengthAddresses() throws Exception {
SimpleString addressAB = new SimpleString("a.b.c.f");
SimpleString addressAC = new SimpleString("a.c.f");
SimpleString addressAD = new SimpleString("a.d");
SimpleString address = new SimpleString("a.#.f");
SimpleString queueName1 = new SimpleString("Q1");
SimpleString queueName2 = new SimpleString("Q2");

View File

@ -32,8 +32,6 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class JDBCJournalTest extends ActiveMQTestBase {
@Rule

View File

@ -215,9 +215,6 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase {
private void testSettersThrowException(final ActiveMQConnectionFactory cf) {
String discoveryAddress = RandomUtil.randomString();
int discoveryPort = RandomUtil.randomPositiveInt();
long discoveryRefreshTimeout = RandomUtil.randomPositiveLong();
String clientID = RandomUtil.randomString();
long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
long connectionTTL = RandomUtil.randomPositiveLong();
@ -235,14 +232,12 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase {
String loadBalancingPolicyClassName = RandomUtil.randomString();
int dupsOKBatchSize = RandomUtil.randomPositiveInt();
int transactionBatchSize = RandomUtil.randomPositiveInt();
long initialWaitTimeout = RandomUtil.randomPositiveLong();
boolean useGlobalPools = RandomUtil.randomBoolean();
int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt();
int threadPoolMaxSize = RandomUtil.randomPositiveInt();
long retryInterval = RandomUtil.randomPositiveLong();
double retryIntervalMultiplier = RandomUtil.randomDouble();
int reconnectAttempts = RandomUtil.randomPositiveInt();
boolean failoverOnServerShutdown = RandomUtil.randomBoolean();
try {
cf.setClientID(clientID);

View File

@ -133,7 +133,6 @@ public class OpenWireTestBase extends ActiveMQTestBase {
final double retryIntervalMultiplier = 1.0;
final int reconnectAttempts = -1;
final int callTimeout = 30000;
final boolean ha = false;
List<String> connectorNames = registerConnectors(server, connectorConfigs);
String cfName = name.getMethodName();

View File

@ -20,7 +20,6 @@ import org.apache.activemq.artemis.core.persistence.GroupingInfo;
import org.apache.activemq.artemis.core.persistence.QueueBindingInfo;
import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager;
import org.apache.activemq.artemis.core.postoffice.PostOffice;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeJournalLoader;
import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOffice;
@ -31,9 +30,7 @@ import org.junit.Test;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
public class RestartSMTest extends ActiveMQTestBase {
@ -78,8 +75,6 @@ public class RestartSMTest extends ActiveMQTestBase {
journal.loadBindingJournal(queueBindingInfos, new ArrayList<GroupingInfo>());
Map<Long, Queue> queues = new HashMap<>();
journal.loadMessageJournal(postOffice, null, null, null, null, null, null, new FakeJournalLoader());
journal.stop();
@ -88,8 +83,6 @@ public class RestartSMTest extends ActiveMQTestBase {
journal.start();
queues = new HashMap<>();
journal.loadMessageJournal(postOffice, null, null, null, null, null, null, new FakeJournalLoader());
queueBindingInfos = new ArrayList<>();

View File

@ -142,9 +142,6 @@ public class ActiveMQClusteredTest extends ActiveMQRAClusteredTestBase {
managedConnections.add(mc);
ActiveMQConnectionFactory cf1 = mc.getConnectionFactory();
long timeout = 10000;
long now = System.currentTimeMillis();
while (!((ServerLocatorImpl)cf1.getServerLocator()).isReceivedTopology()) {
Thread.sleep(50);
}

View File

@ -133,7 +133,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase {
String testBalancer = "testBalancer";
String testParams = "key=val";
String testaddress = "testaddress";
String loadbalancer = "loadbalancer";
String testpass = "testpass";
String testuser = "testuser";
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
@ -153,7 +152,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase {
String testBalancer = "testBalancer2";
String testParams = "key=val2";
String testaddress = "testaddress2";
String loadbalancer = "loadbalancer2";
String testpass = "testpass2";
String testuser = "testuser2";
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();

View File

@ -60,8 +60,6 @@ public class PreACKPerf extends AbstractSendReceivePerfTest {
}
long end = System.currentTimeMillis();
printMsgsSec(start, nmessages);
}