Revision c8b4467d

b/make-dist.sh
144 144
  echo
145 145
  echo Copying config files from $CONF_SRC
146 146
  echo
147
  cp $CONF_SRC/logback.xml $DIST/conf|| fail "copying logback.xml"
148
  cp $CONF_SRC/policy.yaml $DIST/conf || fail "copying policy.yaml"
147
  cp $CONF_SRC/policy.yaml $DIST/conf          || fail "copying policy.yaml"
149 148
  cp $CONF_SRC/roles-agreements.map $DIST/conf || fail "copying roles-agreements.map"
150 149

  
151 150
  if [ -n "$P_PROPS" ]; then
b/scripts/aquarium.sh
117 117
    fi
118 118

  
119 119
    echo "Starting Aquarium"
120
    echo >> $AQUARIUM_LOGFILE
120 121

  
121 122
    CLASSPATH=$JBOOT_JAR
122 123

  
......
125 126
    echo "Using AQUARIUM_MAIN_CLASS=$AQUARIUM_MAIN_CLASS"
126 127
    echo "Using AQUARIUM_PROP=$AQUARIUM_PROP"
127 128
    echo "Using JAVA_OPTS=$JAVA_OPTS"
128
    echo "nohup java $JAVA_OPTS -cp $CLASSPATH $AQUARIUM_PROP $JBOOT_MAIN_CLASS -lib $AQUARIUM_LIB $AQUARIUM_MAIN_CLASS > $AQUARIUM_LOGFILE"
129
    echo "nohup java $JAVA_OPTS -cp $CLASSPATH $AQUARIUM_PROP $JBOOT_MAIN_CLASS -lib $AQUARIUM_LIB $AQUARIUM_MAIN_CLASS >> $AQUARIUM_LOGFILE"
129 130

  
130
    nohup java $JAVA_OPTS -cp $CLASSPATH $AQUARIUM_PROP $JBOOT_MAIN_CLASS -lib $AQUARIUM_LIB $AQUARIUM_MAIN_CLASS > $AQUARIUM_LOGFILE 2>&1 &
131
    echo $! > $PID_FILE
132
    echo "PID="`cat $PID_FILE`
131
    nohup java $JAVA_OPTS -cp $CLASSPATH $AQUARIUM_PROP $JBOOT_MAIN_CLASS -lib $AQUARIUM_LIB $AQUARIUM_MAIN_CLASS >> $AQUARIUM_LOGFILE 2>&1 &
132
    PID=$!
133
    echo $PID > $PID_FILE
134
    echo "PID=$PID"
