Permalink
Browse files

Merge pull request #1536 from scop/cleanups

Various cleanups
  • Loading branch information...
2 parents 1478938 + 0853dc1 commit bb7614ce854c51890b0a3171d215182c09bbe557 Justin Bertram committed Feb 13, 2014
Showing with 38 additions and 39 deletions.
  1. +1 −1 ...connection-factory/src/main/java/org/hornetq/jms/example/InstantiateConnectionFactoryExample.java
  2. +1 −1 examples/jms/symmetric-cluster/src/main/java/org/hornetq/jms/example/SymmetricClusterExample.java
  3. +0 −2 hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java
  4. +1 −1 hornetq-core-client/src/main/java/org/hornetq/utils/HornetQBufferInputStream.java
  5. +2 −2 hornetq-rest/src/test/java/org/hornetq/rest/test/JMSTest.java
  6. +1 −1 hornetq-rest/src/test/java/org/hornetq/rest/test/RepostingQueueTest.java
  7. +1 −1 hornetq-rest/src/test/java/org/hornetq/rest/test/SelectorTest.java
  8. +3 −3 hornetq-rest/src/test/java/org/hornetq/rest/test/TransformTest.java
  9. +2 −2 hornetq-server/src/main/java/org/hornetq/core/persistence/impl/journal/DescribeJournal.java
  10. +1 −1 hornetq-tools/src/main/java/org/hornetq/tools/PrintPages.java
  11. +3 −0 hornetq-tools/src/main/java/org/hornetq/tools/XmlDataExporter.java
  12. +1 −1 ...aerogear-integration/src/main/java/org/hornetq/integration/aerogear/AeroGearConnectorService.java
  13. +1 −1 tests/concurrent-tests/src/test/java/org/hornetq/tests/concurrent/stomp/ConcurrentStompTest.java
  14. +1 −1 tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
  15. +1 −1 ...n-tests/src/test/java/org/hornetq/tests/integration/jms/ManualReconnectionToSingleServerTest.java
  16. +2 −2 tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java
  17. +1 −1 ...gration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/ClusteredBridgeTestBase.java
  18. +1 −2 ...ion-tests/src/test/java/org/hornetq/tests/integration/jms/cluster/MultipleThreadsOpeningTest.java
  19. +1 −1 ...-tests/src/test/java/org/hornetq/tests/integration/jms/connection/ConcurrentSessionCloseTest.java
  20. +1 −2 tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java
  21. +2 −2 .../integration-tests/src/test/java/org/hornetq/tests/integration/jms/jms2client/JmsContextTest.java
  22. +5 −5 ...tion-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
  23. +1 −1 tests/integration-tests/src/test/java/org/hornetq/tests/integration/remoting/PingTest.java
  24. +1 −1 ...tegration-tests/src/test/java/org/hornetq/tests/integration/stomp/util/StompClientConnection.java
  25. +2 −2 tests/integration-tests/src/test/java/org/hornetq/tests/util/JMSClusteredTestBase.java
  26. +1 −1 tests/timing-tests/src/test/java/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
