diff --git a/bin/start-akka-server.bat b/bin/start-akka-server.bat index 8b75de5848..cc0ed74dbb 100755 --- a/bin/start-akka-server.bat +++ b/bin/start-akka-server.bat @@ -11,30 +11,26 @@ set LIB_DIR=%AKKA_HOME%\lib set CLASSPATH=%AKKA_HOME%\config set CLASSPATH=%CLASSPATH%;%LIB_DIR%\akka-kernel-0.5.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\akka-util-java-0.5.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\antlr-3.1.3.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\aopalliance-1.0.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\asm-3.1.jar +set CLASSPATH=%CLASSPATH%;%LIB_DIR%\aspectwerkz-jdk5-2.1.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\aspectwerkz-nodeps-jdk5-2.1.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\atmosphere-core-0.3.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\atmosphere-portable-runtime-0.3.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\camel-core-2.0-SNAPSHOT.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\atmosphere-compat-0.3.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\cassandra-0.4.0-dev.jar +set CLASSPATH=%CLASSPATH%;%LIB_DIR%\cassandra-0.4.0-trunk.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\cglib-2.2.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\commons-cli-1.1.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\commons-collections-3.2.1.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\commons-io-1.3.2.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\commons-javaflow-1.0-SNAPSHOT.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\commons-lang-2.4.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\commons-logging-1.0.4.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\commons-math-1.1.jar +set CLASSPATH=%CLASSPATH%;%LIB_DIR%\commons-pool-1.5.1.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\configgy-1.3.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\fscontext.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\google-collect-snapshot-20090211.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\grizzly-comet-webserver-1.8.6.3.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\guice-core-2.0-SNAPSHOT.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\guice-jsr250-2.0-SNAPSHOT.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\high-scale-lib.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\jackson-core-asl-1.1.0.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\jackson-mapper-asl-1.1.0.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\jersey-client-1.1.1-ea.jar @@ -43,13 +39,11 @@ set CLASSPATH=%CLASSPATH%;%LIB_DIR%\jersey-json-1.1.1-ea.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\jersey-server-1.1.1-ea.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\jersey-scala-1.1.2-ea-SNAPSHOT.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\JSAP-2.1.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\jsr250-api-1.0.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\jsr311-api-1.0.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\libfb303.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\libthrift.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\log4j-1.2.15.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\lucene-core-2.2.0.jar -set CLASSPATH=%CLASSPATH%;%LIB_DIR%\netty-3.1.0.CR1.jar +set CLASSPATH=%CLASSPATH%;%LIB_DIR%\netty-3.1.0.GA.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\providerutil.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\protobuf-java-2.1.0.jar set CLASSPATH=%CLASSPATH%;%LIB_DIR%\scala-library-2.7.5.jar diff --git a/bin/start-akka-server.sh b/bin/start-akka-server.sh index 04d7c3b538..44961c324d 100755 --- a/bin/start-akka-server.sh +++ b/bin/start-akka-server.sh @@ -5,15 +5,6 @@ VERSION=0.5 BASE_DIR=$(dirname $0)/.. echo 'Starting Akka Kernel from directory' $BASE_DIR -echo 'Resetting persistent storage in' $BASE_DIR/storage -rm -rf $BASE_DIR/storage -mkdir $BASE_DIR/storage -mkdir $BASE_DIR/storage/bootstrap -mkdir $BASE_DIR/storage/callouts -mkdir $BASE_DIR/storage/commitlog -mkdir $BASE_DIR/storage/data -mkdir $BASE_DIR/storage/system - LIB_DIR=$BASE_DIR/lib CLASSPATH=$BASE_DIR/config @@ -22,12 +13,13 @@ CLASSPATH=$CLASSPATH:$LIB_DIR/akka-util-java-0.5.jar CLASSPATH=$CLASSPATH:$LIB_DIR/antlr-3.1.3.jar CLASSPATH=$CLASSPATH:$LIB_DIR/aopalliance-1.0.jar CLASSPATH=$CLASSPATH:$LIB_DIR/asm-3.1.jar +CLASSPATH=$CLASSPATH:$LIB_DIR/aspectwerkz-jdk5-2.1.jar CLASSPATH=$CLASSPATH:$LIB_DIR/aspectwerkz-nodeps-jdk5-2.1.jar CLASSPATH=$CLASSPATH:$LIB_DIR/atmosphere-core-0.3.jar CLASSPATH=$CLASSPATH:$LIB_DIR/atmosphere-portable-runtime-0.3.jar CLASSPATH=$CLASSPATH:$LIB_DIR/camel-core-2.0-SNAPSHOT.jar CLASSPATH=$CLASSPATH:$LIB_DIR/atmosphere-compat-0.3.jar -CLASSPATH=$CLASSPATH:$LIB_DIR/cassandra-0.4.0-dev.jar +CLASSPATH=$CLASSPATH:$LIB_DIR/cassandra-0.4.0-trunk.jar CLASSPATH=$CLASSPATH:$LIB_DIR/cglib-2.2.jar CLASSPATH=$CLASSPATH:$LIB_DIR/commons-cli-1.1.jar CLASSPATH=$CLASSPATH:$LIB_DIR/commons-collections-3.2.1.jar @@ -36,13 +28,12 @@ CLASSPATH=$CLASSPATH:$LIB_DIR/commons-javaflow-1.0-SNAPSHOT.jar CLASSPATH=$CLASSPATH:$LIB_DIR/commons-lang-2.4.jar CLASSPATH=$CLASSPATH:$LIB_DIR/commons-logging-1.0.4.jar CLASSPATH=$CLASSPATH:$LIB_DIR/commons-math-1.1.jar +CLASSPATH=$CLASSPATH:$LIB_DIR/commons-pool-1.5.1.jar CLASSPATH=$CLASSPATH:$LIB_DIR/configgy-1.3.jar CLASSPATH=$CLASSPATH:$LIB_DIR/fscontext.jar CLASSPATH=$CLASSPATH:$LIB_DIR/google-collect-snapshot-20090211.jar CLASSPATH=$CLASSPATH:$LIB_DIR/grizzly-comet-webserver-1.8.6.3.jar CLASSPATH=$CLASSPATH:$LIB_DIR/guice-core-2.0-SNAPSHOT.jar -CLASSPATH=$CLASSPATH:$LIB_DIR/guice-jsr250-2.0-SNAPSHOT.jar -CLASSPATH=$CLASSPATH:$LIB_DIR/high-scale-lib.jar CLASSPATH=$CLASSPATH:$LIB_DIR/jackson-core-asl-1.1.0.jar CLASSPATH=$CLASSPATH:$LIB_DIR/jackson-mapper-asl-1.1.0.jar CLASSPATH=$CLASSPATH:$LIB_DIR/javautils-2.7.4-0.1.jar @@ -52,12 +43,10 @@ CLASSPATH=$CLASSPATH:$LIB_DIR/jersey-json-1.1.1-ea.jar CLASSPATH=$CLASSPATH:$LIB_DIR/jersey-server-1.1.1-ea.jar CLASSPATH=$CLASSPATH:$LIB_DIR/jersey-scala-1.1.2-ea-SNAPSHOT.jar CLASSPATH=$CLASSPATH:$LIB_DIR/JSAP-2.1.jar -CLASSPATH=$CLASSPATH:$LIB_DIR/jsr250-api-1.0.jar CLASSPATH=$CLASSPATH:$LIB_DIR/jsr311-api-1.0.jar CLASSPATH=$CLASSPATH:$LIB_DIR/libfb303.jar CLASSPATH=$CLASSPATH:$LIB_DIR/libthrift.jar CLASSPATH=$CLASSPATH:$LIB_DIR/log4j-1.2.15.jar -CLASSPATH=$CLASSPATH:$LIB_DIR/lucene-core-2.2.0.jar CLASSPATH=$CLASSPATH:$LIB_DIR/netty-3.1.0.GA.jar CLASSPATH=$CLASSPATH:$LIB_DIR/providerutil.jar CLASSPATH=$CLASSPATH:$LIB_DIR/protobuf-java-2.1.0.jar @@ -89,7 +78,5 @@ JVM_OPTS=" \ -Dcom.sun.grizzly.cometSupport=true \ -Dcom.sun.management.jmxremote.authenticate=false" - -#$JAVA_HOME/bin/java $JVM_OPTS -cp $CLASSPATH se.scalablesolutions.akka.Boot se.scalablesolutions.akka.kernel.Kernel ${1} echo $JAVA_HOME/bin/java $JVM_OPTS -cp $CLASSPATH se.scalablesolutions.akka.kernel.Kernel ${1} $JAVA_HOME/bin/java $JVM_OPTS -cp $CLASSPATH se.scalablesolutions.akka.kernel.Kernel ${1} diff --git a/changes.xml b/changes.xml new file mode 100755 index 0000000000..c49d0071b7 --- /dev/null +++ b/changes.xml @@ -0,0 +1,45 @@ + + + + Akka Release Notes + + + + + MongoDB as Akka storage backend + Support for using the Lift Web framework with Actors + Support for using Scala XML tags in RESTful Actors (scala-jersey) + Support for Comet Actors using Atmosphere + Statistics recorder with JMX and REST APIs + Management service with JMX and REST APIs + JSON serialization for Java objects (using Jackson) + JSON serialization for Scala objects (using scala-json) + Protobuf serialization for Java and Scala objects + SBinary serialization for Scala objects + Protobuf as remote protocol + Added CassandraSession API (with socket pooling) wrapping Cassandra's Thrift API in Scala and Java APIs + CassandraStorage is now works with external Cassandra cluster + Removed embedded Cassandra mode + ActorRegistry for retrieving Actor instances + Concurrent mode is now per actor basis + Made Akka Web App aware, does not require AKKA_HOME when using it as a library + Fixed dispatcher bug + Cleaned up Maven scripts and distribution in general + Added mailing list: akka-user@googlegroups.com + Improved and restructured documentation + New URL: http://akkasource.org + + + + \ No newline at end of file diff --git a/config/akka-reference.conf b/config/akka-reference.conf index ff287272be..bec2562066 100644 --- a/config/akka-reference.conf +++ b/config/akka-reference.conf @@ -1,51 +1,45 @@ #################### # Akka Config File # #################### - + # This file has all the default settings, so all these could be remove with no visible effect. # Modify as needed. - + - filename = "./logs/akka.log" - roll = "daily" # Options: never, hourly, daily, sunday/monday/... - level = "debug" # Options: fatal, critical, error, warning, info, debug, trace + filename = "./logs/akka.log" + roll = "daily" # Options: never, hourly, daily, sunday/monday/... + level = "debug" # Options: fatal, critical, error, warning, info, debug, trace console = on # syslog_host = "" # syslog_server_name = "" - + - version = "v0.5" - - #boot = ["sample.scala.Boot"] # FQN to the class doing initial active object/actor - boot = ["sample.java.Boot", "sample.scala.Boot"] # FQN to the class doing initial active object/actor - # supervisor bootstrap, should be defined in default constructor - - service = on - record-stats = on - - + version = "0.6" + + boot = ["sample.java.Boot", "sample.scala.Boot"] # FQN to the class doing initial active object/actor + # supervisor bootstrap, should be defined in default constructor - timeout = 5000 # default timeout for future based invocations - serialize-messages = on # does a deep clone of (non-primitive) messages to ensure immutability + timeout = 5000 # default timeout for future based invocations + serialize-messages = off # does a deep clone of (non-primitive) messages to ensure immutability - + service = on - restart-on-collision = off # (not implemented yet) if 'on' then it reschedules the transaction, - # if 'off' then throws an exception or rollback for user to handle - wait-for-completion = 100 # how long time in millis a transaction should be given time to complete when a collision is detected - wait-nr-of-times = 3 # the number of times it should check for completion of a pending transaction upon collision - distributed = off # not implemented yet + restart-on-collision = off # (not implemented yet) if 'on' then it reschedules the transaction, + # if 'off' then throws an exception or rollback for user to handle + wait-for-completion = 100 # how long time in millis a transaction should be given time to complete when a collision is detected + wait-nr-of-times = 3 # the number of times it should check for completion of a pending transaction upon collision + distributed = off # not implemented yet - + - service = on + service = on hostname = "localhost" port = 9999 - connection-timeout = 1000 # in millis + connection-timeout = 1000 # in millis - + service = on hostname = "localhost" @@ -53,15 +47,22 @@ - system = "cassandra" # Options: cassandra (coming: terracotta, mongodb, redis, tokyo-cabinet, voldemort, memcached) - + system = "cassandra" # Options: cassandra, mongodb + service = on - hostname = "127.0.0.1" # ip address or hostname of one of the Cassandra cluster's seeds + hostname = "127.0.0.1" # IP address or hostname of one of the Cassandra cluster's seeds port = 9160 - storage-format = "java" # Options: java, scala-json, java-json, protobuf - consistency-level = 1 # + storage-format = "java" # Options: java, scala-json, java-json, protobuf + consistency-level = 1 - - + + service = on + hostname = "127.0.0.1" # IP address or hostname of the MongoDB DB instance + port = 27017 + dbname = "mydb" + storage-format = "scala-json" # Options: java, scala-json, java-json, protobuf + + + \ No newline at end of file diff --git a/config/log4j.properties b/config/log4j.properties index 7e38b9c134..903ccd16af 100755 --- a/config/log4j.properties +++ b/config/log4j.properties @@ -15,6 +15,6 @@ log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n # Edit the next line to point to your logs directory -log4j.appender.R.File=./logs/cassandra.log +log4j.appender.R.File=./logs/akka.log log4j.logger.org.atmosphere=DEBUG diff --git a/embedded-repo/org/codehaus/aspectwerkz/aspectwerkz-jdk5/2.1/aspectwerkz-jdk5-2.1.jar b/embedded-repo/org/codehaus/aspectwerkz/aspectwerkz-jdk5/2.1/aspectwerkz-jdk5-2.1.jar new file mode 100755 index 0000000000..c258335f67 Binary files /dev/null and b/embedded-repo/org/codehaus/aspectwerkz/aspectwerkz-jdk5/2.1/aspectwerkz-jdk5-2.1.jar differ diff --git a/embedded-repo/org/codehaus/aspectwerkz/aspectwerkz-jdk5/2.1/aspectwerkz-jdk5-2.1.pom b/embedded-repo/org/codehaus/aspectwerkz/aspectwerkz-jdk5/2.1/aspectwerkz-jdk5-2.1.pom new file mode 100755 index 0000000000..5324772a47 --- /dev/null +++ b/embedded-repo/org/codehaus/aspectwerkz/aspectwerkz-jdk5/2.1/aspectwerkz-jdk5-2.1.pom @@ -0,0 +1,8 @@ + + + 4.0.0 + org.codehaus.aspectwerkz + aspectwerkz-jdk5 + 2.1 + jar + \ No newline at end of file diff --git a/kernel/pom.xml b/kernel/pom.xml index 43324bf14c..96a85bb27d 100644 --- a/kernel/pom.xml +++ b/kernel/pom.xml @@ -32,6 +32,11 @@ aspectwerkz-nodeps-jdk5 2.1 + + org.codehaus.aspectwerkz + aspectwerkz-jdk5 + 2.1 + com.twitter scala-stats @@ -235,6 +240,41 @@ + + org.dstovall + onejar-maven-plugin + 1.4.1 + + + + se.scalablesolutions.akka.kernel.Kernel + 0.96 + true + onejar + + + one-jar + + + + + + + false + ../config + + akka.conf + akka-reference.conf + + + + false + src/main/resources + + META-INF/* + + + diff --git a/kernel/src/main/resources/META-INF/aop.xml b/kernel/src/main/resources/META-INF/aop.xml new file mode 100755 index 0000000000..23bb4575ff --- /dev/null +++ b/kernel/src/main/resources/META-INF/aop.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/kernel/src/main/resources/aop.xml b/kernel/src/main/resources/aop.xml deleted file mode 100644 index fe844fa481..0000000000 --- a/kernel/src/main/resources/aop.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - diff --git a/kernel/src/main/scala/Kernel.scala b/kernel/src/main/scala/Kernel.scala index 9ea0a46fb2..c32127b0c8 100644 --- a/kernel/src/main/scala/Kernel.scala +++ b/kernel/src/main/scala/Kernel.scala @@ -24,7 +24,7 @@ import kernel.management.Management * @author Jonas Bonér */ object Kernel extends Logging { - val version = "0.6" + val VERSION = "0.6" val HOME = { val home = System.getenv("AKKA_HOME") if (home == null) None @@ -33,6 +33,9 @@ object Kernel extends Logging { val config = setupConfig + val CONFIG_VERSION = config.getString("akka.version", "0") + if (VERSION != CONFIG_VERSION) throw new IllegalStateException("Akka JAR version [" + VERSION + "] is different than the provided config ('akka.conf') version [" + CONFIG_VERSION + "]") + val BOOT_CLASSES = config.getList("akka.boot") val RUN_REMOTE_SERVICE = config.getBool("akka.remote.service", true) val RUN_MANAGEMENT_SERVICE = config.getBool("akka.management.service", true) @@ -73,8 +76,7 @@ object Kernel extends Logging { if (RUN_REST_SERVICE) startJersey - runApplicationBootClasses - + Thread.currentThread.setContextClassLoader(getClass.getClassLoader) log.info("Akka started successfully") hasBooted = true } @@ -83,21 +85,22 @@ object Kernel extends Logging { def uptime = (System.currentTimeMillis - startTime) / 1000 def setupConfig: Config = { - try { - Configgy.configureFromResource("akka.conf", getClass.getClassLoader) - log.info("Config loaded from the application classpath.") - } catch { - case e: ParseException => + if (HOME.isDefined) { try { - if (HOME.isDefined) { - val configFile = HOME.get + "/config/akka.conf" - log.info("AKKA_HOME is defined to [%s], loading config from [%s].", HOME.get, configFile) - Configgy.configure(configFile) - } else throw new IllegalStateException("AKKA_HOME is not defined and no 'akka.conf' can be found on the classpath, aborting") + val configFile = HOME.get + "/config/akka.conf" + Configgy.configure(configFile) + log.info("AKKA_HOME is defined to [%s], config loaded from [%s].", HOME.get, configFile) } catch { - case e: ParseException => throw new IllegalStateException("AKKA_HOME is not defined and no 'akka.conf' can be found on the classpath, aborting") + case e: ParseException => throw new IllegalStateException("'akka.conf' config file can not be found in [" + HOME + "/config/akka.conf] - aborting. Either add it in the 'config' directory or add it to the classpath.") } - } + } else { + try { + Configgy.configureFromResource("akka.conf", getClass.getClassLoader) + log.info("Config loaded from the application classpath.") + } catch { + case e: ParseException => throw new IllegalStateException("'$AKKA_HOME/config/akka.conf' could not be found and no 'akka.conf' can be found on the classpath - aborting. . Either add it in the '$AKKA_HOME/config' directory or add it to the classpath.") + } + } val config = Configgy.config config.registerWithJmx("com.scalablesolutions.akka") // FIXME fix Configgy JMX subscription to allow management @@ -108,19 +111,20 @@ object Kernel extends Logging { private[akka] def runApplicationBootClasses = { new management.RestfulJMXBoot // add the REST/JMX service val loader = - if (getClass.getClassLoader.getResourceAsStream("akka.conf") != null) getClass.getClassLoader - else if (HOME.isDefined) { + if (HOME.isDefined) { val CONFIG = HOME.get + "/config" val DEPLOY = HOME.get + "/deploy" val DEPLOY_DIR = new File(DEPLOY) if (!DEPLOY_DIR.exists) { log.error("Could not find a deploy directory at [" + DEPLOY + "]"); System.exit(-1) } val toDeploy = for (f <- DEPLOY_DIR.listFiles().toArray.toList.asInstanceOf[List[File]]) yield f.toURL + //val toDeploy = DEPLOY_DIR.toURL :: (for (f <- DEPLOY_DIR.listFiles().toArray.toList.asInstanceOf[List[File]]) yield f.toURL) log.info("Deploying applications from [%s]: [%s]", DEPLOY, toDeploy.toArray.toList) new URLClassLoader(toDeploy.toArray, getClass.getClassLoader) + } else if (getClass.getClassLoader.getResourceAsStream("akka.conf") != null) { + getClass.getClassLoader } else throw new IllegalStateException("AKKA_HOME is not defined and no 'akka.conf' can be found on the classpath, aborting") for (clazz <- BOOT_CLASSES) { log.info("Loading boot class [%s]", clazz) - log.info("--------------- LOADER [%s]", loader) loader.loadClass(clazz).newInstance } applicationLoader = Some(loader) @@ -182,7 +186,7 @@ object Kernel extends Logging { (____ /__|_ \__|_ \(____ / \/ \/ \/ \/ """) - log.info(" Running version " + config.getString("akka.version", "Awesome")) + log.info(" Running version " + VERSION) log.info("==============================") } diff --git a/kernel/src/main/scala/actor/ActiveObject.scala b/kernel/src/main/scala/actor/ActiveObject.scala index 3dac74252c..5baa045d7f 100644 --- a/kernel/src/main/scala/actor/ActiveObject.scala +++ b/kernel/src/main/scala/actor/ActiveObject.scala @@ -14,9 +14,11 @@ import kernel.config.ScalaConfig._ import kernel.util._ import serialization.Serializer -import org.codehaus.aspectwerkz.intercept.{Advisable, AroundAdvice} +import org.codehaus.aspectwerkz.intercept.{Advisable, AroundAdvice, Advice} import org.codehaus.aspectwerkz.joinpoint.{MethodRtti, JoinPoint} import org.codehaus.aspectwerkz.proxy.Proxy +import org.codehaus.aspectwerkz.annotation.{Aspect, Around} +import org.codehaus.aspectwerkz.aspect.management.Aspects sealed class ActiveObjectException(msg: String) extends RuntimeException(msg) class ActiveObjectInvocationTimeoutException(msg: String) extends ActiveObjectException(msg) @@ -221,9 +223,9 @@ object ActiveObject { if (remoteAddress.isDefined) actor.makeRemote(remoteAddress.get) val proxy = Proxy.newInstance(target, false, true) actor.initialize(target, proxy) - // FIXME switch to weaving in the aspect at compile time - proxy.asInstanceOf[Advisable].aw_addAdvice( - MATCH_ALL, new ActorAroundAdvice(target, proxy, actor, remoteAddress, timeout)) + actor.timeout = timeout + actor.start + AspectInitRegistry.register(proxy, AspectInit(target, actor, remoteAddress, timeout)) proxy.asInstanceOf[T] } @@ -231,11 +233,13 @@ object ActiveObject { if (remoteAddress.isDefined) actor.makeRemote(remoteAddress.get) val proxy = Proxy.newInstance(Array(intf), Array(target), false, true) actor.initialize(target.getClass, target) - proxy.asInstanceOf[Advisable].aw_addAdvice( - MATCH_ALL, new ActorAroundAdvice(intf, target, actor, remoteAddress, timeout)) + actor.timeout = timeout + actor.start + AspectInitRegistry.register(proxy, AspectInit(intf, actor, remoteAddress, timeout)) proxy.asInstanceOf[T] } + private[kernel] def supervise(restartStrategy: RestartStrategy, components: List[Supervise]): Supervisor = { object factory extends SupervisorFactory { override def getSupervisorConfig = SupervisorConfig(restartStrategy, components) @@ -246,20 +250,46 @@ object ActiveObject { } } +object AspectInitRegistry { + private val inits = new java.util.concurrent.ConcurrentHashMap[AnyRef, AspectInit] + def initFor(target: AnyRef) = { + val init = inits.get(target) + inits.remove(target) + init + } + def register(target: AnyRef, init: AspectInit) = inits.put(target, init) +} + +sealed case class AspectInit( + val target: Class[_], + val actor: Dispatcher, + val remoteAddress: Option[InetSocketAddress], + val timeout: Long) + /** * @author Jonas Bonér */ @serializable -sealed class ActorAroundAdvice(val target: Class[_], - val targetInstance: AnyRef, - val actor: Dispatcher, - val remoteAddress: Option[InetSocketAddress], - val timeout: Long) extends AroundAdvice { - val id = target.getName - actor.timeout = timeout - actor.start - - def invoke(joinpoint: JoinPoint): AnyRef = dispatch(joinpoint) +@Aspect("perInstance") +sealed class ActiveObjectAspect { + @volatile var isInitialized = false + var target: Class[_] = _ + var actor: Dispatcher = _ + var remoteAddress: Option[InetSocketAddress] = _ + var timeout: Long = _ + + @Around("execution(* *..*(..))") + def invoke(joinpoint: JoinPoint): AnyRef = { + if (!isInitialized) { + val init = AspectInitRegistry.initFor(joinpoint.getThis) + target = init.target + actor = init.actor + remoteAddress = init.remoteAddress + timeout = init.timeout + isInitialized = true + } + dispatch(joinpoint) + } private def dispatch(joinpoint: JoinPoint) = { if (remoteAddress.isDefined) remoteDispatch(joinpoint) diff --git a/kernel/src/main/scala/actor/Actor.scala b/kernel/src/main/scala/actor/Actor.scala index fab6adf40d..5e21048fd4 100644 --- a/kernel/src/main/scala/actor/Actor.scala +++ b/kernel/src/main/scala/actor/Actor.scala @@ -54,7 +54,8 @@ object Actor { */ trait Actor extends Logging with TransactionManagement { Stats.getCounter("NrOfActors").incr - + ActorRegistry.register(this) + @volatile private[this] var isRunning: Boolean = false private[this] val remoteFlagLock = new ReadWriteLock private[this] val transactionalFlagLock = new ReadWriteLock diff --git a/kernel/src/main/scala/actor/ActorRegistry.scala b/kernel/src/main/scala/actor/ActorRegistry.scala new file mode 100755 index 0000000000..3f4275cf9e --- /dev/null +++ b/kernel/src/main/scala/actor/ActorRegistry.scala @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2009 Scalable Solutions. + */ + +package se.scalablesolutions.akka.kernel.actor + +import kernel.util.Logging + +import scala.collection.jcl.HashMap + +/** + * Registry holding all actor instances, mapped by class.. + * + * @author Jonas Bonér + */ +object ActorRegistry extends Logging { + private val actors = new HashMap[String, List[Actor]] + + def actorsFor(clazz: Class[_]): List[Actor] = synchronized { + actors.get(clazz.getName) match { + case None => Nil + case Some(instances) => instances + } + } + + def register(actor: Actor) = synchronized { + val name = actor.getClass.getName + actors.get(name) match { + case Some(instances) => actors + (name -> (actor :: instances)) + case None => actors + (name -> (actor :: Nil)) + } + } +} diff --git a/kernel/src/main/scala/management/JMX.scala b/kernel/src/main/scala/management/JMX.scala index e7dce53573..bdeea75324 100755 --- a/kernel/src/main/scala/management/JMX.scala +++ b/kernel/src/main/scala/management/JMX.scala @@ -47,7 +47,7 @@ object Management extends Logging { def getStats(reset: Boolean) = { var statistics = new ArrayBuffer[Tuple2[String, String]] statistics += (("current time", (System.currentTimeMillis / 1000).toString)) - statistics += (("akka version", Kernel.version)) + statistics += (("akka version", Kernel.VERSION)) statistics += (("uptime", Kernel.uptime.toString)) for ((key, value) <- Stats.getJvmStats) statistics += (key, value.toString) for ((key, value) <- Stats.getCounterStats) statistics += (key, value.toString) diff --git a/kernel/src/main/scala/management/ScalaJMX.scala b/kernel/src/main/scala/management/ScalaJMX.scala new file mode 100755 index 0000000000..b4a7800f88 --- /dev/null +++ b/kernel/src/main/scala/management/ScalaJMX.scala @@ -0,0 +1,171 @@ +/** + * Copyright (C) 2009 Scalable Solutions. + */ + +package se.scalablesolutions.akka.kernel.management + +import javax.management._ +import java.lang.management._ + +/* +object ScalaJMX { + + val mbeanServer = ManagementFactory.getPlatformMBeanServer + + def register(t: AnyRef, i: Class, name: ObjectName) = mbeanServer.registerMBean(new StandardMBean(t, i), name) + def registerBean(bean: DynamicMBean, name: ObjectName): ObjectInstance = mbeanServer.registerMBean(bean, name) + def register(t: AnyRef, name: String): ObjectInstance = register(t, beanClass(t), name) + + def info(name: ObjectName): SBean = mbeanServer.getMBeanInfo(name) + def bean(name: ObjectName): SBeanInfo = convBeanInfo(name, mbeanServer.getMBeanInfo(name)) + def invoke(name: ObjectName, operationName: String, params: Array[Object], signature: Array[String]): Object = + mbeanServer.invoke(name, operationName, params, signature) + def call(name: ObjectName, operationName: String): Object = invoke(name, operationName, Array[Object](), Array[String]()) + + def get(name: ObjectName, attribute: String) = mbeanServer.getAttribute(name, attribute) + def set(name: ObjectName, attribute: String, value: Object) = mbeanServer.setAttribute(name, new Attribute(attribute, value)) + + implicit def instanceToName(oi: ObjectInstance) = oi.getObjectName() + implicit def stringToName(name: String) = ObjectName.getInstance(name) + implicit def convBean(bi: MBeanInfo):SBean = SBean(bi.getClassName(), bi.getDescription(), bi.getAttributes(), bi.getNotifications(), bi.getOperations(), bi.getConstructors()) + implicit def seqToArr(seq: Seq[AnyRef]): Array[Object] = seq.toArray + + def convBeanInfo(name: ObjectName, bi: MBeanInfo):SBeanInfo = new SBeanInfo(name, bi.getClassName(), bi.getDescription(), bi.getAttributes(), bi.getNotifications(), bi.getOperations(), bi.getConstructors()) + + implicit def convAttrs(attrs: Array[MBeanAttributeInfo]): Seq[SAttr] = + for (val a <- attrs) yield a + implicit def convParams(params: Array[MBeanParameterInfo]): Seq[SParameter] = + for (val p <- params) yield p + implicit def convNotes(notes: Array[MBeanNotificationInfo]): Seq[SNotification] = + for (val p <- notes) yield p + implicit def convCons(cons: Array[MBeanConstructorInfo]): Seq[SConstructor] = + for (val p <- cons) yield p + implicit def convOps(cons: Array[MBeanOperationInfo]): Seq[SOperation] = + for (val p <- cons) yield p + + implicit def convAttr(attr: MBeanAttributeInfo) = SAttr(attr.getName(), attr.getDescription(), attr.getType(), attr.isIs(), attr.isReadable(), attr.isWritable()) + implicit def convNote(note: MBeanNotificationInfo) = SNotification(note.getName(), note.getDescription(), note.getNotifTypes()) + implicit def convOp(op: MBeanOperationInfo):SOperation = SOperation(op.getName(), op.getDescription(), op.getImpact(), op.getReturnType(), op.getSignature()) + implicit def convCon(con: MBeanConstructorInfo):SConstructor = SConstructor(con getName, con getDescription, con getSignature) + implicit def convParam(p: MBeanParameterInfo) = SParameter(p getName, p getDescription, p getType) + + private def beanClass(t: AnyRef) = Class.forName(t.getClass().getName() + "MBean") +} + +class MBean(mbeanInterface: String) extends StandardMBean(Class.forName(mbeanInterface)) + +abstract class SFeature(val name: String, val description: String) + +case class SBean(className: String, description: String, + attrs: Seq[SAttr], notes: Seq[SNotification], + ops: Seq[SOperation], cons: Seq[SConstructor]) { + def writable = attrs.toList.filter(sa => sa.writable) +} + +class SBeanInfo(name: ObjectName, className: String, description: String, + attrs: Seq[SAttr], notes: Seq[SNotification], + ops: Seq[SOperation], cons: Seq[SConstructor]) +extends SBean(className, description, attrs, notes, ops, cons) { + + def get(attribute: String) = SJMX.get(name, attribute) + def set(attribute: String, value: Object) = SJMX.set(name, attribute, value) + def call(opName: String) = SJMX.call(name, opName) +} + +case class SAttr( + override val name: String, + override val description: String, + jmxType: String, isIs: boolean, readable: boolean, writable: boolean +) extends SFeature(name, description) + +case class SNotification( + override val name: String, + override val description: String, + notifTypes: Array[String]) extends SFeature(name, description) + +case class SOperation( + override val name: String, + override val description: String, + impact: int, + returnType: String, + signature: Seq[SParameter]) extends SFeature(name, description) + +case class SParameter( + override val name: String, + override val description: String, + jmxType: String) extends SFeature(name, description) + +case class SConstructor( + override val name: String, + override val description: String, + signature: Seq[SParameter]) extends SFeature(name, description) + +*/ + +/* +package com.soletta.spipe; + +import javax.management.{StandardMBean,ObjectName,MBeanInfo}; + +class SPipe extends MBean("com.soletta.spipe.SPipeMBean") with SPipeMBean { + + import Console.println; + import SJMX._; + + private var desc: String = "Yipe!"; + + def go = { + val oname: ObjectName = "default:name=SPipe"; + val instance = SJMX.registerBean(this, oname); + + set(oname, "Factor", "Hello!"); + println(get(oname, "Factor")); + + val SBean(n, d, Seq(_, a2, a3, _*), _, ops, _) = info(oname); + println("Bean name is " + n + ", description is " + d); + println("Second attribute is " + a2); + println("Third attribute is " + a3); + println("Writable attributes are " + info(oname).writable); + println("Ops: " + ops); + + val x = + + {ops.toList.map(o => )} + ; + + println(x); + + val inf = bean(oname); + inf.call("start"); + println(inf.get("Factor")); + + } + + def getName = "SPipe!"; + def setDescription(d: String) = desc = d; + override def getDescription() = desc; + def getFactor = desc; + def setFactor(s: String) = desc = s; + def isHappy = true; + + override def getDescription(info: MBeanInfo) = desc; + +} + +object PipeMain { + def main(args: Array[String]): unit = { + (new SPipe) go; + } +} + +trait SPipeMBean { + def getName: String; + def getDescription: String = getName; + def setDescription(d: String): unit; + def getFactor: String; + def setFactor(s: String): unit; + def isHappy: boolean; + + def start() = { Console.println("Starting"); } + def stop() = { } +*/ diff --git a/lib/antlr-3.1.3.jar b/lib/antlr-3.1.3.jar deleted file mode 100644 index d3bd9cf942..0000000000 Binary files a/lib/antlr-3.1.3.jar and /dev/null differ diff --git a/lib/aspectwerkz-jdk5-2.1.jar b/lib/aspectwerkz-jdk5-2.1.jar new file mode 100755 index 0000000000..c258335f67 Binary files /dev/null and b/lib/aspectwerkz-jdk5-2.1.jar differ diff --git a/lib/aspectwerkz2.dtd b/lib/aspectwerkz2.dtd new file mode 100755 index 0000000000..5ed29fe769 --- /dev/null +++ b/lib/aspectwerkz2.dtd @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/cassandra-0.4.0-dev.jar b/lib/cassandra-0.4.0-trunk.jar old mode 100644 new mode 100755 similarity index 92% rename from lib/cassandra-0.4.0-dev.jar rename to lib/cassandra-0.4.0-trunk.jar index 706336669f..44796086be Binary files a/lib/cassandra-0.4.0-dev.jar and b/lib/cassandra-0.4.0-trunk.jar differ diff --git a/lib/commons-collections-3.2.1.jar b/lib/commons-collections-3.2.1.jar deleted file mode 100644 index c35fa1fee1..0000000000 Binary files a/lib/commons-collections-3.2.1.jar and /dev/null differ diff --git a/lib/commons-javaflow-1.0-SNAPSHOT.jar b/lib/commons-javaflow-1.0-SNAPSHOT.jar deleted file mode 100644 index 199b853307..0000000000 Binary files a/lib/commons-javaflow-1.0-SNAPSHOT.jar and /dev/null differ diff --git a/lib/commons-lang-2.4.jar b/lib/commons-lang-2.4.jar deleted file mode 100644 index 532939ecab..0000000000 Binary files a/lib/commons-lang-2.4.jar and /dev/null differ diff --git a/lib/commons-pool-1.5.1.jar b/lib/commons-pool-1.5.1.jar new file mode 100755 index 0000000000..c3ff84cfb8 Binary files /dev/null and b/lib/commons-pool-1.5.1.jar differ diff --git a/lib/lucene-core-2.2.0.jar b/lib/lucene-core-2.2.0.jar deleted file mode 100644 index 2469481c38..0000000000 Binary files a/lib/lucene-core-2.2.0.jar and /dev/null differ diff --git a/lib/stringtemplate-3.0.jar b/lib/stringtemplate-3.0.jar deleted file mode 100644 index df5e6e517f..0000000000 Binary files a/lib/stringtemplate-3.0.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index eee1a6a2dd..98f19bd07b 100644 --- a/pom.xml +++ b/pom.xml @@ -160,13 +160,6 @@ src/main/scala src/test/scala - - - org.apache.maven.wagon - wagon-webdav - 1.0-beta-2 - - org.mortbay.jetty @@ -176,40 +169,6 @@ 5 - - org.apache.maven.plugins - maven-antrun-plugin - - - - - - - - org.apache.maven.plugins maven-compiler-plugin @@ -272,35 +231,40 @@ - + + org.apache.maven.plugins + maven-antrun-plugin + + + + + + + - - - false - config - - akka.conf - akka-reference.conf - - - @@ -336,6 +300,20 @@ + + org.codehaus.mojo + taglist-maven-plugin + 2.3 + + + FIXME + TODO + XXX + @todo + @deprecated + + + maven-project-info-reports-plugin @@ -366,7 +344,7 @@ - ${basedir}/src/changes/changes.xml + ${basedir}/changes.xml