133 135
}
134 136

  
135 137
# Stops the application
b/src/main/resources/akka.conf
1
akka {
2
  version = "1.3.1"
3

  
4
  event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
5
  event-handler-level = "WARNING" # Options: ERROR, WARNING, INFO, DEBUG
6

  
7
  actor {
8
    # Default throughput for all ExecutorBasedEventDrivenDispatcher, set to 1 for complete fairness
9
    throughput = 1
10
  }
11

  
12
  # spray-can config
13
  spray-can {
14
    server {
15
      service-actor-id = "spray-root-service"
16
      timeout-actor-id = "spray-root-service" # we want to handle timeouts with the same service actor
17
      request-timeout = 3000 # require all requests to be completed within 3 seconds
18
    }
19
}
b/src/main/scala/gr/grnet/aquarium/Configurator.scala
173 173
        logger.info("{} = {}", Keys.events_store_folder, canonicalPath)
174 174

  
175 175
        if(canonicalFolder.exists() && !canonicalFolder.isDirectory) {
176
          throw new AquariumException("%s = %s is not a folder".format(Keys.events_store_folder, canonicalFolder))
176
          throw new AquariumInternalError("%s = %s is not a folder".format(Keys.events_store_folder, canonicalFolder))
177 177
        }
178 178

  
179 179
        // Now, events folder must be outside AQUARIUM_HOME, since AQUARIUM_HOME can be wiped out for an upgrade but
b/src/main/scala/gr/grnet/aquarium/Main.scala
42 42
import ch.qos.logback.core.util.StatusPrinter
43 43
import gr.grnet.aquarium.util.date.TimeHelpers
44 44
import gr.grnet.aquarium.util.LazyLoggable
45
import gr.grnet.aquarium.util.isRunningTests
46
import com.ckkloverdos.maybe.{MaybeEither, Failed, Just}
45
import com.ckkloverdos.maybe.{Failed, Just}
47 46

  
48 47
/**
49 48
 * Main method for Aquarium
......
67 66
  )
68 67

  
69 68
  private[this] def configureLogging(): Unit = {
70
    // http://logback.qos.ch/manual/joran.html
71
    LoggerFactory.getILoggerFactory match {
72
      case context: LoggerContext ⇒
73
        MaybeEither {
74
          val joran = new JoranConfigurator
75
          joran.setContext(context)
76
          context.reset()
77
          joran.doConfigure(ResourceLocator.LOGBACK_XML_FILE)
78
          logger.info("Logging subsystem configured from {}", ResourceLocator.LOGBACK_XML_FILE)
79
        } match {
80
          case Just(_) ⇒
81
            StatusPrinter.printInCaseOfErrorsOrWarnings(context)
82

  
83
          case Failed(e) ⇒
84
            StatusPrinter.print(context)
85
            throw new AquariumException(e, "Could not configure logging from %s".format(ResourceLocator.LOGBACK_XML_FILE))
86
        }
87

  
88
      case _ ⇒
89
    }
69
    // Make sure AQUARIUM_HOME is configured, since it is used in logback.xml
70
    assert(ResourceLocator.AQUARIUM_HOME_FOLDER.isDirectory)
90 71
  }
91 72

  
92 73
  def doStart(): Unit = {
93 74
    import ResourceLocator.{AQUARIUM_HOME, AQUARIUM_HOME_FOLDER, CONF_HERE, AKKA_HOME}
75

  
94 76
    // We have AKKA builtin, so no need to mess with pre-existing installation.
95 77
    if(AKKA_HOME.value.isJust) {
96 78
      val error = new AquariumInternalError("%s is set. Please unset and restart Aquarium".format(AKKA_HOME.name))
......
100 82

  
101 83
    val mc = Configurator.MasterConfigurator
102 84

  
103
    mc.eventsStoreFolder match {
104
      case Just(folder) ⇒
105
        logger.info("{} = {}", Configurator.Keys.events_store_folder, folder)
106

  
107
      case failed @ Failed(e) ⇒
108
        throw e
109

  
110
      case _ ⇒
85
    for(folder ← mc.eventsStoreFolder) {
86
      logger.info("{} = {}", Configurator.Keys.events_store_folder, folder)
111 87
    }
88
    mc.eventsStoreFolder.throwMe // on error
112 89

  
113
    for {
114
      prop <- PropsToShow
115
    } {
90
    for(prop ← PropsToShow) {
116 91
      logger.info("{} = {}", prop.name, prop.rawValue)
117 92
    }
93

  
118 94
    logger.info("{} = {}", AQUARIUM_HOME.name, AQUARIUM_HOME_FOLDER)
119 95
    logger.info("CONF_HERE = {}", CONF_HERE)
120 96

  
......
134 110
  def main(args: Array[String]) = {
135 111
    configureLogging()
136 112

  
137
    logStarting("Aquarium from %s", ResourceLocator.AQUARIUM_HOME_FOLDER)
113
    logStarting("Aquarium")
138 114
    val (ms0, ms1, _) = TimeHelpers.timed {
139 115
      doStart()
140 116
    }
b/src/main/scala/gr/grnet/aquarium/ResourceLocator.scala
44 44
import gr.grnet.aquarium.util.isRunningTests
45 45

  
46 46
/**
47
 * Used to locate configuration files.
47
 * Locates resources.
48 48
 *
49 49
 * This code was initially in [[gr.grnet.aquarium.Configurator]].
50 50
 *
b/src/test/resources/akka.conf
1 1
akka {
2 2
  version = "1.3.1"
3

  
4
  enabled-modules = ["remote", "http", "amqp"]
5

  
6
  time-unit = "seconds"
7

  
8
  event-handlers = ["akka.event.EventHandler$DefaultListener", "akka.event.slf4j.Slf4jEventHandler"] # event handlers to register at boot time (EventHandler$DefaultListener logs to STDOUT)
9
  event-handler-level = "DEBUG" # Options: ERROR, WARNING, INFO, DEBUG
10

  
11
  # These boot classes are loaded (and created) automatically when the Akka Microkernel boots up
12
  #     Can be used to bootstrap your application(s)
13
  #     Should be the FQN (Fully Qualified Name) of the boot class which needs to have a default constructor
14
  # boot = ["sample.camel.Boot",
15
  #         "sample.rest.java.Boot",
16
  #         "sample.rest.scala.Boot",
17
  #         "sample.security.Boot"]
18
  boot = []
3
  
4
  event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
5
  event-handler-level = "WARNING" # Options: ERROR, WARNING, INFO, DEBUG
19 6

  
20 7
  actor {
21
    timeout = 5                        # Default timeout for Future based invocations
22
                                       #    - Actor:        ? and ask
23
                                       #    - UntypedActor: ask
24
                                       #    - TypedActor:   methods with non-void return type
25
    serialize-messages = off           # Does a deep clone of (non-primitive) messages to ensure immutability
26
    throughput = 5                     # Default throughput for all ExecutorBasedEventDrivenDispatcher, set to 1 for complete fairness
27
    throughput-deadline-time = -1      # Default throughput deadline for all ExecutorBasedEventDrivenDispatcher, set to 0 or negative for no deadline
28
    dispatcher-shutdown-timeout = 1    # Using the akka.time-unit, how long dispatchers by default will wait for new actors until they shut down
29

  
30
    default-dispatcher {
31
      type = "GlobalExecutorBasedEventDriven" # Must be one of the following, all "Global*" are non-configurable
32
                                              #   - ExecutorBasedEventDriven
33
                                              #   - ExecutorBasedEventDrivenWorkStealing
34
                                              #   - GlobalExecutorBasedEventDriven
35
      keep-alive-time = 60             # Keep alive time for threads
36
      core-pool-size-factor = 1.0      # No of core threads ... ceil(available processors * factor)
37
      max-pool-size-factor  = 4.0      # Max no of threads ... ceil(available processors * factor)
38
      executor-bounds = -1             # Makes the Executor bounded, -1 is unbounded
39
      task-queue-size = -1             # Specifies the bounded capacity of the task queue (< 1 == unbounded)
40
      task-queue-type = "linked"       # Specifies which type of task queue will be used, can be "array" or "linked" (default)
41
      allow-core-timeout = on          # Allow core threads to time out
42
      rejection-policy = "sane"        # sane, abort, caller-runs, discard-oldest, discard
43
      throughput = 5                   # Throughput for ExecutorBasedEventDrivenDispatcher, set to 1 for complete fairness
44
      throughput-deadline-time = -1    # Throughput deadline for ExecutorBasedEventDrivenDispatcher, set to 0 or negative for no deadline
45
      mailbox-capacity = -1            # If negative (or zero) then an unbounded mailbox is used (default)
46
                                       # If positive then a bounded mailbox is used and the capacity is set using the property
47
                                       # NOTE: setting a mailbox to 'blocking' can be a bit dangerous,
48
                                       #       could lead to deadlock, use with care
49
                                       #
50
                                       # The following are only used for ExecutorBasedEventDriven
51
                                       # and only if mailbox-capacity > 0
52
      mailbox-push-timeout-time = 10   # Specifies the timeout to add a new message to a mailbox that is full - negative number means infinite timeout
53
                                       #       (in unit defined by the time-unit property)
54
    }
55

  
56
    debug {
57
      receive = "false"       # enable function of Actor.loggable(), which is
58
                              # to log any received message at DEBUG level
59
      autoreceive = "false"   # enable DEBUG logging of all AutoReceiveMessages
60
                              # (Kill, PoisonPill and the like)
61
      lifecycle = "false"     # enable DEBUG logging of actor lifecycle changes
62
    }
63

  
64
  remote {
65
    # secure-cookie = "050E0A0D0D06010A00000900040D060F0C09060B" # generate your own with '$AKKA_HOME/scripts/generate_config_with_secure_cookie.sh' or using 'Crypt.generateSecureCookie'
66
    secure-cookie = ""
67

  
68
    layer = "akka.remote.netty.NettyRemoteSupport"
8
    # Default throughput for all ExecutorBasedEventDrivenDispatcher, set to 1 for complete fairness
9
    throughput = 1
10
  }
69 11

  
12
  # spray-can config
13
  spray-can {
70 14
    server {
71
      hostname = "localhost"       # The hostname or IP that clients should connect to
72
      port = 2552                  # The port clients should connect to. Default is 2552 (AKKA)
73
      message-frame-size = 1048576 # Increase this if you want to be able to send messages with large payloads
74
      connection-timeout = 100     # Number in time-unit
75
      require-cookie = off         # Should the remote server require that it peers share the same secure-cookie (defined in the 'remote' section)?
76
      untrusted-mode = off         # Enable untrusted mode for full security of server managed actors, allows untrusted clients to connect.
77
      backlog = 4096               # Sets the size of the connection backlog
78
      execution-pool-keepalive = 60# Length in akka.time-unit how long core threads will be kept alive if idling
79
      execution-pool-size      = 16# Size of the core pool of the remote execution unit
80
      max-channel-memory-size  = 0 # Maximum channel size, 0 for off
81
      max-total-memory-size    = 0 # Maximum total size of all channels, 0 for off
15
      service-actor-id = "spray-root-service"
16
      timeout-actor-id = "spray-root-service" # we want to handle timeouts with the same service actor
17
      request-timeout = 3000 # require all requests to be completed within 3 seconds
82 18
    }
83

  
84
    client {
85
      buffering {
86
        retry-message-send-on-failure = off # Buffer outbound messages when send failed, if off you'll get an exception instead
87
        capacity = -1                      # If negative (or zero) then an unbounded mailbox is used (default)
88
                                           # If positive then a bounded mailbox is used and the capacity is set using the property
89
      }
90
      reconnect-delay = 5                  # Number in time-unit
91
      read-timeout = 120                   # Number in time-unit
92
      message-frame-size = 1048576         # Size in bytes
93
      reap-futures-delay = 5               # Number in time-unit
94
      reconnection-time-window = 600 # Maximum time window that a client should try to reconnect for
95
    }
96
  }
97

  
98
  test {
99
    timefactor = "1.0"    # factor by which to scale timeouts during tests, e.g. to account for shared build system load
100
  }
101
}
102

  
103
# spray-can config
104
spray-can {
105
  server {
106
    port = 8888
107
    service-actor-id = "spray-root-service"
108
    timeout-actor-id = "spray-root-service" # we want to handle timeouts with the same service actor
109
    request-timeout = 3000 # require all requests to be completed within 3 seconds
110
  }
111
}
19
}

Also available in: Unified diff