activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r961201 - in /activemq/sandbox/activemq-apollo-actor: activemq-hawtdb/src/main/resources/META-INF/services/org/apache/activemq/apollo/ activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/ activemq-util/src/main/scala/org/...
Date Wed, 07 Jul 2010 04:18:44 GMT
Author: chirino
Date: Wed Jul  7 04:18:44 2010
New Revision: 961201

URL: http://svn.apache.org/viewvc?rev=961201&view=rev
Log:
better memory pool interface

Modified:
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org/apache/activemq/apollo/memory-pools
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBMemoryPoolSPI.scala
    activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/MemoryPool.scala

Modified: activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org/apache/activemq/apollo/memory-pools
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org/apache/activemq/apollo/memory-pools?rev=961201&r1=961200&r2=961201&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org/apache/activemq/apollo/memory-pools
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org/apache/activemq/apollo/memory-pools
Wed Jul  7 04:18:44 2010
@@ -14,4 +14,4 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
-org.apache.activemq.broker.store.hawtdb.HawtDBStoreSPI
\ No newline at end of file
+org.apache.activemq.broker.store.hawtdb.HawtDBMemoryPoolSPI
\ No newline at end of file

Modified: activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBMemoryPoolSPI.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBMemoryPoolSPI.scala?rev=961201&r1=961200&r2=961201&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBMemoryPoolSPI.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBMemoryPoolSPI.scala
Wed Jul  7 04:18:44 2010
@@ -16,39 +16,35 @@
  */
 package org.apache.activemq.broker.store.hawtdb
 
-import org.apache.activemq.apollo.store.StoreFactory
-import org.apache.activemq.apollo.dto.{HawtDBStoreDTO, StoreDTO}
-import org.apache.activemq.apollo.broker.{Reporting, ReporterLevel, Reporter}
-import ReporterLevel._
+import java.io.File
+import java.lang.String
+import org.apache.activemq.apollo.MemoryPoolFactory
 
 /**
  * <p>
- * Hook to use a HawtDBStore when a HawtDBStoreDTO is
- * used in a broker configuration.
+ * Hook to use a HawtDBMemoryPool for the memory pool implementation.
  * </p>
  * <p>
  * This class is discovered using the following resource file:
- * <code>META-INF/services/org.apache.activemq.apollo/stores</code>
+ * <code>META-INF/services/org.apache.activemq.apollo/memory-pools</code>
  * </p>
  * 
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class HawtDBMemoryPoolSPI extends StoreFactory.SPI {
+class HawtDBMemoryPoolSPI extends MemoryPoolFactory.SPI {
 
-  def create(config: StoreDTO) = {
-    if( config.isInstanceOf[HawtDBStoreDTO]) {
-// TODO:      new HawtDBMemoryPool
-      null
+  val prefix: String = "hawtdb:"
+
+  def create(config: String) = {
+    if( config.startsWith(prefix) ) {
+      val file = new File(config.substring(prefix.length))
+      new HawtDBMemoryPool(file)
     } else {
       null
     }
   }
 
-   def validate(config: StoreDTO, reporter:Reporter):ReporterLevel = {
-     if( config.isInstanceOf[HawtDBStoreDTO]) {
-       HawtDBStore.validate(config.asInstanceOf[HawtDBStoreDTO], reporter)
-     } else {
-       null
-     }
+   def validate(config: String):Boolean = {
+     config.startsWith(prefix) && !config.substring(prefix.length).isEmpty
    }
 }
\ No newline at end of file

Modified: activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/MemoryPool.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/MemoryPool.scala?rev=961201&r1=961200&r2=961201&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/MemoryPool.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/MemoryPool.scala
Wed Jul  7 04:18:44 2010
@@ -17,8 +17,16 @@
 package org.apache.activemq.apollo
 
 import java.nio.ByteBuffer
+import org.fusesource.hawtdispatch.Retained
+import org.apache.activemq.Service
 
-trait MemoryAllocation {
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+trait MemoryAllocation extends Retained {
   def size:Int
   def buffer:ByteBuffer
 }
@@ -29,7 +37,6 @@ trait MemoryAllocation {
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-trait MemoryPool {
+trait MemoryPool extends Service {
   def alloc(size:Int):MemoryAllocation
-  def free(ma:MemoryAllocation)
 }
\ No newline at end of file



Mime
View raw message