Skip to content

Commit

Permalink
fixed bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
jboner committed Jul 3, 2009
1 parent afe3282 commit c1b6740
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 51 deletions.
48 changes: 18 additions & 30 deletions akka.iws
Expand Up @@ -6,23 +6,11 @@
</component>
<component name="ChangeListManager">
<list default="true" id="212ccd86-01aa-4780-a2f0-0d130be5abd2" name="Test" comment="">
<change type="DELETED" beforePath="$PROJECT_DIR$/lib/voldemort-contrib-0.4a.jar" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/lib/mina-integration-scala-2.0.0-M2-SNAPSHOT.jar" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/main/scala/Boot.scala" afterPath="$PROJECT_DIR$/kernel/src/main/scala/Boot.scala" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala" afterPath="$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala" />
<change type="DELETED" beforePath="$PROJECT_DIR$/lib/voldemort-0.4a.jar" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/fun-test-java/src/test/java/se/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java" afterPath="$PROJECT_DIR$/fun-test-java/src/test/java/se/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/test/scala/ThreadBasedDispatcherTest.scala" afterPath="$PROJECT_DIR$/kernel/src/test/scala/ThreadBasedDispatcherTest.scala" />
<change type="DELETED" beforePath="$PROJECT_DIR$/lib/scala-library-2.7.3.jar" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/akka.iws" afterPath="$PROJECT_DIR$/akka.iws" />
<change type="DELETED" beforePath="$PROJECT_DIR$/fun-test-java/src/test/java/se/scalablesolutions/akka/api/NioTest.java" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/bin/start-akka-server.sh" afterPath="$PROJECT_DIR$/bin/start-akka-server.sh" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/fun-test-java/src/test/java/se/scalablesolutions/akka/api/RestTest.java" afterPath="$PROJECT_DIR$/fun-test-java/src/test/java/se/scalablesolutions/akka/api/RestTest.java" />
<change type="DELETED" beforePath="$PROJECT_DIR$/lib/mina-core-2.0.0-M2-SNAPSHOT.jar" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/main/scala/Boot.scala" afterPath="$PROJECT_DIR$/kernel/src/main/scala/Boot.scala" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/main/scala/actor/ActiveObject.scala" afterPath="$PROJECT_DIR$/kernel/src/main/scala/actor/ActiveObject.scala" />
<change type="DELETED" beforePath="$PROJECT_DIR$/kernel/src/main/scala/reactor/ThreadPoolBuilder.scala" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/main/scala/reactor/EventBasedThreadPoolDispatcher.scala" afterPath="$PROJECT_DIR$/kernel/src/main/scala/reactor/EventBasedThreadPoolDispatcher.scala" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/main/scala/actor/Actor.scala" afterPath="$PROJECT_DIR$/kernel/src/main/scala/actor/Actor.scala" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/test/scala/JerseySpec.scala" afterPath="$PROJECT_DIR$/kernel/src/test/scala/JerseySpec.scala" />
</list>
<list readonly="true" id="6e842704-fac6-40e9-8a67-d02385f87db9" name="Default" comment="&#10;# Brief commit desciption here&#10;&#10;# Full commit description here (comment lines starting with '#' will not be included)&#10;&#10;" />
<ignored path="akka.iws" />
Expand Down Expand Up @@ -171,7 +159,7 @@
<file leaf-file-name="Kernel.scala" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala">
<provider selected="true" editor-type-id="text-editor">
<state line="69" column="31" selection-start="1854" selection-end="1854" vertical-scroll-proportion="0.0">
<state line="51" column="46" selection-start="1482" selection-end="1482" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
Expand All @@ -180,16 +168,16 @@
<file leaf-file-name="Boot.scala" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Boot.scala">
<provider selected="true" editor-type-id="text-editor">
<state line="19" column="86" selection-start="680" selection-end="680" vertical-scroll-proportion="0.0">
<state line="10" column="190" selection-start="203" selection-end="203" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="CassandraNode.scala" pinned="false" current="true" current-in-tab="true">
<file leaf-file-name="CassandraNode.scala" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/state/CassandraNode.scala">
<provider selected="true" editor-type-id="text-editor">
<state line="20" column="13" selection-start="536" selection-end="536" vertical-scroll-proportion="0.015429122">
<state line="20" column="13" selection-start="536" selection-end="536" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
Expand All @@ -204,10 +192,10 @@
</provider>
</entry>
</file>
<file leaf-file-name="pom.xml" pinned="false" current="false" current-in-tab="false">
<file leaf-file-name="pom.xml" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/kernel/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="2" column="158" selection-start="219" selection-end="219" vertical-scroll-proportion="0.0">
<state line="2" column="158" selection-start="219" selection-end="219" vertical-scroll-proportion="0.030858245">
<folding />
</state>
</provider>
Expand Down Expand Up @@ -249,8 +237,8 @@
<option value="$PROJECT_DIR$/kernel/src/test/scala/JerseySpec.scala" />
<option value="$PROJECT_DIR$/kernel/src/main/scala/reactor/EventBasedThreadPoolDispatcher.scala" />
<option value="$PROJECT_DIR$/fun-test-java/src/test/java/se/scalablesolutions/akka/api/RestTest.java" />
<option value="$PROJECT_DIR$/kernel/src/main/scala/Boot.scala" />
<option value="$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala" />
<option value="$PROJECT_DIR$/kernel/src/main/scala/Boot.scala" />
</list>
</option>
</component>
Expand Down Expand Up @@ -1716,37 +1704,37 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala">
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/state/CassandraNode.scala">
<provider selected="true" editor-type-id="text-editor">
<state line="69" column="31" selection-start="1854" selection-end="1854" vertical-scroll-proportion="0.0">
<state line="20" column="13" selection-start="536" selection-end="536" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/reactor/EventBasedThreadPoolDispatcher.scala">
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala">
<provider selected="true" editor-type-id="text-editor">
<state line="269" column="0" selection-start="9554" selection-end="9554" vertical-scroll-proportion="0.0">
<state line="51" column="46" selection-start="1482" selection-end="1482" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/kernel/pom.xml">
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/reactor/EventBasedThreadPoolDispatcher.scala">
<provider selected="true" editor-type-id="text-editor">
<state line="2" column="158" selection-start="219" selection-end="219" vertical-scroll-proportion="0.0">
<state line="269" column="0" selection-start="9554" selection-end="9554" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Boot.scala">
<provider selected="true" editor-type-id="text-editor">
<state line="19" column="86" selection-start="680" selection-end="680" vertical-scroll-proportion="0.0">
<state line="10" column="190" selection-start="203" selection-end="203" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/state/CassandraNode.scala">
<entry file="file://$PROJECT_DIR$/kernel/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="20" column="13" selection-start="536" selection-end="536" vertical-scroll-proportion="0.015429122">
<state line="2" column="158" selection-start="219" selection-end="219" vertical-scroll-proportion="0.030858245">
<folding />
</state>
</provider>
Expand Down
38 changes: 27 additions & 11 deletions bin/start-akka-server.sh
@@ -1,27 +1,40 @@
#!/bin/bash

