This closes #616

This commit is contained in:
Clebert Suconic 2016-07-05 14:18:02 -04:00
commit 84959d0300
13 changed files with 18 additions and 59 deletions

View File

@ -787,7 +787,6 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
catch (ActiveMQException e) { catch (ActiveMQException e) {
factory.close(); factory.close();
factory = null;
if (e.getType() == ActiveMQExceptionType.NOT_CONNECTED) { if (e.getType() == ActiveMQExceptionType.NOT_CONNECTED) {
attempts++; attempts++;
@ -813,9 +812,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
// how the sendSubscription happens. // how the sendSubscription happens.
// in case this ever changes. // in case this ever changes.
if (topology != null && !factory.waitForTopology(callTimeout, TimeUnit.MILLISECONDS)) { if (topology != null && !factory.waitForTopology(callTimeout, TimeUnit.MILLISECONDS)) {
if (factory != null) { factory.cleanup();
factory.cleanup();
}
throw ActiveMQClientMessageBundle.BUNDLE.connectionTimedOutOnReceiveTopology(discoveryGroup); throw ActiveMQClientMessageBundle.BUNDLE.connectionTimedOutOnReceiveTopology(discoveryGroup);
} }
@ -1647,21 +1644,19 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
initialise(); initialise();
ClientSessionFactory csf = null;
createConnectors(); createConnectors();
try { try {
int retryNumber = 0; int retryNumber = 0;
while (csf == null && !isClosed()) { while (!isClosed()) {
retryNumber++; retryNumber++;
for (Connector conn : connectors) { for (Connector conn : connectors) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug(this + "::Submitting connect towards " + conn); logger.debug(this + "::Submitting connect towards " + conn);
} }
csf = conn.tryConnect(); ClientSessionFactory csf = conn.tryConnect();
if (csf != null) { if (csf != null) {
csf.getConnection().addFailureListener(new FailureListener() { csf.getConnection().addFailureListener(new FailureListener() {

View File

@ -363,13 +363,7 @@ public class JSONObject {
} }
} }
} }
catch (IllegalAccessException e) { catch (IllegalAccessException | InvocationTargetException | JSONException e) {
throw new RuntimeException(e);
}
catch (JSONException e) {
throw new RuntimeException(e);
}
catch (InvocationTargetException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }

View File

@ -102,9 +102,7 @@ public class XmlUtil {
XMLStreamReader reader = factory.createXMLStreamReader(new FileInputStream(configuration)); XMLStreamReader reader = factory.createXMLStreamReader(new FileInputStream(configuration));
if (props != null) { reader = new PropertiesFilter(reader, props);
reader = new PropertiesFilter(reader, props);
}
return clazz.cast(unmarshaller.unmarshal(reader)); return clazz.cast(unmarshaller.unmarshal(reader));
} }

View File

@ -176,9 +176,6 @@ public class JMSBridgeControlImpl extends StandardMBean implements JMSBridgeCont
if (mode != null) { if (mode != null) {
bridge.setQualityOfServiceMode(QualityOfServiceMode.valueOf(mode)); bridge.setQualityOfServiceMode(QualityOfServiceMode.valueOf(mode));
} }
else {
mode = null;
}
} }
@Override @Override

View File

@ -1523,8 +1523,7 @@ public final class JMSBridgeImpl implements JMSBridge {
targetProducer.send(targetDestination, msg, msg.getJMSDeliveryMode(), msg.getJMSPriority(), timeToLive); targetProducer.send(targetDestination, msg, msg.getJMSDeliveryMode(), msg.getJMSPriority(), timeToLive);
if (msg != null) messageCount++;
messageCount++;
if (JMSBridgeImpl.trace) { if (JMSBridgeImpl.trace) {
ActiveMQJMSBridgeLogger.LOGGER.trace("Sent message " + msg); ActiveMQJMSBridgeLogger.LOGGER.trace("Sent message " + msg);
} }

View File

@ -891,10 +891,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
ActiveMQDestination.decomposeQueueNameForDurableSubscription(consumer.getQueue().getName().toString()); ActiveMQDestination.decomposeQueueNameForDurableSubscription(consumer.getQueue().getName().toString());
obj.put("durable", true); obj.put("durable", true);
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException | JMSRuntimeException e) {
obj.put("durable", false);
}
catch (JMSRuntimeException e) {
obj.put("durable", false); obj.put("durable", false);
} }
} }

View File

@ -148,16 +148,11 @@ public class JMSMappingOutboundTransformer extends OutboundTransformer {
String msgId = msg.getJMSMessageID(); String msgId = msg.getJMSMessageID();
if (msgId != null) { try {
try { props.setMessageId(AMQPMessageIdHelper.INSTANCE.toIdObject(msgId));
props.setMessageId(AMQPMessageIdHelper.INSTANCE.toIdObject(msgId));
}
catch (ActiveMQAMQPIllegalStateException e) {
props.setMessageId(msgId);
}
} }
else { catch (ActiveMQAMQPIllegalStateException e) {
props.setMessageId(msgId.toString()); props.setMessageId(msgId);
} }
} }
if (msg.getJMSDestination() != null) { if (msg.getJMSDestination() != null) {

View File

@ -956,10 +956,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
scheduleRetryConnect(); scheduleRetryConnect();
} }
} }
catch (ActiveMQInterruptedException e) { catch (ActiveMQInterruptedException | InterruptedException e) {
ActiveMQServerLogger.LOGGER.errorConnectingBridge(e, this);
}
catch (InterruptedException e) {
ActiveMQServerLogger.LOGGER.errorConnectingBridge(e, this); ActiveMQServerLogger.LOGGER.errorConnectingBridge(e, this);
} }
catch (Exception e) { catch (Exception e) {
@ -1138,10 +1135,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
} }
ActiveMQServerLogger.LOGGER.bridgeStopped(name); ActiveMQServerLogger.LOGGER.bridgeStopped(name);
} }
catch (RuntimeException e) { catch (InterruptedException | RuntimeException e) {
ActiveMQServerLogger.LOGGER.error("Failed to stop bridge", e);
}
catch (InterruptedException e) {
ActiveMQServerLogger.LOGGER.error("Failed to stop bridge", e); ActiveMQServerLogger.LOGGER.error("Failed to stop bridge", e);
} }
} }