@@ -66,7 +66,7 @@ public boolean runExample() throws Exception
connectionParams);
// Step 3 Directly instantiate the JMS ConnectionFactory object using that TransportConfiguration
- ConnectionFactory cf = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration);
+ ConnectionFactory cf = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration);
// Step 4.Create a JMS Connection
connection = cf.createConnection();
@@ -81,7 +81,7 @@ public boolean runExample() throws Exception
UDPBroadcastGroupConfiguration udpCfg = new UDPBroadcastGroupConfiguration("231.7.7.7", 9876, null, -1);
DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration(HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT, HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT, udpCfg);
- ConnectionFactory cf = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.CF);
+ ConnectionFactory cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.CF);
// We give a little while for each server to broadcast its whereabouts to the client
Thread.sleep(2000);
@@ -35,8 +35,6 @@ private UTF8Util()
// utility class
}
- static boolean optimizeStrings = true;
-
private static final boolean isTrace = HornetQUtilLogger.LOGGER.isTraceEnabled();
private static final ThreadLocal<SoftReference<StringUtilBuffer>> currenBuffer =
@@ -122,7 +122,7 @@ public long skip(final long len) throws IOException
int size = Math.min(remainingBytes(), (int) len);
- bb.skipBytes((int)size);
+ bb.skipBytes(size);
return size;
}
@@ -271,7 +271,7 @@ public void testJmsProducer() throws Exception
ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").accept("application/json").post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals("application/json", res.getHeaders().getFirst("Content-Type").toString().toLowerCase());
- Order order2 = (Order) res.getEntity(Order.class);
+ Order order2 = res.getEntity(Order.class);
res.releaseConnection();
Assert.assertEquals(order, order2);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
@@ -288,7 +288,7 @@ public void testJmsProducer() throws Exception
ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals("application/xml", res.getHeaders().getFirst("Content-Type").toString().toLowerCase());
- Order order2 = (Order) res.getEntity(Order.class);
+ Order order2 = res.getEntity(Order.class);
res.releaseConnection();
Assert.assertEquals(order, order2);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
@@ -384,7 +384,7 @@ public void testRepostAckAfterUnacknowledge() throws Exception
System.out.println("create: " + sender);
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
- response = response = Util.setAutoAck(consumers, false);
+ response = Util.setAutoAck(consumers, false);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
@@ -325,7 +325,7 @@ private Link consumeOrder(Order order, Link consumeNext)
ClientResponse<?> response = consumeNext.request().header("Accept-Wait", "4").accept("application/xml").post(String.class);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("application/xml", response.getHeaders().getFirst("Content-Type").toString().toLowerCase());
- Order order2 = (Order) response.getEntity(Order.class);
+ Order order2 = response.getEntity(Order.class);
Assert.assertEquals(order, order2);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
Assert.assertNotNull(consumeNext);
@@ -151,7 +151,7 @@ public void testTransform() throws Exception
response = consumeNext.request().accept("application/xml").post(String.class);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("application/xml", response.getHeaders().getFirst("Content-Type").toString().toLowerCase());
- Order order2 = (Order) response.getEntity(Order.class);
+ Order order2 = response.getEntity(Order.class);
response.releaseConnection();
Assert.assertEquals(order, order2);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
@@ -168,7 +168,7 @@ public void testTransform() throws Exception
response = consumeNext.request().accept("application/json").post(String.class);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("application/json", response.getHeaders().getFirst("Content-Type").toString().toLowerCase());
- Order order2 = (Order) response.getEntity(Order.class);
+ Order order2 = response.getEntity(Order.class);
response.releaseConnection();
Assert.assertEquals(order, order2);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
@@ -185,7 +185,7 @@ public void testTransform() throws Exception
response = consumeNext.request().post(String.class);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("application/xml", response.getHeaders().getFirst("Content-Type").toString().toLowerCase());
- Order order2 = (Order) response.getEntity(Order.class);
+ Order order2 = response.getEntity(Order.class);
response.releaseConnection();
Assert.assertEquals(order, order2);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
@@ -222,7 +222,7 @@ else if (info.getUserRecordType() == JournalRecordIds.PAGE_CURSOR_COUNTER_INC)
PageSubscriptionCounterImpl subsCounter = lookupCounter(counters, queueIDForCounter);
- subsCounter.loadInc(info.id, (int)encoding.value);
+ subsCounter.loadInc(info.id, encoding.value);
subsCounter.processReload();
out.print("#Counter queue " + queueIDForCounter + " value=" + subsCounter.getValue() + " increased by " + encoding.value);
if (subsCounter.getValue() < 0)
@@ -335,7 +335,7 @@ else if (info.getUserRecordType() == JournalRecordIds.PAGE_CURSOR_COUNTER_INC)
subsCounter = lookupCounter(counters, queueIDForCounter);
- subsCounter.loadInc(info.id, (int)encoding.value);
+ subsCounter.loadInc(info.id, encoding.value);
subsCounter.processReload();
}
@@ -73,7 +73,7 @@ public static void printPages(String pageDirectory, String messagesDirectory)
final ExecutorService executor = Executors.newFixedThreadPool(10);
ExecutorFactory execfactory = new ExecutorFactory()
{
-
+ @Override
public Executor getExecutor()
{
return executor;
@@ -144,6 +144,7 @@ public XmlDataExporter(OutputStream out, String bindingsDir, String journalDir,
final ExecutorService executor = Executors.newFixedThreadPool(1);
ExecutorFactory executorFactory = new ExecutorFactory()
{
+ @Override
public Executor getExecutor()
{
return executor;
@@ -756,6 +757,7 @@ private void printPagedMessagesAsXML()
final ExecutorService executor = Executors.newFixedThreadPool(10);
ExecutorFactory executorFactory = new ExecutorFactory()
{
+ @Override
public Executor getExecutor()
{
return executor;
@@ -1068,6 +1070,7 @@ public PrettyPrintHandler(XMLStreamWriter target)
this.target = target;
}
+ @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
String m = method.getName();
@@ -363,7 +363,7 @@ public void run()
}
}
-
+ @Override
public List<MessageReference> getDeliveringMessages()
{
return Collections.emptyList();
@@ -85,7 +85,7 @@ public void run()
break;
}
}
- };
+ }
}.start();
String send = "SEND\n" + "destination:" + getQueuePrefix() + getQueueName() + "\n";
@@ -1514,7 +1514,7 @@ public void testBridgeWithPaging() throws Exception
for (int i = 0; i < numMessages; i++)
{
- AtomicInteger msgCount = receivedMsg.get((Integer) i);
+ AtomicInteger msgCount = receivedMsg.get(Integer.valueOf(i));
if (msgCount == null)
{
System.err.println("Msg " + i + " wasn't received");
@@ -299,6 +299,6 @@ public void onMessage(final Message msg)
allMessagesReceived.countDown();
}
}
- };
+ }
}
@@ -237,7 +237,7 @@ public ConnectionFactory createConnectionFactory() throws Exception
cf.setCacheLargeMessagesClient(true);
cf.setProducerWindowSize(100);
- return (ConnectionFactory) cf;
+ return cf;
}
};
@@ -257,7 +257,7 @@ public ConnectionFactory createConnectionFactory() throws Exception
cf.setBlockOnDurableSend(true);
cf.setCacheLargeMessagesClient(true);
- return (ConnectionFactory) cf;
+ return cf;
}
};
@@ -221,7 +221,7 @@ public ConnectionFactory createConnectionFactory() throws Exception
HornetQConnectionFactory cf = HornetQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.XA_CF,
liveConnector);
cf.getServerLocator().setReconnectAttempts(-1);
- return (ConnectionFactory) cf;
+ return cf;
}
};
@@ -13,7 +13,6 @@
package org.hornetq.tests.integration.jms.cluster;
import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
import javax.jms.Session;
import java.util.concurrent.CountDownLatch;
@@ -35,7 +34,7 @@
@Test
public void testMultipleOpen() throws Exception
{
- cf1 = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, new TransportConfiguration(InVMConnectorFactory.class.getName(),
+ cf1 = HornetQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, new TransportConfiguration(InVMConnectorFactory.class.getName(),
generateInVMParams(0)));
final int numberOfOpens = 2000;
@@ -100,7 +100,7 @@ public void run()
failed.set(true);
}
- };
+ }
};
threads[i].start();
}
@@ -13,7 +13,6 @@
package org.hornetq.tests.integration.jms.consumer;
import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
import javax.jms.JMSConsumer;
import javax.jms.JMSContext;
import javax.jms.JMSException;
@@ -75,7 +74,7 @@ public void setUp() throws Exception
jmsServer.createQueue(false, ConsumerTest.Q_NAME, null, true, ConsumerTest.Q_NAME);
jmsServer.createTopic(true, T_NAME, "/topic/" + T_NAME);
jmsServer.createTopic(true, T2_NAME, "/topic/" + T2_NAME);
- cf = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
+ cf = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
}
@Override
@@ -573,14 +573,14 @@ public void bytesMessage() throws Exception
BytesMessage bMsg = context.createBytesMessage();
bMsg.setStringProperty("COM_SUN_JMS_TESTNAME", "sendAndRecvMsgOfEachTypeCLTest");
bMsg.writeByte((byte) 1);
- bMsg.writeInt((int) 22);
+ bMsg.writeInt(22);
CountDownLatch latch = new CountDownLatch(1);
SimpleCompletionListener listener = new SimpleCompletionListener(latch);
producer.setAsync(listener);
producer.send(queue1, bMsg);
assertTrue(latch.await(5, TimeUnit.SECONDS));
assertEquals(listener.message.readByte(), (byte) 1);
- assertEquals(listener.message.readInt(), (int) 22);
+ assertEquals(listener.message.readInt(), 22);
}
finally
{
@@ -75,13 +75,13 @@ public void testAttributes() throws Exception
checkResource(ObjectNameBuilder.DEFAULT.getBridgeObjectName(bridgeConfig.getName()));
CoreMessagingProxy proxy = createProxy(bridgeConfig.getName());
- Assert.assertEquals(bridgeConfig.getName(), (String)proxy.retrieveAttributeValue("name"));
+ Assert.assertEquals(bridgeConfig.getName(), proxy.retrieveAttributeValue("name"));
Assert.assertEquals(bridgeConfig.getDiscoveryGroupName(),
- (String)proxy.retrieveAttributeValue("discoveryGroupName"));
- Assert.assertEquals(bridgeConfig.getQueueName(), (String)proxy.retrieveAttributeValue("queueName"));
+ proxy.retrieveAttributeValue("discoveryGroupName"));
+ Assert.assertEquals(bridgeConfig.getQueueName(), proxy.retrieveAttributeValue("queueName"));
Assert.assertEquals(bridgeConfig.getForwardingAddress(),
- (String)proxy.retrieveAttributeValue("forwardingAddress"));
- Assert.assertEquals(bridgeConfig.getFilterString(), (String)proxy.retrieveAttributeValue("filterString"));
+ proxy.retrieveAttributeValue("forwardingAddress"));
+ Assert.assertEquals(bridgeConfig.getFilterString(), proxy.retrieveAttributeValue("filterString"));
Assert.assertEquals(bridgeConfig.getRetryInterval(),
((Long)proxy.retrieveAttributeValue("retryInterval")).longValue());
Assert.assertEquals(bridgeConfig.getRetryIntervalMultiplier(),
@@ -93,7 +93,7 @@ public HornetQException getException()
public void beforeReconnect(final HornetQException exception)
{
}
- };
+ }
/*
* Test that no failure listeners are triggered in a non failure case with pinging going on
@@ -26,7 +26,7 @@
ClientStompFrame receiveFrame() throws InterruptedException;
- ClientStompFrame receiveFrame(long timeout) throws InterruptedException;;
+ ClientStompFrame receiveFrame(long timeout) throws InterruptedException;
ClientStompFrame connect() throws Exception;
@@ -127,9 +127,9 @@ public void setUp() throws Exception
waitForTopology(jmsServer2.getHornetQServer(), 2);
- cf1 = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(InVMConnectorFactory.class.getName(),
+ cf1 = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(InVMConnectorFactory.class.getName(),
generateInVMParams(0)));
- cf2 = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(InVMConnectorFactory.class.getName(),
+ cf2 = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(InVMConnectorFactory.class.getName(),
generateInVMParams(1)));
}
@@ -472,7 +472,7 @@ public void doTestAutoAckOnSource(int maxBatchSize) throws Exception
sourceConn.close();
- JMSQueueControl jmsQueueControl = (JMSQueueControl) MBeanServerInvocationHandler.newProxyInstance(
+ JMSQueueControl jmsQueueControl = MBeanServerInvocationHandler.newProxyInstance(
ManagementFactory.getPlatformMBeanServer(),
ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(JMSBridgeImplTest.SOURCE),
JMSQueueControl.class,

0 comments on commit bb7614c

Please sign in to comment.