You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2010/07/07 06:18:15 UTC
svn commit: r961199 - in /activemq/sandbox/activemq-apollo-actor:
activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/
activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/
activemq-util/src/main/resources/org/apache/activemq/apo...
Author: chirino
Date: Wed Jul 7 04:18:15 2010
New Revision: 961199
URL: http://svn.apache.org/viewvc?rev=961199&view=rev
Log:
fixing compile errors.
Modified:
activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala
activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompWireFormat.scala
activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/resources/org/apache/activemq/apollo/MemoryPoolFactory.scala
activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/MemoryPool.scala
Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala?rev=961199&r1=961198&r2=961199&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala Wed Jul 7 04:18:15 2010
@@ -34,6 +34,7 @@ import org.apache.activemq.apollo.dto.{H
import java.io.File
import java.util.concurrent.TimeUnit
import org.apache.activemq.apollo.util.LongCounter
+import org.apache.activemq.apollo.MemoryPool
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
Modified: activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala?rev=961199&r1=961198&r2=961199&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala Wed Jul 7 04:18:15 2010
@@ -31,7 +31,7 @@ import StompFrameConstants._
import java.io.IOException
import org.apache.activemq.selector.SelectorParser
import org.apache.activemq.filter.{BooleanExpression, FilterException}
-import org.apache.activemq.broker.store.{DirectRecordStore, StoreUOW}
+import org.apache.activemq.broker.store.{StoreUOW}
object StompConstants {
@@ -170,9 +170,9 @@ class StompProtocolHandler extends Proto
connection.connector.broker.getDefaultVirtualHost(
queue.wrap { (host)=>
this.host=host
- if( this.host.store!=null && this.host.store.isInstanceOf[DirectRecordStore] ) {
+ if( this.host.memory_pool!=null ) {
val wf = connection.transport.getWireformat.asInstanceOf[StompWireFormat]
- wf.direct_record_store = this.host.store.asInstanceOf[DirectRecordStore]
+ wf.memory_pool = this.host.memory_pool
}
connection.transport.resumeRead
}
Modified: activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompWireFormat.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompWireFormat.scala?rev=961199&r1=961198&r2=961199&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompWireFormat.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompWireFormat.scala Wed Jul 7 04:18:15 2010
@@ -30,8 +30,8 @@ import BufferConversions._
import _root_.scala.collection.JavaConversions._
import StompFrameConstants._
import java.io.{EOFException, DataOutput, DataInput, IOException}
-import org.apache.activemq.broker.store.DirectRecordStore
import java.nio.channels.{SocketChannel, WritableByteChannel, ReadableByteChannel}
+import org.apache.activemq.apollo.MemoryPool
/**
* Creates WireFormat objects that marshalls the <a href="http://activemq.apache.org/stomp/">Stomp</a> protocol.
@@ -70,7 +70,7 @@ class StompWireFormat extends WireFormat
import StompWireFormat._
override protected def log: Log = StompWireFormat
- var direct_record_store:DirectRecordStore = null
+ var memory_pool:MemoryPool = null
implicit def wrap(x: Buffer) = ByteBuffer.wrap(x.data, x.offset, x.length);
implicit def wrap(x: Byte) = {
Modified: activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/resources/org/apache/activemq/apollo/MemoryPoolFactory.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/resources/org/apache/activemq/apollo/MemoryPoolFactory.scala?rev=961199&r1=961198&r2=961199&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/resources/org/apache/activemq/apollo/MemoryPoolFactory.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/resources/org/apache/activemq/apollo/MemoryPoolFactory.scala Wed Jul 7 04:18:15 2010
@@ -1,39 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.activemq.apollo
-resSPI ::= SPI
+import org.apache.activemq.apollo.util.ClassFinder
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class MemoryPoolFactory
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+object MemoryPoolFactory {
+
+ val finder = ClassFinder[SPI]("META-INF/services/org.apache.activemq.apollo/memory-pools")
+ var memory_pool_spis = List[SPI]()
+
+ trait SPI {
+ def create(config:String):MemoryPool
+ def validate(config: String):Boolean
+ }
+
+ finder.find.foreach{ clazz =>
+ try {
+ val SPI = clazz.newInstance.asInstanceOf[SPI]
+ memory_pool_spis ::= SPI
} catch {
case e:Throwable =>
e.printStackTrace
}
}
- def create(config:StoreDTO):Store = {
+ def create(config:String):MemoryPool = {
if( config == null ) {
return null
}
- storesSPI.foreach { spi=>
+ memory_pool_spis.foreach { spi=>
val rc = spi.create(config)
if( rc!=null ) {
return rc
}
}
- throw new IllegalArgumentException("Uknonwn store type: "+config.getClass)
+ throw new IllegalArgumentException("Uknonwn memory pool type: "+config)
}
- def validate(config: StoreDTO, reporter:Reporter):ReporterLevel = {
+ def validate(config: String):Boolean = {
if( config == null ) {
- return INFO
+ return true
} else {
- storesSPI.foreach { spi=>
- val rc = spi.validate(config, reporter)
- if( rc!=null ) {
- return rc
+ memory_pool_spis.foreach { spi=>
+ if( spi.validate(config) ) {
+ return true
}
}
}
- reporter.report(ERROR, "Uknonwn store type: "+config.getClass)
- ERROR
+ false
}
}
\ 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=961199&r1=961198&r2=961199&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:15 2010
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.broker
+package org.apache.activemq.apollo
import java.nio.ByteBuffer
@@ -31,5 +31,5 @@ trait MemoryAllocation {
*/
trait MemoryPool {
def alloc(size:Int):MemoryAllocation
- def free(MemoryAllocation)
+ def free(ma:MemoryAllocation)
}
\ No newline at end of file