activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r383486 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker: ./ jmx/ region/
Date Mon, 06 Mar 2006 07:25:53 GMT
Author: rajdavies
Date: Sun Mar  5 23:25:51 2006
New Revision: 383486

URL: http://svn.apache.org/viewcvs?rev=383486&view=rev
Log:
PolicyMap not initialized by XBean/Spring when Broker constructed for Transports.
Chanhed so PolicyMap is lazily fetched from the BrokerService by the RegionBroker

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedQueueRegion.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTopicRegion.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueRegion.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueueRegion.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopicRegion.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Sun Mar  5 23:25:51 2006
@@ -893,11 +893,10 @@
         if (isUseJmx()) {
             MBeanServer mbeanServer = getManagementContext().getMBeanServer();
             regionBroker = new ManagedRegionBroker(this,mbeanServer, getBrokerObjectName(),
-                    getTaskRunnerFactory(), getMemoryManager(), getPersistenceAdapter(),
getDestinationPolicy());
+                    getTaskRunnerFactory(), getMemoryManager(), getPersistenceAdapter());
         }
         else {
-			regionBroker = new RegionBroker(this,getTaskRunnerFactory(), getMemoryManager(), getPersistenceAdapter(),
-                    getDestinationPolicy());
+			regionBroker = new RegionBroker(this,getTaskRunnerFactory(), getMemoryManager(), getPersistenceAdapter());
         }
 		regionBroker.setBrokerName(getBrokerName());
 		return regionBroker;

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedQueueRegion.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedQueueRegion.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedQueueRegion.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedQueueRegion.java
Sun Mar  5 23:25:51 2006
@@ -34,8 +34,8 @@
 
     private final ManagedRegionBroker regionBroker;
 
