net.myrrix.web
Class Runner

java.lang.Object
  extended by net.myrrix.web.Runner
All Implemented Interfaces:
Closeable, Callable<Boolean>

public final class Runner
extends Object
implements Callable<Boolean>, Closeable

This is the runnable class which starts the Serving Layer and its Tomcat-based HTTP server. It is started with call() and can be shut down with close(). This implementation is used both in stand-alone local mode, and in a distributed mode cooperating with a Computation Layer.

This program instantiates a Tomcat-based HTTP server exposing a REST-style API. It is available via HTTP, or HTTPS as well if RunnerConfiguration.getKeystoreFile() is set. It can also be password protected by setting RunnerConfiguration.getUserName() and RunnerConfiguration.getPassword().

Runner is configured by RunnerConfiguration but when run as a command-line program, it is configured via a set of analogous flags:

When run in local mode, the Serving Layer instance will compute a model locally and save it as the file model.bin in the --localInputDir directory. It will be updated when the model is rebuilt. If the file is present at startup, it will be read to restore the server state, rather than re-reading CSV input in the directory and recomputing the model. Thus the file can be saved and restored as a way of preserving and recalling the server's state of learning.

Example of running in local mode:

java -jar myrrix-serving-x.y.jar --port=8080

(with an example of JVM tuning flags:)

java -jar myrrix-serving-x.y.jar -server -da -dsa -d64 -Xmx1g -XX:NewRatio=12 -XX:+UseParallelGC -XX:+UseParallelOldGC --port=8080

Finally, some more advanced tuning parameters are available. These are system parameters, set with -Dproperty=value.

Author:
Sean Owen

Constructor Summary
Runner(RunnerConfiguration config)
          Creates a new instance with the given configuration.
 
Method Summary
 void await()
          Blocks and waits until the server shuts down.
 Boolean call()
           
 void close()
           
 org.apache.catalina.startup.Tomcat getTomcat()
           
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Runner

public Runner(RunnerConfiguration config)
Creates a new instance with the given configuration.

Method Detail

getTomcat

public org.apache.catalina.startup.Tomcat getTomcat()
Returns:
the underlying Tomcat server that is being configured and run inside this instance.

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

call

public Boolean call()
             throws IOException
Specified by:
call in interface Callable<Boolean>
Throws:
IOException

await

public void await()
Blocks and waits until the server shuts down.


close

public void close()
Specified by:
close in interface Closeable


Copyright © 2012. All Rights Reserved.