You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2016/09/30 15:26:33 UTC
[33/52] [partial] activemq-artemis git commit: ARTEMIS-765 Improve
Checkstyle
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASession.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASession.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASession.java
index 05006e4..f123379 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASession.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASession.java
@@ -136,8 +136,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
final ActiveMQRAManagedConnection mcLocal = this.mc;
if (mcLocal != null) {
mcLocal.tryLock();
- }
- else {
+ } else {
throw new IllegalStateException("Connection is not associated with a managed connection. " + this);
}
}
@@ -398,8 +397,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
}
session.commit();
- }
- finally {
+ } finally {
unlock();
}
}
@@ -429,8 +427,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
}
session.rollback();
- }
- finally {
+ } finally {
unlock();
}
}
@@ -455,8 +452,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
}
session.recover();
- }
- finally {
+ } finally {
unlock();
}
}
@@ -516,8 +512,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -559,8 +554,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -597,8 +591,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -644,8 +637,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -677,8 +669,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addProducer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -712,8 +703,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
sf.addTemporaryTopic(temp);
return temp;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -739,8 +729,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
}
session.unsubscribe(name);
- }
- finally {
+ } finally {
unlock();
}
}
@@ -857,8 +846,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -891,8 +879,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -924,8 +911,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addProducer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -959,8 +945,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
sf.addTemporaryQueue(temp);
return temp;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -992,8 +977,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1031,8 +1015,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1074,8 +1057,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1107,8 +1089,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addProducer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1147,11 +1128,9 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
lock();
return getXAResourceInternal();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
return null;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1187,8 +1166,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
lock();
try {
return this;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1213,8 +1191,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
lock();
try {
return this;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1239,8 +1216,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
lock();
try {
return this;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1266,8 +1242,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1295,8 +1270,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1321,8 +1295,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1351,8 +1324,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1378,8 +1350,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1407,8 +1378,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
addConsumer(result);
return result;
- }
- finally {
+ } finally {
unlock();
}
}
@@ -1504,8 +1474,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
try {
mc.stop();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.trace("Error stopping managed connection", t);
}
@@ -1514,8 +1483,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
ActiveMQRAMessageConsumer consumer = (ActiveMQRAMessageConsumer) i.next();
try {
consumer.closeConsumer();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.trace("Error closing consumer", t);
}
i.remove();
@@ -1527,8 +1495,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
ActiveMQRAMessageProducer producer = (ActiveMQRAMessageProducer) i.next();
try {
producer.closeProducer();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.trace("Error closing producer", t);
}
i.remove();
@@ -1644,8 +1611,7 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu
}
return xares;
- }
- catch (ResourceException e) {
+ } catch (ResourceException e) {
JMSException jmse = new JMSException("Unable to get XA Resource");
jmse.initCause(e);
throw jmse;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java
index 832871a..15746dd 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java
@@ -137,8 +137,7 @@ public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForCon
if (cm == null) {
this.cm = new ActiveMQRAConnectionManager();
- }
- else {
+ } else {
this.cm = cm;
}
@@ -653,8 +652,7 @@ public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForCon
ActiveMQRASession session = i.next();
try {
session.closeSession();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.trace("Error closing session", t);
}
i.remove();
@@ -669,8 +667,7 @@ public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForCon
ActiveMQRALogger.LOGGER.trace("Closing temporary queue " + temp + " for " + this);
}
temp.delete();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.trace("Error deleting temporary queue", t);
}
i.remove();
@@ -685,8 +682,7 @@ public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForCon
ActiveMQRALogger.LOGGER.trace("Closing temporary topic " + temp + " for " + this);
}
temp.delete();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.trace("Error deleting temporary queue", t);
}
i.remove();
@@ -829,10 +825,10 @@ public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForCon
// If the session
// is transacted, returns SESSION_TRANSACTED.
acknowledgeMode = Session.SESSION_TRANSACTED;
- }
- //In the Java EE web or EJB container, when there is no active JTA transaction in progress
- // The argument {@code transacted} is ignored.
- else {
+ } else {
+ //In the Java EE web or EJB container, when there is no active JTA transaction in progress
+ // The argument {@code transacted} is ignored.
+
//The session will always be non-transacted,
transacted = false;
switch (acknowledgeMode) {
@@ -880,23 +876,19 @@ public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForCon
sessions.add(session);
return session;
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
try {
session.close();
- }
- catch (Throwable ignored) {
+ } catch (Throwable ignored) {
}
if (t instanceof Exception) {
throw (Exception) t;
- }
- else {
+ } else {
throw new RuntimeException("Unexpected error: ", t);
}
}
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
Throwable current = e;
while (current != null && !(current instanceof JMSException)) {
current = current.getCause();
@@ -904,8 +896,7 @@ public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForCon
if (current != null && current instanceof JMSException) {
throw (JMSException) current;
- }
- else {
+ } else {
JMSException je = new JMSException("Could not create a session: " + e.getMessage());
je.setLinkedException(e);
je.initCause(e);
@@ -935,8 +926,7 @@ public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForCon
Transaction tx = null;
try {
tx = tm.getTransaction();
- }
- catch (SystemException e) {
+ } catch (SystemException e) {
//assume false
}
inJtaTx = tx != null;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAStreamMessage.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAStreamMessage.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAStreamMessage.java
index 02cfd73..ede85ee 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAStreamMessage.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAStreamMessage.java
@@ -16,10 +16,9 @@
*/
package org.apache.activemq.artemis.ra;
-import java.util.Arrays;
-
import javax.jms.JMSException;
import javax.jms.StreamMessage;
+import java.util.Arrays;
/**
* A wrapper for a message
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRATopicPublisher.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRATopicPublisher.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRATopicPublisher.java
index 6f37049..ee40f72 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRATopicPublisher.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRATopicPublisher.java
@@ -95,8 +95,7 @@ public class ActiveMQRATopicPublisher extends ActiveMQRAMessageProducer implemen
if (ActiveMQRATopicPublisher.trace) {
ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message);
}
- }
- finally {
+ } finally {
session.unlock();
}
}
@@ -122,8 +121,7 @@ public class ActiveMQRATopicPublisher extends ActiveMQRAMessageProducer implemen
if (ActiveMQRATopicPublisher.trace) {
ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message);
}
- }
- finally {
+ } finally {
session.unlock();
}
}
@@ -167,8 +165,7 @@ public class ActiveMQRATopicPublisher extends ActiveMQRAMessageProducer implemen
if (ActiveMQRATopicPublisher.trace) {
ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message);
}
- }
- finally {
+ } finally {
session.unlock();
}
}
@@ -195,8 +192,7 @@ public class ActiveMQRATopicPublisher extends ActiveMQRAMessageProducer implemen
if (ActiveMQRATopicPublisher.trace) {
ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message);
}
- }
- finally {
+ } finally {
session.unlock();
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAJMSContext.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAJMSContext.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAJMSContext.java
index bfee4bb..f0bf668 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAJMSContext.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAJMSContext.java
@@ -16,11 +16,11 @@
*/
package org.apache.activemq.artemis.ra;
+import javax.jms.XAJMSContext;
+
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContext;
import org.apache.activemq.artemis.jms.client.ThreadAwareContext;
-import javax.jms.XAJMSContext;
-
public class ActiveMQRAXAJMSContext extends ActiveMQRAJMSContext implements XAJMSContext {
public ActiveMQRAXAJMSContext(ActiveMQConnectionForContext connection, ThreadAwareContext threadAwareContext) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAResource.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAResource.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAResource.java
index 9d485f3..3f908c4 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAResource.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAXAResource.java
@@ -79,8 +79,7 @@ public class ActiveMQRAXAResource implements ActiveMQXAResource {
try {
//this resets any tx stuff, we assume here that the tm and jca layer are well behaved when it comes to this
sessionInternal.resetIfNeeded();
- }
- catch (ActiveMQException e) {
+ } catch (ActiveMQException e) {
ActiveMQRALogger.LOGGER.problemResettingXASession(e);
XAException xaException = new XAException(XAException.XAER_RMFAIL);
@@ -89,8 +88,7 @@ public class ActiveMQRAXAResource implements ActiveMQXAResource {
}
xaResource.start(xid, flags);
- }
- finally {
+ } finally {
managedConnection.setInManagedTx(true);
managedConnection.unlock();
}
@@ -112,8 +110,7 @@ public class ActiveMQRAXAResource implements ActiveMQXAResource {
managedConnection.lock();
try {
xaResource.end(xid, flags);
- }
- finally {
+ } finally {
managedConnection.setInManagedTx(false);
managedConnection.unlock();
}
@@ -181,8 +178,7 @@ public class ActiveMQRAXAResource implements ActiveMQXAResource {
managedConnection.lock();
try {
xaResource.forget(xid);
- }
- finally {
+ } finally {
managedConnection.setInManagedTx(true);
managedConnection.setInManagedTx(false);
managedConnection.unlock();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java
index 6103bc8..f67022e 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java
@@ -239,8 +239,7 @@ public final class ActiveMQRaUtils {
Object o = aClass.newInstance();
Method m = aClass.getMethod("locateChannel", new Class[]{String.class});
return (JChannel) m.invoke(o, name);
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
ActiveMQRALogger.LOGGER.debug(e.getMessage(), e);
return null;
}
@@ -261,17 +260,14 @@ public final class ActiveMQRaUtils {
try {
Class<?> clazz = loader.loadClass(className);
return clazz.newInstance();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
try {
loader = Thread.currentThread().getContextClassLoader();
if (loader != null)
return loader.loadClass(className).newInstance();
- }
- catch (RuntimeException e) {
+ } catch (RuntimeException e) {
throw e;
- }
- catch (Exception e) {
+ } catch (Exception e) {
}
throw new IllegalArgumentException("Could not find class " + className);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java
index 2804de2..e9b1323 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java
@@ -166,8 +166,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (!configured.getAndSet(true)) {
try {
setup();
- }
- catch (ActiveMQException e) {
+ } catch (ActiveMQException e) {
throw new ResourceException("Unable to create activation", e);
}
}
@@ -214,8 +213,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (useAutoRecovery) {
// let the TM handle the recovery
return null;
- }
- else {
+ } else {
List<XAResource> xaresources = new ArrayList<>();
for (ActivationSpec spec : specs) {
ActiveMQActivation activation = activations.get(spec);
@@ -248,8 +246,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (!configured.getAndSet(true)) {
try {
setup();
- }
- catch (ActiveMQException e) {
+ } catch (ActiveMQException e) {
throw new ResourceAdapterInternalException("Unable to create activation", e);
}
}
@@ -269,8 +266,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
for (Map.Entry<ActivationSpec, ActiveMQActivation> entry : activations.entrySet()) {
try {
entry.getValue().stop();
- }
- catch (Exception ignored) {
+ } catch (Exception ignored) {
ActiveMQRALogger.LOGGER.debug("Ignored", ignored);
}
}
@@ -1548,16 +1544,13 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
// as if any transaction times out, we need the ack on the server already
if (useLocalTx) {
result = parameterFactory.createSession(user, pass, false, false, false, false, 0);
- }
- else {
+ } else {
result = parameterFactory.createSession(user, pass, true, false, false, false, 0);
}
- }
- else {
+ } else {
if (preAck != null && preAck) {
result = parameterFactory.createSession(user, pass, false, true, true, true, -1);
- }
- else {
+ } else {
// only auto ack and dups ok are supported
switch (ackMode) {
case Session.AUTO_ACKNOWLEDGE:
@@ -1617,8 +1610,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (!configured.getAndSet(true)) {
try {
setup();
- }
- catch (ActiveMQException e) {
+ } catch (ActiveMQException e) {
throw new ResourceException("Unable to create activation", e);
}
}
@@ -1661,8 +1653,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (!knownConnectionFactories.keySet().contains(overrideProperties)) {
cf = newConnectionFactory(overrideProperties);
knownConnectionFactories.put(overrideProperties, new Pair<>(cf, new AtomicInteger(1)));
- }
- else {
+ } else {
Pair<ActiveMQConnectionFactory, AtomicInteger> pair = knownConnectionFactories.get(overrideProperties);
cf = pair.getA();
pair.getB().incrementAndGet();
@@ -1703,8 +1694,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
String jchannelRefName = raProperties.getJgroupsChannelRefName();
JChannel jchannel = ActiveMQRaUtils.locateJGroupsChannel(jgroupsLocatorClassName, jchannelRefName);
endpointFactory = new ChannelBroadcastEndpointFactory(jchannel, jgroupsChannel);
- }
- else if (discoveryAddress != null) {
+ } else if (discoveryAddress != null) {
Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ? overrideProperties.getDiscoveryPort() : getDiscoveryPort();
if (discoveryPort == null) {
discoveryPort = ActiveMQClient.DEFAULT_DISCOVERY_PORT;
@@ -1712,8 +1702,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
String localBindAddress = overrideProperties.getDiscoveryLocalBindAddress() != null ? overrideProperties.getDiscoveryLocalBindAddress() : raProperties.getDiscoveryLocalBindAddress();
endpointFactory = new UDPBroadcastEndpointFactory().setGroupAddress(discoveryAddress).setGroupPort(discoveryPort).setLocalBindAddress(localBindAddress).setLocalBindPort(-1);
- }
- else if (jgroupsFileName != null) {
+ } else if (jgroupsFileName != null) {
endpointFactory = new JGroupsFileBroadcastEndpointFactory().setChannelName(jgroupsChannel).setFile(jgroupsFileName);
}
Long refreshTimeout = overrideProperties.getDiscoveryRefreshTimeout() != null ? overrideProperties.getDiscoveryRefreshTimeout() : raProperties.getDiscoveryRefreshTimeout();
@@ -1735,19 +1724,16 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (ha) {
cf = ActiveMQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.XA_CF);
- }
- else {
+ } else {
cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.XA_CF);
}
- }
- else if (connectorClassName != null) {
+ } else if (connectorClassName != null) {
TransportConfiguration[] transportConfigurations = new TransportConfiguration[connectorClassName.size()];
List<Map<String, Object>> connectionParams;
if (overrideProperties.getParsedConnectorClassNames() != null) {
connectionParams = overrideProperties.getParsedConnectionParameters();
- }
- else {
+ } else {
connectionParams = raProperties.getParsedConnectionParameters();
}
@@ -1756,8 +1742,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (connectionParams == null || i >= connectionParams.size()) {
tc = new TransportConfiguration(connectorClassName.get(i));
ActiveMQRALogger.LOGGER.debug("No connector params provided using default");
- }
- else {
+ } else {
tc = new TransportConfiguration(connectorClassName.get(i), connectionParams.get(i));
}
@@ -1771,12 +1756,10 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (ha) {
cf = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.XA_CF, transportConfigurations);
- }
- else {
+ } else {
cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.XA_CF, transportConfigurations);
}
- }
- else {
+ } else {
throw new IllegalArgumentException("must provide either TransportType or DiscoveryGroupAddress and DiscoveryGroupPort for ResourceAdapter Connection Factory");
}
@@ -1804,11 +1787,9 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
String localBindAddress = overrideProperties.getDiscoveryLocalBindAddress() != null ? overrideProperties.getDiscoveryLocalBindAddress() : raProperties.getDiscoveryLocalBindAddress();
endpointFactory = new UDPBroadcastEndpointFactory().setGroupAddress(discoveryAddress).setGroupPort(discoveryPort).setLocalBindAddress(localBindAddress).setLocalBindPort(-1);
- }
- else if (jgroupsFileName != null) {
+ } else if (jgroupsFileName != null) {
endpointFactory = new JGroupsFileBroadcastEndpointFactory().setChannelName(jgroupsChannel).setFile(jgroupsFileName);
- }
- else {
+ } else {
String jgroupsLocatorClass = raProperties.getJgroupsChannelLocatorClass();
if (jgroupsLocatorClass != null) {
String jgroupsChannelRefName = raProperties.getJgroupsChannelRefName();
@@ -1838,15 +1819,13 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
}
cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.XA_CF);
- }
- else {
+ } else {
TransportConfiguration[] transportConfigurations = new TransportConfiguration[connectorClassName.size()];
List<Map<String, Object>> connectionParams;
if (overrideProperties.getParsedConnectorClassNames() != null) {
connectionParams = overrideProperties.getParsedConnectionParameters();
- }
- else {
+ } else {
connectionParams = raProperties.getParsedConnectionParameters();
}
@@ -1855,8 +1834,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (connectionParams == null || i >= connectionParams.size()) {
tc = new TransportConfiguration(connectorClassName.get(i));
ActiveMQRALogger.LOGGER.debug("No connector params provided using default");
- }
- else {
+ } else {
tc = new TransportConfiguration(connectorClassName.get(i), connectionParams.get(i));
}
@@ -1965,8 +1943,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
val2 = overrideProperties.getReconnectAttempts() != null ? overrideProperties.getReconnectAttempts() : raProperties.getReconnectAttempts();
if (val2 != null) {
cf.setReconnectAttempts(val2);
- }
- else {
+ } else {
//the global default is 0 but we should always try to reconnect JCA
cf.setReconnectAttempts(-1);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ConnectionFactoryProperties.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ConnectionFactoryProperties.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ConnectionFactoryProperties.java
index ff7817e..442952f 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ConnectionFactoryProperties.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ConnectionFactoryProperties.java
@@ -733,200 +733,167 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
if (this.autoGroup == null) {
if (other.autoGroup != null)
return false;
- }
- else if (!this.autoGroup.equals(other.autoGroup))
+ } else if (!this.autoGroup.equals(other.autoGroup))
return false;
if (this.blockOnAcknowledge == null) {
if (other.blockOnAcknowledge != null)
return false;
- }
- else if (!this.blockOnAcknowledge.equals(other.blockOnAcknowledge))
+ } else if (!this.blockOnAcknowledge.equals(other.blockOnAcknowledge))
return false;
if (this.blockOnDurableSend == null) {
if (other.blockOnDurableSend != null)
return false;
- }
- else if (!this.blockOnDurableSend.equals(other.blockOnDurableSend))
+ } else if (!this.blockOnDurableSend.equals(other.blockOnDurableSend))
return false;
if (this.blockOnNonDurableSend == null) {
if (other.blockOnNonDurableSend != null)
return false;
- }
- else if (!this.blockOnNonDurableSend.equals(other.blockOnNonDurableSend))
+ } else if (!this.blockOnNonDurableSend.equals(other.blockOnNonDurableSend))
return false;
if (this.cacheLargeMessagesClient == null) {
if (other.cacheLargeMessagesClient != null)
return false;
- }
- else if (!this.cacheLargeMessagesClient.equals(other.cacheLargeMessagesClient))
+ } else if (!this.cacheLargeMessagesClient.equals(other.cacheLargeMessagesClient))
return false;
if (this.compressLargeMessage == null) {
if (other.compressLargeMessage != null)
return false;
- }
- else if (!this.compressLargeMessage.equals(other.compressLargeMessage))
+ } else if (!this.compressLargeMessage.equals(other.compressLargeMessage))
return false;
if (this.failoverOnInitialConnection == null) {
if (other.failoverOnInitialConnection != null)
return false;
- }
- else if (!this.failoverOnInitialConnection.equals(other.failoverOnInitialConnection))
+ } else if (!this.failoverOnInitialConnection.equals(other.failoverOnInitialConnection))
return false;
if (this.ha == null) {
if (other.ha != null)
return false;
- }
- else if (!this.ha.equals(other.ha))
+ } else if (!this.ha.equals(other.ha))
return false;
if (this.preAcknowledge == null) {
if (other.preAcknowledge != null)
return false;
- }
- else if (!this.preAcknowledge.equals(other.preAcknowledge))
+ } else if (!this.preAcknowledge.equals(other.preAcknowledge))
return false;
if (this.callFailoverTimeout == null) {
if (other.callFailoverTimeout != null)
return false;
- }
- else if (!this.callFailoverTimeout.equals(other.callFailoverTimeout))
+ } else if (!this.callFailoverTimeout.equals(other.callFailoverTimeout))
return false;
if (this.callTimeout == null) {
if (other.callTimeout != null)
return false;
- }
- else if (!this.callTimeout.equals(other.callTimeout))
+ } else if (!this.callTimeout.equals(other.callTimeout))
return false;
if (this.clientFailureCheckPeriod == null) {
if (other.clientFailureCheckPeriod != null)
return false;
- }
- else if (!this.clientFailureCheckPeriod.equals(other.clientFailureCheckPeriod))
+ } else if (!this.clientFailureCheckPeriod.equals(other.clientFailureCheckPeriod))
return false;
if (this.clientID == null) {
if (other.clientID != null)
return false;
- }
- else if (!this.clientID.equals(other.clientID))
+ } else if (!this.clientID.equals(other.clientID))
return false;
if (this.confirmationWindowSize == null) {
if (other.confirmationWindowSize != null)
return false;
- }
- else if (!this.confirmationWindowSize.equals(other.confirmationWindowSize))
+ } else if (!this.confirmationWindowSize.equals(other.confirmationWindowSize))
return false;
if (this.connectionLoadBalancingPolicyClassName == null) {
if (other.connectionLoadBalancingPolicyClassName != null)
return false;
- }
- else if (!this.connectionLoadBalancingPolicyClassName.equals(other.connectionLoadBalancingPolicyClassName))
+ } else if (!this.connectionLoadBalancingPolicyClassName.equals(other.connectionLoadBalancingPolicyClassName))
return false;
if (this.connectionTTL == null) {
if (other.connectionTTL != null)
return false;
- }
- else if (!this.connectionTTL.equals(other.connectionTTL))
+ } else if (!this.connectionTTL.equals(other.connectionTTL))
return false;
if (this.consumerMaxRate == null) {
if (other.consumerMaxRate != null)
return false;
- }
- else if (!this.consumerMaxRate.equals(other.consumerMaxRate))
+ } else if (!this.consumerMaxRate.equals(other.consumerMaxRate))
return false;
if (this.consumerWindowSize == null) {
if (other.consumerWindowSize != null)
return false;
- }
- else if (!this.consumerWindowSize.equals(other.consumerWindowSize))
+ } else if (!this.consumerWindowSize.equals(other.consumerWindowSize))
return false;
if (this.discoveryAddress == null) {
if (other.discoveryAddress != null)
return false;
- }
- else if (!this.discoveryAddress.equals(other.discoveryAddress))
+ } else if (!this.discoveryAddress.equals(other.discoveryAddress))
return false;
if (this.discoveryInitialWaitTimeout == null) {
if (other.discoveryInitialWaitTimeout != null)
return false;
- }
- else if (!this.discoveryInitialWaitTimeout.equals(other.discoveryInitialWaitTimeout))
+ } else if (!this.discoveryInitialWaitTimeout.equals(other.discoveryInitialWaitTimeout))
return false;
if (this.discoveryLocalBindAddress == null) {
if (other.discoveryLocalBindAddress != null)
return false;
- }
- else if (!this.discoveryLocalBindAddress.equals(other.discoveryLocalBindAddress))
+ } else if (!this.discoveryLocalBindAddress.equals(other.discoveryLocalBindAddress))
return false;
if (this.discoveryPort == null) {
if (other.discoveryPort != null)
return false;
- }
- else if (!this.discoveryPort.equals(other.discoveryPort))
+ } else if (!this.discoveryPort.equals(other.discoveryPort))
return false;
if (this.discoveryRefreshTimeout == null) {
if (other.discoveryRefreshTimeout != null)
return false;
- }
- else if (!this.discoveryRefreshTimeout.equals(other.discoveryRefreshTimeout))
+ } else if (!this.discoveryRefreshTimeout.equals(other.discoveryRefreshTimeout))
return false;
if (this.dupsOKBatchSize == null) {
if (other.dupsOKBatchSize != null)
return false;
- }
- else if (!this.dupsOKBatchSize.equals(other.dupsOKBatchSize))
+ } else if (!this.dupsOKBatchSize.equals(other.dupsOKBatchSize))
return false;
if (this.groupID == null) {
if (other.groupID != null)
return false;
- }
- else if (!this.groupID.equals(other.groupID))
+ } else if (!this.groupID.equals(other.groupID))
return false;
if (this.initialConnectAttempts == null) {
if (other.initialConnectAttempts != null)
return false;
- }
- else if (!this.initialConnectAttempts.equals(other.initialConnectAttempts))
+ } else if (!this.initialConnectAttempts.equals(other.initialConnectAttempts))
return false;
if (this.initialMessagePacketSize == null) {
if (other.initialMessagePacketSize != null)
return false;
- }
- else if (!this.initialMessagePacketSize.equals(other.initialMessagePacketSize))
+ } else if (!this.initialMessagePacketSize.equals(other.initialMessagePacketSize))
return false;
if (this.jgroupsChannelName == null) {
if (other.jgroupsChannelName != null)
return false;
- }
- else if (!this.jgroupsChannelName.equals(other.jgroupsChannelName))
+ } else if (!this.jgroupsChannelName.equals(other.jgroupsChannelName))
return false;
if (this.jgroupsFile == null) {
if (other.jgroupsFile != null)
return false;
- }
- else if (!this.jgroupsFile.equals(other.jgroupsFile))
+ } else if (!this.jgroupsFile.equals(other.jgroupsFile))
return false;
if (this.maxRetryInterval == null) {
if (other.maxRetryInterval != null)
return false;
- }
- else if (!this.maxRetryInterval.equals(other.maxRetryInterval))
+ } else if (!this.maxRetryInterval.equals(other.maxRetryInterval))
return false;
if (this.minLargeMessageSize == null) {
if (other.minLargeMessageSize != null)
return false;
- }
- else if (!this.minLargeMessageSize.equals(other.minLargeMessageSize))
+ } else if (!this.minLargeMessageSize.equals(other.minLargeMessageSize))
return false;
if (this.producerMaxRate == null) {
if (other.producerMaxRate != null)
return false;
- }
- else if (!this.producerMaxRate.equals(other.producerMaxRate))
+ } else if (!this.producerMaxRate.equals(other.producerMaxRate))
return false;
if (this.producerWindowSize == null) {
if (other.producerWindowSize != null)
return false;
- }
- else if (!this.producerWindowSize.equals(other.producerWindowSize))
+ } else if (!this.producerWindowSize.equals(other.producerWindowSize))
return false;
else if (!protocolManagerFactoryStr.equals(other.protocolManagerFactoryStr))
return false;
@@ -937,70 +904,59 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
if (this.reconnectAttempts == null) {
if (other.reconnectAttempts != null)
return false;
- }
- else if (!this.reconnectAttempts.equals(other.reconnectAttempts))
+ } else if (!this.reconnectAttempts.equals(other.reconnectAttempts))
return false;
if (this.retryInterval == null) {
if (other.retryInterval != null)
return false;
- }
- else if (!this.retryInterval.equals(other.retryInterval))
+ } else if (!this.retryInterval.equals(other.retryInterval))
return false;
if (this.retryIntervalMultiplier == null) {
if (other.retryIntervalMultiplier != null)
return false;
- }
- else if (!this.retryIntervalMultiplier.equals(other.retryIntervalMultiplier))
+ } else if (!this.retryIntervalMultiplier.equals(other.retryIntervalMultiplier))
return false;
if (this.scheduledThreadPoolMaxSize == null) {
if (other.scheduledThreadPoolMaxSize != null)
return false;
- }
- else if (!this.scheduledThreadPoolMaxSize.equals(other.scheduledThreadPoolMaxSize))
+ } else if (!this.scheduledThreadPoolMaxSize.equals(other.scheduledThreadPoolMaxSize))
return false;
if (this.threadPoolMaxSize == null) {
if (other.threadPoolMaxSize != null)
return false;
- }
- else if (!this.threadPoolMaxSize.equals(other.threadPoolMaxSize))
+ } else if (!this.threadPoolMaxSize.equals(other.threadPoolMaxSize))
return false;
if (this.transactionBatchSize == null) {
if (other.transactionBatchSize != null)
return false;
- }
- else if (!this.transactionBatchSize.equals(other.transactionBatchSize))
+ } else if (!this.transactionBatchSize.equals(other.transactionBatchSize))
return false;
if (this.useGlobalPools == null) {
if (other.useGlobalPools != null)
return false;
- }
- else if (!this.useGlobalPools.equals(other.useGlobalPools))
+ } else if (!this.useGlobalPools.equals(other.useGlobalPools))
return false;
if (connectorClassName == null) {
if (other.connectorClassName != null)
return false;
- }
- else if (!connectorClassName.equals(other.connectorClassName))
+ } else if (!connectorClassName.equals(other.connectorClassName))
return false;
if (this.connectionParameters == null) {
if (other.connectionParameters != null)
return false;
- }
- else if (!connectionParameters.equals(other.connectionParameters))
+ } else if (!connectionParameters.equals(other.connectionParameters))
return false;
if (deserializationBlackList == null) {
if (other.deserializationBlackList != null)
return false;
- }
- else if (!deserializationBlackList.equals(other.deserializationBlackList))
+ } else if (!deserializationBlackList.equals(other.deserializationBlackList))
return false;
if (deserializationWhiteList == null) {
if (other.deserializationWhiteList != null)
return false;
- }
- else if (!deserializationWhiteList.equals(other.deserializationWhiteList))
+ } else if (!deserializationWhiteList.equals(other.deserializationWhiteList))
return false;
return true;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
index b14effc..2c42779 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
@@ -128,8 +128,7 @@ public class ActiveMQActivation {
static {
try {
ONMESSAGE = MessageListener.class.getMethod("onMessage", new Class[]{Message.class});
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
@@ -158,8 +157,7 @@ public class ActiveMQActivation {
try {
spec.setPassword(codec.decode(pass));
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new ResourceException(e);
}
}
@@ -170,8 +168,7 @@ public class ActiveMQActivation {
this.spec = spec;
try {
isDeliveryTransacted = endpointFactory.isDeliveryTransacted(ActiveMQActivation.ONMESSAGE);
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new ResourceException(e);
}
}
@@ -318,8 +315,7 @@ public class ActiveMQActivation {
ActiveMQMessageHandler handler = new ActiveMQMessageHandler(factory, this, ra.getTM(), (ClientSessionInternal) session, cf, i);
handler.setup();
handlers.add(handler);
- }
- catch (Exception e) {
+ } catch (Exception e) {
if (cf != null) {
cf.close();
}
@@ -394,8 +390,7 @@ public class ActiveMQActivation {
for (Thread interruptThread : interruptThreads) {
try {
interruptThread.interrupt();
- }
- catch (Exception e) {
+ } catch (Exception e) {
//ok
}
}
@@ -417,8 +412,7 @@ public class ActiveMQActivation {
try {
threadTearDown.join(timeout);
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
// nothing to be done on this context.. we will just keep going as we need to send an interrupt to threadTearDown and give up
}
@@ -426,8 +420,7 @@ public class ActiveMQActivation {
try {
// closing the factory will help making sure pending threads are closed
factory.close();
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
ActiveMQRALogger.LOGGER.warn(e);
}
@@ -439,8 +432,7 @@ public class ActiveMQActivation {
try {
threadTearDown.join(5000);
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
// nothing to be done here.. we are going down anyways
}
@@ -460,8 +452,7 @@ public class ActiveMQActivation {
Context ctx;
if (spec.getParsedJndiParams() == null) {
ctx = new InitialContext();
- }
- else {
+ } else {
ctx = new InitialContext(spec.getParsedJndiParams());
}
Object fac = ctx.lookup(spec.getConnectionFactoryLookup());
@@ -469,12 +460,10 @@ public class ActiveMQActivation {
// This will clone the connection factory
// to make sure we won't close anyone's connection factory when we stop the MDB
factory = ActiveMQJMSClient.createConnectionFactory(((ActiveMQConnectionFactory) fac).toURI().toString(), "internalConnection");
- }
- else {
+ } else {
factory = ra.newConnectionFactory(spec);
}
- }
- else {
+ } else {
factory = ra.newConnectionFactory(spec);
}
}
@@ -502,14 +491,12 @@ public class ActiveMQActivation {
ActiveMQRALogger.LOGGER.debug("Using queue connection " + result);
return result;
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
try {
if (result != null) {
result.close();
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
ActiveMQRALogger.LOGGER.trace("Ignored error closing connection", e);
}
if (t instanceof Exception) {
@@ -531,8 +518,7 @@ public class ActiveMQActivation {
Context ctx;
if (spec.getParsedJndiParams() == null) {
ctx = new InitialContext();
- }
- else {
+ } else {
ctx = new InitialContext(spec.getParsedJndiParams());
}
ActiveMQRALogger.LOGGER.debug("Using context " + ctx.getEnvironment() + " for " + spec);
@@ -548,8 +534,7 @@ public class ActiveMQActivation {
if (Topic.class.getName().equals(destinationTypeString)) {
destinationType = Topic.class;
isTopic = true;
- }
- else {
+ } else {
destinationType = Queue.class;
}
@@ -557,8 +542,7 @@ public class ActiveMQActivation {
try {
destination = (ActiveMQDestination) ActiveMQRaUtils.lookup(ctx, destinationName, destinationType);
- }
- catch (Exception e) {
+ } catch (Exception e) {
if (destinationName == null) {
throw ActiveMQRABundle.BUNDLE.noDestinationName();
}
@@ -572,13 +556,11 @@ public class ActiveMQActivation {
// If there is no binding on naming, we will just create a new instance
if (isTopic) {
destination = (ActiveMQDestination) ActiveMQJMSClient.createTopic(calculatedDestinationName);
- }
- else {
+ } else {
destination = (ActiveMQDestination) ActiveMQJMSClient.createQueue(calculatedDestinationName);
}
}
- }
- else {
+ } else {
ActiveMQRALogger.LOGGER.debug("Destination type not defined in MDB activation configuration.");
ActiveMQRALogger.LOGGER.debug("Retrieving " + Destination.class.getName() + " \"" + destinationName + "\" from JNDI");
@@ -587,15 +569,13 @@ public class ActiveMQActivation {
isTopic = true;
}
}
- }
- else {
+ } else {
ActiveMQRALogger.LOGGER.instantiatingDestination(spec.getDestinationType(), spec.getDestination());
if (Topic.class.getName().equals(spec.getDestinationType())) {
destination = (ActiveMQDestination) ActiveMQJMSClient.createTopic(spec.getDestination());
isTopic = true;
- }
- else {
+ } else {
destination = (ActiveMQDestination) ActiveMQJMSClient.createQueue(spec.getDestination());
}
}
@@ -647,11 +627,9 @@ public class ActiveMQActivation {
if (failure != null) {
if (failure instanceof ActiveMQException && ((ActiveMQException) failure).getType() == ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST) {
ActiveMQRALogger.LOGGER.awaitingTopicQueueCreation(getActivationSpec().getDestination());
- }
- else if (failure instanceof ActiveMQException && ((ActiveMQException) failure).getType() == ActiveMQExceptionType.NOT_CONNECTED) {
+ } else if (failure instanceof ActiveMQException && ((ActiveMQException) failure).getType() == ActiveMQExceptionType.NOT_CONNECTED) {
ActiveMQRALogger.LOGGER.awaitingJMSServerCreation();
- }
- else {
+ } else {
ActiveMQRALogger.LOGGER.failureInActivation(failure, spec);
}
}
@@ -669,8 +647,7 @@ public class ActiveMQActivation {
try {
Thread.sleep(setupInterval);
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
ActiveMQRALogger.LOGGER.debug("Interrupted trying to reconnect " + spec, e);
break;
}
@@ -682,28 +659,24 @@ public class ActiveMQActivation {
setup();
ActiveMQRALogger.LOGGER.reconnected();
break;
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
if (failure instanceof ActiveMQException && ((ActiveMQException) failure).getType() == ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST) {
if (lastException == null || !(t instanceof ActiveMQNonExistentQueueException)) {
lastException = t;
ActiveMQRALogger.LOGGER.awaitingTopicQueueCreation(getActivationSpec().getDestination());
}
- }
- else if (failure instanceof ActiveMQException && ((ActiveMQException) failure).getType() == ActiveMQExceptionType.NOT_CONNECTED) {
+ } else if (failure instanceof ActiveMQException && ((ActiveMQException) failure).getType() == ActiveMQExceptionType.NOT_CONNECTED) {
if (lastException == null || !(t instanceof ActiveMQNotConnectedException)) {
lastException = t;
ActiveMQRALogger.LOGGER.awaitingJMSServerCreation();
}
- }
- else {
+ } else {
ActiveMQRALogger.LOGGER.errorReconnecting(t, spec);
}
}
++reconnectCount;
}
- }
- finally {
+ } finally {
// Leaving failure recovery loop
inReconnect.set(false);
}
@@ -722,8 +695,7 @@ public class ActiveMQActivation {
public void run() {
try {
setup();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
reconnect(t);
}
}
@@ -750,8 +722,7 @@ public class ActiveMQActivation {
if (lastReceived && newNode) {
ActiveMQRALogger.LOGGER.rebalancingConnections("nodeUp " + member.toString());
startReconnectThread("NodeUP Connection Rebalancer");
- }
- else if (last) {
+ } else if (last) {
lastReceived = true;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java
index 4d8b18f..35abba9 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java
@@ -30,10 +30,10 @@ import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
-import org.apache.activemq.artemis.ra.ConnectionFactoryProperties;
import org.apache.activemq.artemis.ra.ActiveMQRALogger;
import org.apache.activemq.artemis.ra.ActiveMQRaUtils;
import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
+import org.apache.activemq.artemis.ra.ConnectionFactoryProperties;
/**
* The activation spec
@@ -364,8 +364,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
if (Session.DUPS_OK_ACKNOWLEDGE == acknowledgeMode) {
return "Dups-ok-acknowledge";
- }
- else {
+ } else {
return "Auto-acknowledge";
}
}
@@ -382,11 +381,9 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
if ("DUPS_OK_ACKNOWLEDGE".equalsIgnoreCase(value) || "Dups-ok-acknowledge".equalsIgnoreCase(value)) {
acknowledgeMode = Session.DUPS_OK_ACKNOWLEDGE;
- }
- else if ("AUTO_ACKNOWLEDGE".equalsIgnoreCase(value) || "Auto-acknowledge".equalsIgnoreCase(value)) {
+ } else if ("AUTO_ACKNOWLEDGE".equalsIgnoreCase(value) || "Auto-acknowledge".equalsIgnoreCase(value)) {
acknowledgeMode = Session.AUTO_ACKNOWLEDGE;
- }
- else {
+ } else {
throw new IllegalArgumentException("Unsupported acknowledgement mode " + value);
}
}
@@ -414,8 +411,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
if (subscriptionDurability) {
return "Durable";
- }
- else {
+ } else {
return "NonDurable";
}
}
@@ -506,8 +502,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
if (user == null) {
return ra.getUserName();
- }
- else {
+ } else {
return user;
}
}
@@ -537,8 +532,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
if (password == null) {
return ra.getPassword();
- }
- else {
+ } else {
return password;
}
}
@@ -619,8 +613,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
public Boolean isUseLocalTx() {
if (localTx == null) {
return ra.getUseLocalTx();
- }
- else {
+ } else {
return localTx;
}
}
@@ -644,8 +637,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
if (setupAttempts == null) {
return ra.getSetupAttempts();
- }
- else {
+ } else {
return setupAttempts;
}
}
@@ -665,8 +657,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
if (setupInterval == null) {
return ra.getSetupInterval();
- }
- else {
+ } else {
return setupInterval;
}
}
@@ -713,8 +704,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
propsNotSet.add(new PropertyDescriptor("subscriptionName", ActiveMQActivationSpec.class));
errorMessages.add("If subscription is durable then subscription name must be specified.");
}
- }
- catch (IntrospectionException e) {
+ } catch (IntrospectionException e) {
ActiveMQRALogger.LOGGER.unableToValidateProperties(e);
}
@@ -830,41 +820,57 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- if (!super.equals(o)) return false;
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ if (!super.equals(o))
+ return false;
ActiveMQActivationSpec that = (ActiveMQActivationSpec) o;
- if (acknowledgeMode != that.acknowledgeMode) return false;
- if (subscriptionDurability != that.subscriptionDurability) return false;
- if (shareSubscriptions != that.shareSubscriptions) return false;
+ if (acknowledgeMode != that.acknowledgeMode)
+ return false;
+ if (subscriptionDurability != that.subscriptionDurability)
+ return false;
+ if (shareSubscriptions != that.shareSubscriptions)
+ return false;
if (strConnectorClassName != null ? !strConnectorClassName.equals(that.strConnectorClassName) : that.strConnectorClassName != null)
return false;
if (strConnectionParameters != null ? !strConnectionParameters.equals(that.strConnectionParameters) : that.strConnectionParameters != null)
return false;
- if (ra != null ? !ra.equals(that.ra) : that.ra != null) return false;
+ if (ra != null ? !ra.equals(that.ra) : that.ra != null)
+ return false;
if (connectionFactoryLookup != null ? !connectionFactoryLookup.equals(that.connectionFactoryLookup) : that.connectionFactoryLookup != null)
return false;
- if (destination != null ? !destination.equals(that.destination) : that.destination != null) return false;
+ if (destination != null ? !destination.equals(that.destination) : that.destination != null)
+ return false;
if (destinationType != null ? !destinationType.equals(that.destinationType) : that.destinationType != null)
return false;
if (messageSelector != null ? !messageSelector.equals(that.messageSelector) : that.messageSelector != null)
return false;
if (subscriptionName != null ? !subscriptionName.equals(that.subscriptionName) : that.subscriptionName != null)
return false;
- if (user != null ? !user.equals(that.user) : that.user != null) return false;
- if (password != null ? !password.equals(that.password) : that.password != null) return false;
- if (maxSession != null ? !maxSession.equals(that.maxSession) : that.maxSession != null) return false;
+ if (user != null ? !user.equals(that.user) : that.user != null)
+ return false;
+ if (password != null ? !password.equals(that.password) : that.password != null)
+ return false;
+ if (maxSession != null ? !maxSession.equals(that.maxSession) : that.maxSession != null)
+ return false;
if (transactionTimeout != null ? !transactionTimeout.equals(that.transactionTimeout) : that.transactionTimeout != null)
return false;
- if (useJNDI != null ? !useJNDI.equals(that.useJNDI) : that.useJNDI != null) return false;
- if (jndiParams != null ? !jndiParams.equals(that.jndiParams) : that.jndiParams != null) return false;
+ if (useJNDI != null ? !useJNDI.equals(that.useJNDI) : that.useJNDI != null)
+ return false;
+ if (jndiParams != null ? !jndiParams.equals(that.jndiParams) : that.jndiParams != null)
+ return false;
if (parsedJndiParams != null ? !parsedJndiParams.equals(that.parsedJndiParams) : that.parsedJndiParams != null)
return false;
- if (localTx != null ? !localTx.equals(that.localTx) : that.localTx != null) return false;
- if (rebalanceConnections != null ? !rebalanceConnections.equals(that.rebalanceConnections) : that.rebalanceConnections != null) return false;
- if (setupAttempts != null ? !setupAttempts.equals(that.setupAttempts) : that.setupAttempts != null) return false;
+ if (localTx != null ? !localTx.equals(that.localTx) : that.localTx != null)
+ return false;
+ if (rebalanceConnections != null ? !rebalanceConnections.equals(that.rebalanceConnections) : that.rebalanceConnections != null)
+ return false;
+ if (setupAttempts != null ? !setupAttempts.equals(that.setupAttempts) : that.setupAttempts != null)
+ return false;
return !(setupInterval != null ? !setupInterval.equals(that.setupInterval) : that.setupInterval != null);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java
index 353bc73..c43298b 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java
@@ -118,15 +118,13 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
if (!subResponse.isExists()) {
session.createQueue(activation.getAddress(), queueName, selectorString, true);
- }
- else {
+ } else {
// The check for already exists should be done only at the first session
// As a deployed MDB could set up multiple instances in order to process messages in parallel.
if (sessionNr == 0 && subResponse.getConsumerCount() > 0) {
if (!spec.isShareSubscriptions()) {
throw new javax.jms.IllegalStateException("Cannot create a subscriber on the durable subscription since it already has subscriber(s)");
- }
- else if (ActiveMQRALogger.LOGGER.isDebugEnabled()) {
+ } else if (ActiveMQRALogger.LOGGER.isDebugEnabled()) {
ActiveMQRALogger.LOGGER.debug("the mdb on destination " + queueName + " already had " +
subResponse.getConsumerCount() +
" consumers but the MDB is configured to share subscriptions, so no exceptions are thrown");
@@ -152,16 +150,14 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
}
}
consumer = (ClientConsumerInternal) session.createConsumer(queueName, null, false);
- }
- else {
+ } else {
SimpleString tempQueueName;
if (activation.isTopic()) {
if (activation.getTopicTemporaryQueue() == null) {
tempQueueName = new SimpleString(UUID.randomUUID().toString());
session.createTemporaryQueue(activation.getAddress(), tempQueueName, selectorString);
activation.setTopicTemporaryQueue(tempQueueName);
- }
- else {
+ } else {
tempQueueName = activation.getTopicTemporaryQueue();
QueueQuery queueQuery = session.queueQuery(tempQueueName);
if (!queueQuery.isExists()) {
@@ -170,8 +166,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
session.createTemporaryQueue(activation.getAddress(), tempQueueName, selectorString);
}
}
- }
- else {
+ } else {
tempQueueName = activation.getAddress();
}
consumer = (ClientConsumerInternal) session.createConsumer(tempQueueName, selectorString);
@@ -191,8 +186,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
endpoint = endpointFactory.createEndpoint(xaResource);
useXA = true;
- }
- else {
+ } else {
endpoint = endpointFactory.createEndpoint(null);
useXA = false;
}
@@ -210,8 +204,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
if (consumer != null) {
return consumer.prepareForClose(future);
}
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
ActiveMQRALogger.LOGGER.errorInterruptingHandler(endpoint.toString(), consumer.toString(), e);
}
return null;
@@ -230,8 +223,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
endpoint.release();
endpoint = null;
}
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.debug("Error releasing endpoint " + endpoint, t);
}
@@ -249,8 +241,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
session.deleteQueue(tmpQueue);
}
}
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.debug("Error closing core-queue consumer", t);
}
@@ -258,27 +249,23 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
if (session != null) {
session.close();
}
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.debug("Error releasing session " + session, t);
}
try {
if (cf != null) {
cf.close();
}
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.debug("Error releasing session factory " + session, t);
}
- }
- else {
+ } else {
//otherwise we just clean up
try {
if (cf != null) {
cf.cleanup();
}
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
ActiveMQRALogger.LOGGER.debug("Error releasing session factory " + session, t);
}
@@ -325,8 +312,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
try {
endpoint.afterDelivery();
- }
- catch (ResourceException e) {
+ } catch (ResourceException e) {
ActiveMQRALogger.LOGGER.unableToCallAfterDelivery(e);
// If we get here, The TX was already rolled back
// However we must do some stuff now to make sure the client message buffer is cleared
@@ -341,8 +327,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
if (trace) {
ActiveMQRALogger.LOGGER.trace("finished onMessage on " + message);
}
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
ActiveMQRALogger.LOGGER.errorDeliveringMessage(e);
// we need to call before/afterDelivery as a pair
if (beforeDelivery) {
@@ -356,8 +341,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
if (tx != null) {
tx.setRollbackOnly();
}
- }
- catch (Exception e1) {
+ } catch (Exception e1) {
ActiveMQRALogger.LOGGER.warn("unnable to clear the transaction", e1);
}
}
@@ -368,16 +352,14 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
if (endToUse != null) {
endToUse.afterDelivery();
}
- }
- catch (ResourceException e1) {
+ } catch (ResourceException e1) {
ActiveMQRALogger.LOGGER.unableToCallAfterDelivery(e1);
}
}
if (useLocalTx || !activation.isDeliveryTransacted()) {
try {
session.rollback(true);
- }
- catch (ActiveMQException e1) {
+ } catch (ActiveMQException e1) {
ActiveMQRALogger.LOGGER.unableToRollbackTX();
}
}
@@ -385,12 +367,10 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
// This is to make sure we will issue a rollback after failures
// so that would cleanup consumer buffers among other things
session.markRollbackOnly();
- }
- finally {
+ } finally {
try {
session.resetIfNeeded();
- }
- catch (ActiveMQException e) {
+ } catch (ActiveMQException e) {
ActiveMQRALogger.LOGGER.unableToResetSession(activation.toString(), e);
activation.startReconnectThread("Reset MessageHandler after Failure Thread");
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java
index 2eb42ba..0e72780 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java
@@ -16,6 +16,10 @@
*/
package org.apache.activemq.artemis.ra.recovery;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.Set;
+
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.ra.ActiveMQRALogger;
import org.apache.activemq.artemis.service.extensions.xa.recovery.ActiveMQRegistry;
@@ -23,10 +27,6 @@ import org.apache.activemq.artemis.service.extensions.xa.recovery.ActiveMQRegist
import org.apache.activemq.artemis.service.extensions.xa.recovery.XARecoveryConfig;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-
public final class RecoveryManager {
private ActiveMQRegistry registry;
@@ -38,13 +38,15 @@ public final class RecoveryManager {
public void start(final boolean useAutoRecovery) {
if (useAutoRecovery) {
locateRecoveryRegistry();
- }
- else {
+ } else {
registry = null;
}
}
- public XARecoveryConfig register(ActiveMQConnectionFactory factory, String userName, String password, Map<String, String> properties) {
+ public XARecoveryConfig register(ActiveMQConnectionFactory factory,
+ String userName,
+ String password,
+ Map<String, String> properties) {
ActiveMQRALogger.LOGGER.debug("registering recovery for factory : " + factory);
XARecoveryConfig config = XARecoveryConfig.newConfig(factory, userName, password, properties);
@@ -80,12 +82,10 @@ public final class RecoveryManager {
ServiceLoader<ActiveMQRegistry> sl = ServiceLoader.load(ActiveMQRegistry.class);
if (sl.iterator().hasNext()) {
registry = sl.iterator().next();
- }
- else {
+ } else {
registry = ActiveMQRegistryImpl.getInstance();
}
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
ActiveMQRALogger.LOGGER.debug("unable to load recovery registry " + locatorClasse, e);
}
if (registry != null) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/ActiveMQ.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/ActiveMQ.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/ActiveMQ.java
index ad8656f..45dd318 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/ActiveMQ.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/ActiveMQ.java
@@ -67,8 +67,7 @@ public class ActiveMQ {
oos.flush();
data = baos.toByteArray();
- }
- catch (IOException e) {
+ } catch (IOException e) {
throw new RuntimeException(e);
}
@@ -153,11 +152,9 @@ public class ActiveMQ {
ResteasyProviderFactory.pushContext(Providers.class, factory);
try {
return reader.readFrom(type, genericType, null, ct, new Headers<String>(), new ByteArrayInputStream(body));
- }
- catch (IOException e) {
+ } catch (IOException e) {
throw new RuntimeException(e);
- }
- finally {
+ } finally {
ResteasyProviderFactory.popContextData(Providers.class);
if (current != null)
ResteasyProviderFactory.pushContext(Providers.class, current);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java
index 692bddb..e5aed58 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java
@@ -16,11 +16,6 @@
*/
package org.apache.activemq.artemis.rest;
-import org.apache.activemq.artemis.rest.util.HttpMessageHelper;
-import org.jboss.resteasy.core.Headers;
-import org.jboss.resteasy.spi.ResteasyProviderFactory;
-import org.jboss.resteasy.util.GenericType;
-
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.Message;
@@ -31,6 +26,11 @@ import javax.ws.rs.ext.Providers;
import java.io.ByteArrayInputStream;
import java.lang.reflect.Type;
+import org.apache.activemq.artemis.rest.util.HttpMessageHelper;
+import org.jboss.resteasy.core.Headers;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+import org.jboss.resteasy.util.GenericType;
+
public class Jms {
/**
@@ -43,8 +43,7 @@ public class Jms {
public static void setHttpHeader(Message message, String name, String value) {
try {
message.setStringProperty(HttpHeaderProperty.toPropertyName(name), value);
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
throw new RuntimeException(e);
}
}
@@ -59,8 +58,7 @@ public class Jms {
public static String getHttpHeader(Message message, String name) {
try {
return message.getStringProperty(HttpHeaderProperty.toPropertyName(name));
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
throw new RuntimeException(e);
}
}
@@ -110,8 +108,7 @@ public class Jms {
public static boolean isHttpMessage(Message message) {
try {
return message.getBooleanProperty(HttpMessageHelper.POSTED_AS_HTTP_MESSAGE);
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
return false;
}
}
@@ -135,8 +132,7 @@ public class Jms {
if (!isHttpMessage(message)) {
try {
return (T) ((ObjectMessage) message).getObject();
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
throw new RuntimeException(e);
}
}
@@ -165,14 +161,12 @@ public class Jms {
ResteasyProviderFactory.pushContext(Providers.class, factory);
try {
return reader.readFrom(type, genericType, null, ct, new Headers<String>(), new ByteArrayInputStream(body));
- }
- finally {
+ } finally {
ResteasyProviderFactory.popContextData(Providers.class);
if (current != null)
ResteasyProviderFactory.pushContext(Providers.class, current);
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java
index 4aaa95d..110ebb8 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java
@@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.rest;
+import javax.xml.bind.JAXBContext;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
@@ -25,8 +26,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-import javax.xml.bind.JAXBContext;
-
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
@@ -120,8 +119,7 @@ public class MessageServiceManager {
if (configuration == null || configSet == false) {
if (configResourcePath == null) {
configuration = new MessageServiceConfiguration();
- }
- else {
+ } else {
URL url = getClass().getClassLoader().getResource(configResourcePath);
if (url == null) {
@@ -166,8 +164,7 @@ public class MessageServiceManager {
LinkStrategy linkStrategy = new LinkHeaderLinkStrategy();
if (configuration.isUseLinkHeaders()) {
linkStrategy = new LinkHeaderLinkStrategy();
- }
- else {
+ } else {
linkStrategy = new CustomHeaderLinkStrategy();
}
@@ -210,8 +207,7 @@ public class MessageServiceManager {
threadPool.shutdown();
try {
threadPool.awaitTermination(5000, TimeUnit.SECONDS);
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
}
this.consumerSessionFactory.close();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/ActiveMQBootstrapListener.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/ActiveMQBootstrapListener.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/ActiveMQBootstrapListener.java
index c4b6c34..0fb3731 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/ActiveMQBootstrapListener.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/ActiveMQBootstrapListener.java
@@ -16,12 +16,12 @@
*/
package org.apache.activemq.artemis.rest.integration;
-import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
-
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+
public class ActiveMQBootstrapListener implements ServletContextListener {
private EmbeddedJMS jms;
@@ -33,8 +33,7 @@ public class ActiveMQBootstrapListener implements ServletContextListener {
jms.setRegistry(new ServletContextBindingRegistry(context));
try {
jms.start();
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
@@ -44,8 +43,7 @@ public class ActiveMQBootstrapListener implements ServletContextListener {
try {
if (jms != null)
jms.stop();
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/EmbeddedRestActiveMQ.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/EmbeddedRestActiveMQ.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/EmbeddedRestActiveMQ.java
index fc8ae4e..6c0e079 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/EmbeddedRestActiveMQ.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/EmbeddedRestActiveMQ.java
@@ -18,8 +18,8 @@ package org.apache.activemq.artemis.rest.integration;
import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
import org.apache.activemq.artemis.jms.client.ConnectionFactoryOptions;
-import org.jboss.resteasy.plugins.server.tjws.TJWSEmbeddedJaxrsServer;
import org.apache.activemq.artemis.rest.MessageServiceManager;
+import org.jboss.resteasy.plugins.server.tjws.TJWSEmbeddedJaxrsServer;
import org.jboss.resteasy.test.TestPortProvider;
public class EmbeddedRestActiveMQ {
@@ -68,13 +68,11 @@ public class EmbeddedRestActiveMQ {
public void stop() throws Exception {
try {
tjws.stop();
- }
- catch (Exception e) {
+ } catch (Exception e) {
}
try {
manager.stop();
- }
- catch (Exception e) {
+ } catch (Exception e) {
}
embeddedActiveMQ.stop();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/RestMessagingBootstrapListener.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/RestMessagingBootstrapListener.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/RestMessagingBootstrapListener.java
index 60cea03..c68feaf 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/RestMessagingBootstrapListener.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/RestMessagingBootstrapListener.java
@@ -50,8 +50,7 @@ public class RestMessagingBootstrapListener implements ServletContextListener, C
manager.start();
registry.addSingletonResource(manager.getQueueManager().getDestination());
registry.addSingletonResource(manager.getTopicManager().getDestination());
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
@@ -82,4 +81,4 @@ public class RestMessagingBootstrapListener implements ServletContextListener, C
public void setDeserializationWhiteList(String whiteList) {
deserializationWhiteList = whiteList;
}
-}
\ No newline at end of file
+}