mirror of
https://github.com/apache/activemq.git
synced 2025-02-07 10:38:58 +00:00
AMQ-6968 Ensure that the correct exception is thrown
Allow the original exception that triggered the failure to be thrown from the packet send methods (cherry picked from commit db8c771b2a37ad16d789f546507b6329221f4c7a)
This commit is contained in:
parent
ea1894c7ee
commit
5403ad2e82
@ -117,7 +117,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ActiveMQConnection.class);
|
||||
|
||||
public final ConcurrentMap<ActiveMQTempDestination, ActiveMQTempDestination> activeTempDestinations = new ConcurrentHashMap<ActiveMQTempDestination, ActiveMQTempDestination>();
|
||||
public final ConcurrentMap<ActiveMQTempDestination, ActiveMQTempDestination> activeTempDestinations = new ConcurrentHashMap<>();
|
||||
|
||||
protected boolean dispatchAsync=true;
|
||||
protected boolean alwaysSessionAsync = true;
|
||||
@ -170,13 +170,13 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
|
||||
private final AtomicBoolean closing = new AtomicBoolean(false);
|
||||
private final AtomicBoolean closed = new AtomicBoolean(false);
|
||||
private final AtomicBoolean transportFailed = new AtomicBoolean(false);
|
||||
private final CopyOnWriteArrayList<ActiveMQSession> sessions = new CopyOnWriteArrayList<ActiveMQSession>();
|
||||
private final CopyOnWriteArrayList<ActiveMQConnectionConsumer> connectionConsumers = new CopyOnWriteArrayList<ActiveMQConnectionConsumer>();
|
||||
private final CopyOnWriteArrayList<TransportListener> transportListeners = new CopyOnWriteArrayList<TransportListener>();
|
||||
private final CopyOnWriteArrayList<ActiveMQSession> sessions = new CopyOnWriteArrayList<>();
|
||||
private final CopyOnWriteArrayList<ActiveMQConnectionConsumer> connectionConsumers = new CopyOnWriteArrayList<>();
|
||||
private final CopyOnWriteArrayList<TransportListener> transportListeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
// Maps ConsumerIds to ActiveMQConsumer objects
|
||||
private final ConcurrentMap<ConsumerId, ActiveMQDispatcher> dispatchers = new ConcurrentHashMap<ConsumerId, ActiveMQDispatcher>();
|
||||
private final ConcurrentMap<ProducerId, ActiveMQMessageProducer> producers = new ConcurrentHashMap<ProducerId, ActiveMQMessageProducer>();
|
||||
private final ConcurrentMap<ConsumerId, ActiveMQDispatcher> dispatchers = new ConcurrentHashMap<>();
|
||||
private final ConcurrentMap<ProducerId, ActiveMQMessageProducer> producers = new ConcurrentHashMap<>();
|
||||
private final LongSequenceGenerator sessionIdGenerator = new LongSequenceGenerator();
|
||||
private final SessionId connectionSessionId;
|
||||
private final LongSequenceGenerator consumerIdGenerator = new LongSequenceGenerator();
|
||||
@ -208,7 +208,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
|
||||
private int maxThreadPoolSize = DEFAULT_THREAD_POOL_SIZE;
|
||||
private RejectedExecutionHandler rejectedTaskHandler = null;
|
||||
|
||||
private List<String> trustedPackages = new ArrayList<String>();
|
||||
private List<String> trustedPackages = new ArrayList<>();
|
||||
private boolean trustAllPackages = false;
|
||||
private int connectResponseTimeout;
|
||||
|
||||
@ -818,7 +818,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
|
||||
|
||||
// Allows the options on the destination to configure the consumerInfo
|
||||
if (info.getDestination().getOptions() != null) {
|
||||
Map<String, String> options = new HashMap<String, String>(info.getDestination().getOptions());
|
||||
Map<String, String> options = new HashMap<>(info.getDestination().getOptions());
|
||||
IntrospectionSupport.setProperties(this.info, options, "consumer.");
|
||||
}
|
||||
|
||||
@ -1237,7 +1237,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
|
||||
|
||||
// Allows the options on the destination to configure the consumerInfo
|
||||
if (consumerInfo.getDestination().getOptions() != null) {
|
||||
Map<String, String> options = new HashMap<String, String>(consumerInfo.getDestination().getOptions());
|
||||
Map<String, String> options = new HashMap<>(consumerInfo.getDestination().getOptions());
|
||||
IntrospectionSupport.setProperties(consumerInfo, options, "consumer.");
|
||||
}
|
||||
|
||||
@ -1355,7 +1355,11 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
|
||||
}
|
||||
// dispose of transport for security exceptions on connection initiation
|
||||
if (exception instanceof SecurityException && command instanceof ConnectionInfo){
|
||||
try {
|
||||
forceCloseOnSecurityException(exception);
|
||||
} catch (Throwable t) {
|
||||
// We throw the original error from the ExceptionResponse instead.
|
||||
}
|
||||
}
|
||||
if (jmsEx != null) {
|
||||
onComplete.onException(jmsEx);
|
||||
@ -1401,7 +1405,11 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
|
||||
LOG.error("Caught an exception trying to create a JMSException for " +er.getException(),e);
|
||||
}
|
||||
if (er.getException() instanceof SecurityException && command instanceof ConnectionInfo){
|
||||
try {
|
||||
forceCloseOnSecurityException(er.getException());
|
||||
} catch (Throwable t) {
|
||||
// We throw the original error from the ExceptionResponse instead.
|
||||
}
|
||||
}
|
||||
if (jmsEx != null) {
|
||||
throw jmsEx;
|
||||
|
Loading…
x
Reference in New Issue
Block a user