-    public ManagedQueueRegion(ManagedRegionBroker broker, DestinationStatistics destinationStatistics,
UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory, PersistenceAdapter persistenceAdapter,
PolicyMap policyMap) {
-        super(broker,destinationStatistics, memoryManager, taskRunnerFactory, persistenceAdapter,
policyMap);
+    public ManagedQueueRegion(ManagedRegionBroker broker, DestinationStatistics destinationStatistics,
UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory, PersistenceAdapter persistenceAdapter)
{
+        super(broker,destinationStatistics, memoryManager, taskRunnerFactory, persistenceAdapter);
         regionBroker = broker;
     }
 

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
Sun Mar  5 23:25:51 2006
@@ -83,9 +83,8 @@
     private Broker contextBroker;
 
     public ManagedRegionBroker(BrokerService brokerService,MBeanServer mbeanServer,ObjectName
brokerObjectName,
-                    TaskRunnerFactory taskRunnerFactory,UsageManager memoryManager,PersistenceAdapter
adapter,
-                    PolicyMap policyMap) throws IOException{
-        super(brokerService,taskRunnerFactory,memoryManager,adapter,policyMap);
+                    TaskRunnerFactory taskRunnerFactory,UsageManager memoryManager,PersistenceAdapter
adapter) throws IOException{
+        super(brokerService,taskRunnerFactory,memoryManager,adapter);
         this.mbeanServer=mbeanServer;
         this.brokerObjectName=brokerObjectName;
     }
@@ -98,8 +97,8 @@
     }
 
     protected Region createQueueRegion(UsageManager memoryManager,TaskRunnerFactory taskRunnerFactory,
-                    PersistenceAdapter adapter,PolicyMap policyMap){
-        return new ManagedQueueRegion(this,destinationStatistics,memoryManager,taskRunnerFactory,adapter,policyMap);
+                    PersistenceAdapter adapter){
+        return new ManagedQueueRegion(this,destinationStatistics,memoryManager,taskRunnerFactory,adapter);
     }
 
     protected Region createTempQueueRegion(UsageManager memoryManager,TaskRunnerFactory taskRunnerFactory){
@@ -111,8 +110,8 @@
     }
 
     protected Region createTopicRegion(UsageManager memoryManager,TaskRunnerFactory taskRunnerFactory,
-                    PersistenceAdapter adapter,PolicyMap policyMap){
-        return new ManagedTopicRegion(this,destinationStatistics,memoryManager,taskRunnerFactory,adapter,policyMap);
+                    PersistenceAdapter adapter){
+        return new ManagedTopicRegion(this,destinationStatistics,memoryManager,taskRunnerFactory,adapter);
     }
 
     public void register(ActiveMQDestination destName,Destination destination){

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTopicRegion.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTopicRegion.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTopicRegion.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTopicRegion.java
Sun Mar  5 23:25:51 2006
@@ -34,8 +34,8 @@
 
     private final ManagedRegionBroker regionBroker;
 
-    public ManagedTopicRegion(ManagedRegionBroker broker, DestinationStatistics destinationStatistics,
UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory, PersistenceAdapter persistenceAdapter,
PolicyMap policyMap) {
-        super(broker,destinationStatistics, memoryManager, taskRunnerFactory, persistenceAdapter,
policyMap);
+    public ManagedTopicRegion(ManagedRegionBroker broker, DestinationStatistics destinationStatistics,
UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory, PersistenceAdapter persistenceAdapter)
{
+        super(broker,destinationStatistics, memoryManager, taskRunnerFactory, persistenceAdapter);
         regionBroker = broker;
     }
 

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
Sun Mar  5 23:25:51 2006
@@ -52,12 +52,12 @@
     protected final UsageManager memoryManager;
     protected final PersistenceAdapter persistenceAdapter;
     protected final DestinationStatistics destinationStatistics;
-    protected final Broker broker;
+    protected final RegionBroker broker;
     protected boolean autoCreateDestinations=true;
     protected final TaskRunnerFactory taskRunnerFactory;
     protected final Object destinationsMutex = new Object();
     
-    public AbstractRegion(Broker broker,DestinationStatistics destinationStatistics, UsageManager
memoryManager, TaskRunnerFactory taskRunnerFactory, PersistenceAdapter persistenceAdapter)
{
+    public AbstractRegion(RegionBroker broker,DestinationStatistics destinationStatistics,
UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory, PersistenceAdapter persistenceAdapter)
{
         this.broker = broker;
         this.destinationStatistics = destinationStatistics;
         this.memoryManager = memoryManager;

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueRegion.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueRegion.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueRegion.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueRegion.java
Sun Mar  5 23:25:51 2006
@@ -39,12 +39,11 @@
  */
 public class QueueRegion extends AbstractRegion {
 
-    private final PolicyMap policyMap;
+    
 
-    public QueueRegion(Broker broker,DestinationStatistics destinationStatistics, UsageManager
memoryManager, TaskRunnerFactory taskRunnerFactory,
-            PersistenceAdapter persistenceAdapter, PolicyMap policyMap) {
+    public QueueRegion(RegionBroker broker,DestinationStatistics destinationStatistics, UsageManager
memoryManager, TaskRunnerFactory taskRunnerFactory,
+            PersistenceAdapter persistenceAdapter) {
         super(broker,destinationStatistics, memoryManager, taskRunnerFactory, persistenceAdapter);
-        this.policyMap = policyMap;
     }
 
     public String toString() {
@@ -62,8 +61,8 @@
     }
 
     protected void configureQueue(Queue queue, ActiveMQDestination destination) {
-        if (policyMap != null) {
-            PolicyEntry entry = policyMap.getEntryFor(destination);
+        if (broker.getDestinationPolicy() != null) {
+            PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination);
             if (entry != null) {
                 entry.configure(queue);
             }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
Sun Mar  5 23:25:51 2006
@@ -83,16 +83,13 @@
     private Map clientIdSet = new HashMap(); // we will synchronize access
     protected  PersistenceAdapter adaptor;
 
+        
     public RegionBroker(BrokerService brokerService,TaskRunnerFactory taskRunnerFactory,
UsageManager memoryManager, PersistenceAdapter adapter) throws IOException {
-        this(brokerService,taskRunnerFactory, memoryManager, createDefaultPersistenceAdapter(memoryManager),
null);
-    }
-    
-    public RegionBroker(BrokerService brokerService,TaskRunnerFactory taskRunnerFactory,
UsageManager memoryManager, PersistenceAdapter adapter, PolicyMap policyMap) throws IOException
{
         this.brokerService = brokerService;
         this.sequenceGenerator.setLastSequenceId( adapter.getLastMessageBrokerSequenceId()
);
         this.adaptor = adapter;//weird - both are valid spellings ...
-        queueRegion = createQueueRegion(memoryManager, taskRunnerFactory, adapter, policyMap);
-        topicRegion = createTopicRegion(memoryManager, taskRunnerFactory, adapter, policyMap);
+        queueRegion = createQueueRegion(memoryManager, taskRunnerFactory, adapter);
+        topicRegion = createTopicRegion(memoryManager, taskRunnerFactory, adapter);
         
         tempQueueRegion = createTempQueueRegion(memoryManager, taskRunnerFactory);
         tempTopicRegion = createTempTopicRegion(memoryManager, taskRunnerFactory);      
 
@@ -113,12 +110,12 @@
         return new TempQueueRegion(this,destinationStatistics, memoryManager, taskRunnerFactory);
     }
 
-    protected Region createTopicRegion(UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory,
PersistenceAdapter adapter, PolicyMap policyMap) {
-        return new TopicRegion(this,destinationStatistics, memoryManager, taskRunnerFactory,
adapter, policyMap);
+    protected Region createTopicRegion(UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory,
PersistenceAdapter adapter) {
+        return new TopicRegion(this,destinationStatistics, memoryManager, taskRunnerFactory,
adapter);
     }
 
-    protected Region createQueueRegion(UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory,
PersistenceAdapter adapter, PolicyMap policyMap) {
-        return new QueueRegion(this,destinationStatistics, memoryManager, taskRunnerFactory,
adapter, policyMap);
+    protected Region createQueueRegion(UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory,
PersistenceAdapter adapter) {
+        return new QueueRegion(this,destinationStatistics, memoryManager, taskRunnerFactory,
adapter);
     }
     
     private static PersistenceAdapter createDefaultPersistenceAdapter(UsageManager memoryManager)
throws IOException {
@@ -141,6 +138,10 @@
         ss.stop(tempQueueRegion);
         ss.stop(tempTopicRegion);
         ss.throwFirstException();
+    }
+    
+    public PolicyMap getDestinationPolicy(){
+        return brokerService != null ? brokerService.getDestinationPolicy() : null;
     }
 
     public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception
{

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueueRegion.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueueRegion.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueueRegion.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueueRegion.java
Sun Mar  5 23:25:51 2006
@@ -33,7 +33,7 @@
  */
 public class TempQueueRegion extends AbstractRegion {
 
-    public TempQueueRegion(Broker broker,DestinationStatistics destinationStatistics, UsageManager
memoryManager, TaskRunnerFactory taskRunnerFactory) {
+    public TempQueueRegion(RegionBroker broker,DestinationStatistics destinationStatistics,
UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory) {
         super(broker,destinationStatistics, memoryManager, taskRunnerFactory, null);
         setAutoCreateDestinations(false);
     }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopicRegion.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopicRegion.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopicRegion.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopicRegion.java
Sun Mar  5 23:25:51 2006
@@ -32,7 +32,7 @@
  */
 public class TempTopicRegion extends AbstractRegion {
 
-    public TempTopicRegion(Broker broker,DestinationStatistics destinationStatistics, UsageManager
memoryManager, TaskRunnerFactory taskRunnerFactory) {
+    public TempTopicRegion(RegionBroker broker,DestinationStatistics destinationStatistics,
UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory) {
         super(broker,destinationStatistics, memoryManager, taskRunnerFactory, null);
         setAutoCreateDestinations(false);
     }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java?rev=383486&r1=383485&r2=383486&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java
Sun Mar  5 23:25:51 2006
@@ -49,12 +49,12 @@
     private static final Log log = LogFactory.getLog(TopicRegion.class);
     
     protected final ConcurrentHashMap durableSubscriptions = new ConcurrentHashMap();
-    private final PolicyMap policyMap;
+   
 
-    public TopicRegion(Broker broker,DestinationStatistics destinationStatistics, UsageManager
memoryManager, TaskRunnerFactory taskRunnerFactory,
-            PersistenceAdapter persistenceAdapter, PolicyMap policyMap) {
+    public TopicRegion(RegionBroker broker,DestinationStatistics destinationStatistics, UsageManager
memoryManager, TaskRunnerFactory taskRunnerFactory,
+            PersistenceAdapter persistenceAdapter) {
         super(broker,destinationStatistics, memoryManager, taskRunnerFactory, persistenceAdapter);
-        this.policyMap = policyMap;
+        
     }
 
     public void addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception
{
@@ -182,8 +182,8 @@
     }
 
     protected void configureTopic(Topic topic, ActiveMQDestination destination) {
-        if (policyMap != null) {
-            PolicyEntry entry = policyMap.getEntryFor(destination);
+        if (broker.getDestinationPolicy() != null) {
+            PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination);
             if (entry != null) {
                 entry.configure(topic);
             }
@@ -208,8 +208,8 @@
             
             // lets configure the subscription depending on the destination
             ActiveMQDestination destination = info.getDestination();
-            if (destination != null && policyMap != null) {
-                PolicyEntry entry = policyMap.getEntryFor(destination);
+            if (destination != null && broker.getDestinationPolicy() != null) {
+                PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination);
                 if (entry != null) {
                     entry.configure(answer);
                 }



Mime
View raw message