if [ $# -gt 1 ];
then
echo 'USAGE: bin/start-akka-server.sh [akka_home]'
exit 1
fi
VERSION=0.1

#if [ $# -gt 1 ];
#then
# echo 'USAGE: bin/start-akka-server.sh'
# exit 1
#fi

JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

BASE_DIR=$(dirname $0)/..

echo 'Starting Akka Kernel from directory' $BASE_DIR

for FILE in $BASE_DIR/lib/*.jar;
do
CLASSPATH=$CLASSPATH:$FILE
done
CLASSPATH=$CLASSPATH:$BASE_DIR/config
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

CLASSPATH=$CLASSPATH:$BASE_DIR/kernel/target/classes
#CLASSPATH=$CLASSPATH:$BASE_DIR/dist/akka-kernel-$VERSION.jar
CLASSPATH=$CLASSPATH:$BASE_DIR/lib/scala-library-2.7.5.jar
CLASSPATH=$CLASSPATH:$BASE_DIR/lib/configgy-1.3.jar
CLASSPATH=$CLASSPATH:$BASE_DIR/config

STORAGE_OPTS=" \
-Dcassandra \
-Dstorage-config=$BASE_DIR/config/ \
-Dpidfile=akka.pid"

# To have Akka dump the generated classes, add the '-Daspectwerkz.transform.dump=*' option and it will dump classes to $BASE_DIR/_dump
JVM_OPTS=" \
-server \
-Xdebug \
Expand All @@ -40,4 +53,7 @@ JVM_OPTS=" \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false"

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java $JVM_OPTS $STORAGE_OPTS -cp $CLASSPATH se.scalablesolutions.akka.Boot se.scalablesolutions.akka.kernel.Kernel ${1}
echo "Starting up with options:
"$JAVA_HOME/bin/java $JVM_OPTS $STORAGE_OPTS -cp $CLASSPATH se.scalablesolutions.akka.Boot se.scalablesolutions.akka.kernel.Kernel ${1}

$JAVA_HOME/bin/java $JVM_OPTS $STORAGE_OPTS -cp $CLASSPATH se.scalablesolutions.akka.Boot se.scalablesolutions.akka.kernel.Kernel ${1}
28 changes: 18 additions & 10 deletions kernel/src/main/scala/Boot.scala
Expand Up @@ -16,25 +16,33 @@ import kernel.util.Logging
*/
object Boot extends Logging {

val HOME = try { System.getenv("AKKA_HOME") } catch { case e: NullPointerException => throw new IllegalStateException("AKKA_HOME system variable needs to be set") }
val CLASSES = HOME + "/kernel/target/classes" // FIXME fix classes dir for dist wrap
val HOME = try { System.getenv("AKKA_HOME") } catch { case e: NullPointerException => throw new IllegalStateException("AKKA_HOME system variable needs to be set. Should point to the root of the Akka distribution.") }
val CLASSES = HOME + "/kernel/target/classes" // FIXME remove for dist
val LIB = HOME + "/lib"
val CONFIG = HOME + "/config"
val DEPLOY = HOME + "/deploy"

/**
* Assumes that the AKKA_HOME directory is set with /config, /classes and /lib beneath it holding files and jars.
* Assumes that the AKKA_HOME directory is set with /bin, /config, /deploy and /lib beneath it holding config files and jars.
* Thus:
* $AKKA_HOME
* $AKKA_HOME/bin
* $AKKA_HOME/classes
* $AKKA_HOME/lib
* $AKKA_HOME/config
* $AKKA_HOME/lib
* $AKKA_HOME/deploy
*/
def main(args: Array[String]): Unit = {
log.info("Bootstrapping Akka server from AKKA_HOME=%s", HOME)

val libs = for (f <- new File(LIB).listFiles().toArray.toList.asInstanceOf[List[File]]) yield f.toURL
val urls = new File(CLASSES).toURL :: libs
log.info("Bootstrapping Akka server from [AKKA_HOME=%s]", HOME)

val LIB_DIR = new File(LIB)
val DEPLOY_DIR = new File(DEPLOY)
if (!LIB_DIR.exists) { log.error("Could not find a lib directory with all the akka dependencies at [" + DEPLOY + "]"); System.exit(-1) }
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
if (toDeploy.isEmpty) log.warning("No jars could be found in the [" + DEPLOY + "] directory, nothing to deploy")
val libs = for (f <- LIB_DIR.listFiles().toArray.toList.asInstanceOf[List[File]]) yield f.toURL
val urls = new File(CLASSES).toURL :: (libs ::: toDeploy)

val loader = new URLClassLoader(urls.toArray, ClassLoader.getSystemClassLoader.getParent)
val mainClass = loader.loadClass(args(0))
val mainMethod = mainClass.getMethod("main", Array(args.getClass): _*)
Expand Down
1 change: 1 addition & 0 deletions kernel/src/main/scala/Kernel.scala
Expand Up @@ -49,6 +49,7 @@ object Kernel extends Logging {
//startJersey
//startZooKeeper
//startVoldemort
log.info("Akka kernel started successfully")
}


Expand Down
Binary file removed lib/configgy-1.2.jar
Binary file not shown.
Binary file added lib/configgy-1.3.jar
Binary file not shown.
Binary file not shown.

0 comments on commit c1b6740

Please sign in to comment.