activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r440108 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq: broker/BrokerService.java store/DefaultPersistenceAdapterFactory.java
Date Mon, 04 Sep 2006 15:40:54 GMT
Author: rajdavies
Date: Mon Sep  4 08:40:53 2006
New Revision: 440108

URL: http://svn.apache.org/viewvc?view=rev&rev=440108
Log:
Use a different TaskFactory for PersistenceAdaptors - allowing the thread priority
to be set differently for PersistenceAdaptors (e.g. Journal) than normal tasks.

This is part of the work necessary for http://issues.apache.org/activemq/browse/AMQ-845

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/store/DefaultPersistenceAdapterFactory.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?view=diff&rev=440108&r1=440107&r2=440108
==============================================================================
--- 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
Mon Sep  4 08:40:53 2006
@@ -109,6 +109,7 @@
     private ManagementContext managementContext;
     private ObjectName brokerObjectName;
     private TaskRunnerFactory taskRunnerFactory;
+    private TaskRunnerFactory persistenceTaskRunnerFactory;
     private UsageManager memoryManager;
     private PersistenceAdapter persistenceAdapter;
     private PersistenceAdapterFactory persistenceFactory;
@@ -139,6 +140,8 @@
     private DestinationInterceptor[] destinationInterceptors;
     private ActiveMQDestination[] destinations;
     private Store tempDataStore;
+    private int persistenceThreadPriority = Thread.MAX_PRIORITY;
+   
 
     /**
      * Adds a new transport connector for the given bind address
@@ -617,6 +620,19 @@
     public void setTaskRunnerFactory(TaskRunnerFactory taskRunnerFactory) {
         this.taskRunnerFactory = taskRunnerFactory;
     }
+    
+    
+    public TaskRunnerFactory getPersistenceTaskRunnerFactory(){
+        if (taskRunnerFactory == null) {
+            persistenceTaskRunnerFactory = new TaskRunnerFactory("Persistence Adaptor Task",
persistenceThreadPriority, true, 1000);
+        }
+        return persistenceTaskRunnerFactory;
+    }
+
+   
+    public void setPersistenceTaskRunnerFactory(TaskRunnerFactory persistenceTaskRunnerFactory){
+        this.persistenceTaskRunnerFactory=persistenceTaskRunnerFactory;
+    }
 
     public boolean isUseJmx() {
         return useJmx;
@@ -947,6 +963,14 @@
     public void setTempDataStore(Store tempDataStore){
         this.tempDataStore=tempDataStore;
     }   
+    
+    public int getPersistenceThreadPriority(){
+        return persistenceThreadPriority;
+    }
+
+    public void setPersistenceThreadPriority(int persistenceThreadPriority){
+        this.persistenceThreadPriority=persistenceThreadPriority;
+    }
 
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -1223,7 +1247,7 @@
     protected DefaultPersistenceAdapterFactory createPersistenceFactory() {
         DefaultPersistenceAdapterFactory factory = new DefaultPersistenceAdapterFactory();
         factory.setDataDirectoryFile(getDataDirectory());
-        factory.setTaskRunnerFactory(getTaskRunnerFactory());
+        factory.setTaskRunnerFactory(getPersistenceTaskRunnerFactory());
         return factory;
     }
 
@@ -1427,6 +1451,11 @@
             masterConnector = (MasterConnector) service;
         }
     }
+
+   
+    
+
+    
 
     
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/DefaultPersistenceAdapterFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/DefaultPersistenceAdapterFactory.java?view=diff&rev=440108&r1=440107&r2=440108
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/DefaultPersistenceAdapterFactory.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/DefaultPersistenceAdapterFactory.java
Mon Sep  4 08:40:53 2006
@@ -53,6 +53,7 @@
     private boolean useQuickJournal=false;
     private File journalArchiveDirectory;
     private boolean failIfJournalIsLocked=false;
+    private int journalThreadPriority = Thread.MAX_PRIORITY;
     private JDBCPersistenceAdapter jdbcPersistenceAdapter = new JDBCPersistenceAdapter();
     
     public PersistenceAdapter createPersistenceAdapter() throws IOException {
@@ -107,7 +108,7 @@
 
     public TaskRunnerFactory getTaskRunnerFactory() {
         if( taskRunnerFactory == null ) {
-            taskRunnerFactory = new TaskRunnerFactory();
+            taskRunnerFactory = new TaskRunnerFactory("Persistence Adaptor Task", journalThreadPriority,
true, 1000);
         }
         return taskRunnerFactory;
     }
@@ -177,6 +178,14 @@
     public void setCreateTablesOnStartup(boolean createTablesOnStartup) {
         jdbcPersistenceAdapter.setCreateTablesOnStartup(createTablesOnStartup);
     }
+    
+    public int getJournalThreadPriority(){
+        return journalThreadPriority;
+    }
+
+    public void setJournalThreadPriority(int journalThreadPriority){
+        this.journalThreadPriority=journalThreadPriority;
+    }
 
     /**
      * @throws IOException
@@ -200,5 +209,7 @@
             }
         }
     }
+
+    
 
 }



Mime
View raw message