mirror of https://github.com/apache/activemq.git
fix for: https://issues.apache.org/jira/browse/AMQ-4676 and https://issues.apache.org/jira/browse/AMQ-4673
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1517052 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2d861dae65
commit
174fe15b30
|
@ -50,6 +50,7 @@ import javax.annotation.PostConstruct;
|
|||
import javax.annotation.PreDestroy;
|
||||
import javax.management.MalformedObjectNameException;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionMetaData;
|
||||
import org.apache.activemq.ConfigurationException;
|
||||
import org.apache.activemq.Service;
|
||||
|
@ -99,11 +100,10 @@ import org.slf4j.LoggerFactory;
|
|||
import org.slf4j.MDC;
|
||||
|
||||
/**
|
||||
* Manages the lifecycle of an ActiveMQ Broker. A BrokerService consists of a
|
||||
* Manages the life-cycle of an ActiveMQ Broker. A BrokerService consists of a
|
||||
* number of transport connectors, network connectors and a bunch of properties
|
||||
* which can be used to configure the broker as its lazily created.
|
||||
*
|
||||
*
|
||||
* @org.apache.xbean.XBean
|
||||
*/
|
||||
public class BrokerService implements Service {
|
||||
|
@ -114,7 +114,10 @@ public class BrokerService implements Service {
|
|||
public static final int DEFAULT_MAX_FILE_LENGTH = 1024 * 1024 * 32;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(BrokerService.class);
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final long serialVersionUID = 7353129142305630237L;
|
||||
|
||||
private boolean useJmx = true;
|
||||
private boolean enableStatistics = true;
|
||||
private boolean persistent = true;
|
||||
|
@ -497,12 +500,25 @@ public class BrokerService implements Service {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to autoStart, done to prevent backwards incompatible signature change
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
autoStart();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org. apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
public void autoStart() throws Exception {
|
||||
if(shouldAutostart()) {
|
||||
start();
|
||||
|
@ -664,13 +680,26 @@ public class BrokerService implements Service {
|
|||
getBroker().nowMasterBroker();
|
||||
}
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to stop, done to prevent backwards incompatible signature change
|
||||
*/
|
||||
@PreDestroy
|
||||
private void preDestroy () {
|
||||
try {
|
||||
stop();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org.apache .xbean.DestroyMethod
|
||||
*/
|
||||
@Override
|
||||
@PreDestroy
|
||||
public void stop() throws Exception {
|
||||
if (!stopping.compareAndSet(false, true)) {
|
||||
LOG.trace("Broker already stopping/stopped");
|
||||
|
|
|
@ -28,21 +28,7 @@ import org.apache.activemq.broker.ProducerBrokerExchange;
|
|||
import org.apache.activemq.broker.region.Destination;
|
||||
import org.apache.activemq.broker.region.MessageReference;
|
||||
import org.apache.activemq.broker.region.Subscription;
|
||||
import org.apache.activemq.command.ActiveMQDestination;
|
||||
import org.apache.activemq.command.BrokerInfo;
|
||||
import org.apache.activemq.command.ConnectionInfo;
|
||||
import org.apache.activemq.command.ConsumerInfo;
|
||||
import org.apache.activemq.command.DestinationInfo;
|
||||
import org.apache.activemq.command.Message;
|
||||
import org.apache.activemq.command.MessageAck;
|
||||
import org.apache.activemq.command.MessageDispatch;
|
||||
import org.apache.activemq.command.MessageDispatchNotification;
|
||||
import org.apache.activemq.command.MessagePull;
|
||||
import org.apache.activemq.command.ProducerInfo;
|
||||
import org.apache.activemq.command.RemoveSubscriptionInfo;
|
||||
import org.apache.activemq.command.Response;
|
||||
import org.apache.activemq.command.SessionInfo;
|
||||
import org.apache.activemq.command.TransactionId;
|
||||
import org.apache.activemq.command.*;
|
||||
import org.apache.activemq.usage.Usage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -52,7 +38,6 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
* @org.apache.xbean.XBean
|
||||
*/
|
||||
|
||||
public class LoggingBrokerPlugin extends BrokerPluginSupport {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(LoggingBrokerPlugin.class);
|
||||
|
@ -66,11 +51,24 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
|
|||
private boolean logProducerEvents = false;
|
||||
private boolean logInternalEvents = false;
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
LOG.info("Created LoggingBrokerPlugin: " + this.toString());
|
||||
}
|
||||
|
|
|
@ -20,11 +20,7 @@ package org.apache.activemq.camel.component;
|
|||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.ConnectionFactory;
|
||||
|
||||
import org.apache.activemq.EnhancedConnection;
|
||||
import org.apache.activemq.advisory.DestinationEvent;
|
||||
import org.apache.activemq.advisory.DestinationListener;
|
||||
import org.apache.activemq.advisory.DestinationSource;
|
||||
|
@ -36,14 +32,12 @@ import org.apache.camel.CamelContextAware;
|
|||
import org.apache.camel.Endpoint;
|
||||
import org.apache.camel.component.jms.JmsEndpoint;
|
||||
import org.apache.camel.component.jms.JmsQueueEndpoint;
|
||||
import org.apache.camel.util.ObjectHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A helper bean which populates a {@link CamelContext} with ActiveMQ Queue endpoints
|
||||
*
|
||||
*
|
||||
* @org.apache.xbean.XBean
|
||||
*/
|
||||
public class CamelEndpointLoader implements CamelContextAware {
|
||||
|
@ -60,15 +54,31 @@ public class CamelEndpointLoader implements CamelContextAware {
|
|||
this.source = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change
|
||||
*
|
||||
* fix: AMQ-4676
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (source != null) {
|
||||
source.setDestinationListener(new DestinationListener() {
|
||||
@Override
|
||||
public void onDestinationEvent(DestinationEvent event) {
|
||||
try {
|
||||
ActiveMQDestination destination = event.getDestination();
|
||||
|
@ -107,10 +117,12 @@ public class CamelEndpointLoader implements CamelContextAware {
|
|||
|
||||
// Properties
|
||||
//-------------------------------------------------------------------------
|
||||
@Override
|
||||
public CamelContext getCamelContext() {
|
||||
return camelContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCamelContext(CamelContext camelContext) {
|
||||
this.camelContext = camelContext;
|
||||
}
|
||||
|
|
|
@ -95,12 +95,25 @@ public class PooledConnectionFactoryBean implements FactoryBean {
|
|||
this.connectionFactory = connectionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (pooledConnectionFactory == null && transactionManager != null && resourceName != null) {
|
||||
try {
|
||||
|
@ -146,12 +159,25 @@ public class PooledConnectionFactoryBean implements FactoryBean {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to destroy, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PreDestroy
|
||||
private void preDestroy() {
|
||||
try {
|
||||
destroy();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.DestroyMethod
|
||||
*/
|
||||
@PreDestroy
|
||||
public void destroy() throws Exception {
|
||||
if (pooledConnectionFactory != null) {
|
||||
pooledConnectionFactory.stop();
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
*/
|
||||
package org.apache.activemq.security;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* Represents an entry in a {@link DefaultAuthorizationMap} for assigning
|
||||
* different operations (read, write, admin) of user roles to a specific
|
||||
|
@ -45,11 +45,25 @@ public class XBeanAuthorizationEntry extends AuthorizationEntry implements Initi
|
|||
writeRoles = roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
if (adminRoles != null) {
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
*/
|
||||
package org.apache.activemq.security;
|
||||
|
||||
import org.apache.activemq.filter.DestinationMapEntry;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.activemq.filter.DestinationMapEntry;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -30,11 +31,25 @@ public class XBeanAuthorizationMap extends DefaultAuthorizationMap implements In
|
|||
|
||||
protected List<DestinationMapEntry> authorizationEntries;
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
for (DestinationMapEntry entry : authorizationEntries) {
|
||||
if (((XBeanAuthorizationEntry)entry).getGroupClass() == null) {
|
||||
|
@ -50,6 +65,7 @@ public class XBeanAuthorizationMap extends DefaultAuthorizationMap implements In
|
|||
*
|
||||
* @org.apache.xbean.ElementType class="org.apache.activemq.security.AuthorizationEntry"
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void setAuthorizationEntries(List<DestinationMapEntry> entries) {
|
||||
this.authorizationEntries = entries;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.activemq.spring;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
|
@ -35,11 +36,23 @@ public class ActiveMQConnectionFactory extends org.apache.activemq.ActiveMQConne
|
|||
private boolean useBeanNameAsClientIdPrefix;
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (isUseBeanNameAsClientIdPrefix() && getClientIDPrefix() == null) {
|
||||
setClientIDPrefix(getBeanName());
|
||||
|
@ -50,6 +63,7 @@ public class ActiveMQConnectionFactory extends org.apache.activemq.ActiveMQConne
|
|||
return beanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.activemq.spring;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
|
@ -26,20 +27,31 @@ import org.springframework.beans.factory.BeanNameAware;
|
|||
* easier comprehension from <a href="http://activemq.apache.org/jmx.html">JMX</a>.
|
||||
*
|
||||
* @org.apache.xbean.XBean element="xaConnectionFactory"
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ActiveMQXAConnectionFactory extends org.apache.activemq.ActiveMQXAConnectionFactory implements BeanNameAware {
|
||||
|
||||
private String beanName;
|
||||
private boolean useBeanNameAsClientIdPrefix;
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (isUseBeanNameAsClientIdPrefix() && getClientIDPrefix() == null) {
|
||||
setClientIDPrefix(getBeanName());
|
||||
|
@ -50,6 +62,7 @@ public class ActiveMQXAConnectionFactory extends org.apache.activemq.ActiveMQXAC
|
|||
return beanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import javax.net.ssl.KeyManager;
|
|||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
|
||||
import org.apache.activemq.broker.SslContext;
|
||||
|
||||
/**
|
||||
|
@ -55,12 +56,25 @@ public class SpringSslContext extends SslContext {
|
|||
private String keyStorePassword;
|
||||
private String trustStorePassword;
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
keyManagers.addAll(createKeyManagers());
|
||||
trustManagers.addAll(createTrustManagers());
|
||||
|
|
|
@ -48,12 +48,25 @@ public class XBeanBrokerService extends BrokerService {
|
|||
start = BrokerFactory.getStartDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
ensureSystemUsageHasStore();
|
||||
if (shouldAutostart()) {
|
||||
|
@ -79,12 +92,25 @@ public class XBeanBrokerService extends BrokerService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to destroy, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PreDestroy
|
||||
private void preDestroy() {
|
||||
try {
|
||||
destroy();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.DestroyMethod
|
||||
*/
|
||||
@PreDestroy
|
||||
public void destroy() throws Exception {
|
||||
stop();
|
||||
}
|
||||
|
|
|
@ -58,12 +58,25 @@ public class ResourceLoadingSslContext extends SslContext {
|
|||
private String keyStorePassword;
|
||||
private String trustStorePassword;
|
||||
|
||||
/**
|
||||
* JSR-250 callback wrapper; converts checked exceptions to runtime exceptions
|
||||
*
|
||||
* delegates to afterPropertiesSet, done to prevent backwards incompatible signature change.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
try {
|
||||
afterPropertiesSet();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
* @org.apache.xbean.InitMethod
|
||||
*/
|
||||
@PostConstruct
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
keyManagers.addAll(createKeyManagers());
|
||||
trustManagers.addAll(createTrustManagers());
|
||||
|
|
Loading…
Reference in New Issue