activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r636609 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/BrokerService.java main/java/org/apache/activemq/broker/MutableBrokerFilter.java test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java
Date Thu, 13 Mar 2008 03:09:50 GMT
Author: chirino
Date: Wed Mar 12 20:09:48 2008
New Revision: 636609

URL: http://svn.apache.org/viewvc?rev=636609&view=rev
Log:
Allow the region broker implemenation to get changed by subclasses of BrokerService.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=636609&r1=636608&r2=636609&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Wed Mar 12 20:09:48 2008
@@ -126,7 +126,7 @@
     private SystemUsage consumerSystemUsaage;
     private PersistenceAdapter persistenceAdapter;
     private PersistenceAdapterFactory persistenceFactory;
-    private DestinationFactory destinationFactory;
+    protected DestinationFactory destinationFactory;
     private MessageAuthorizationPolicy messageAuthorizationPolicy;
     private List<TransportConnector> transportConnectors = new CopyOnWriteArrayList<TransportConnector>();
     private List<NetworkConnector> networkConnectors = new CopyOnWriteArrayList<NetworkConnector>();
@@ -1370,11 +1370,11 @@
     }
     
     protected PersistenceAdapter registerPersistenceAdapterMBean(PersistenceAdapter adaptor)
throws IOException {
-        MBeanServer mbeanServer = getManagementContext().getMBeanServer();
-        if (mbeanServer != null) {
-
-          
-        }
+//        MBeanServer mbeanServer = getManagementContext().getMBeanServer();
+//        if (mbeanServer != null) {
+//
+//          
+//        }
         return adaptor;
     }
 
@@ -1487,17 +1487,16 @@
         // Add a filter that will stop access to the broker once stopped
         broker = new MutableBrokerFilter(broker) {
             public void stop() throws Exception {
-                setNext(new ErrorBroker("Broker has been stopped: " + this) {
+                Broker old = this.next.getAndSet(new ErrorBroker("Broker has been stopped:
" + this) {
                     // Just ignore additional stop actions.
                     public void stop() throws Exception {
                     }
                 });
-                super.stop();
+                old.stop();
             }
         };
 
-        RegionBroker rBroker = (RegionBroker)regionBroker;
-        rBroker.getDestinationStatistics().setEnabled(enableStatistics);
+//        RegionBroker rBroker = (RegionBroker)regionBroker;
 
         if (isUseJmx()) {
             ManagedRegionBroker managedBroker = (ManagedRegionBroker)regionBroker;
@@ -1537,10 +1536,14 @@
         configureServices(destinationInterceptors);
 
         DestinationInterceptor destinationInterceptor = new CompositeDestinationInterceptor(destinationInterceptors);
-        RegionBroker regionBroker = null;
         if (destinationFactory == null) {
             destinationFactory = new DestinationFactoryImpl(this, getTaskRunnerFactory(),
getPersistenceAdapter());
         }
+        return createRegionBroker(destinationInterceptor);
+    }
+    
+    protected Broker createRegionBroker(DestinationInterceptor destinationInterceptor) throws
IOException {
+ 		    RegionBroker regionBroker;
         if (isUseJmx()) {
             MBeanServer mbeanServer = getManagementContext().getMBeanServer();
             regionBroker = new ManagedRegionBroker(this, mbeanServer, getBrokerObjectName(),
getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory,
@@ -1552,8 +1555,10 @@
 
         regionBroker.setKeepDurableSubsActive(keepDurableSubsActive);
         regionBroker.setBrokerName(getBrokerName());
-        return regionBroker;
-    }
+        regionBroker.getDestinationStatistics().setEnabled(enableStatistics);
+
+		    return regionBroker;
+	}
 
     /**
      * Create the default destination interceptor

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java?rev=636609&r1=636608&r2=636609&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java
Wed Mar 12 20:09:48 2008
@@ -51,7 +51,7 @@
  */
 public class MutableBrokerFilter implements Broker {
 
-    private AtomicReference<Broker> next = new AtomicReference<Broker>();
+    protected AtomicReference<Broker> next = new AtomicReference<Broker>();
 
     public MutableBrokerFilter(Broker next) {
         this.next.set(next);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java?rev=636609&r1=636608&r2=636609&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java
Wed Mar 12 20:09:48 2008
@@ -28,7 +28,7 @@
 
 public abstract class TransportBrokerTestSupport extends BrokerTest {
 
-    private TransportConnector connector;
+    protected TransportConnector connector;
     private ArrayList<StubConnection> connections = new ArrayList<StubConnection>();
 
     protected void setUp() throws Exception {
@@ -49,7 +49,9 @@
             connection.stop();
             iter.remove();
         }
-        connector.stop();
+        if( connector!=null ) {
+            connector.stop();
+        }
         super.tearDown();
     }
 



Mime
View raw message