View File

@ -120,11 +120,8 @@ public final class SharedStoreBackupActivation extends Activation {
startFailbackChecker(); startFailbackChecker();
} }
} }
catch (InterruptedException e) { catch (ClosedChannelException | InterruptedException e) {
// this is ok, we are being stopped // these are ok, we are being stopped
}
catch (ClosedChannelException e) {
// this is ok too, we are being stopped
} }
catch (Exception e) { catch (Exception e) {
if (!(e.getCause() instanceof InterruptedException)) { if (!(e.getCause() instanceof InterruptedException)) {

View File

@ -90,9 +90,7 @@ public class GuestLoginModule implements LoginModule {
passwordCallback.clearPassword(); passwordCallback.clearPassword();
} }
} }
catch (IOException ioe) { catch (IOException | UnsupportedCallbackException e) {
}
catch (UnsupportedCallbackException uce) {
} }
} }
if (debug) { if (debug) {

View File

@ -102,11 +102,8 @@ public class LDAPLoginModule implements LoginModule {
try { try {
handler.handle(callbacks); handler.handle(callbacks);
} }
catch (IOException ioe) { catch (IOException | UnsupportedCallbackException e) {
throw (LoginException) new LoginException().initCause(ioe); throw (LoginException) new LoginException().initCause(e);
}
catch (UnsupportedCallbackException uce) {
throw (LoginException) new LoginException().initCause(uce);
} }
String password; String password;

View File

@ -64,7 +64,6 @@ public class SecurityExample {
} }
// Step 5. bill tries to make a connection using wrong password // Step 5. bill tries to make a connection using wrong password
billConnection = null;
try { try {
billConnection = createConnection("bill", "activemq1", cf); billConnection = createConnection("bill", "activemq1", cf);
result = false; result = false;

View File

@ -20,7 +20,6 @@ import java.net.URI;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;