Class ServiceStopper

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--ServiceStopper
All Implemented Interfaces:
java.lang.Runnable

class ServiceStopper
extends java.lang.Thread

Responsible for listening on a port for the service stop signal by the jsl process. Default port is 8375.
If you are running the your application from java command line (not through the jsl.exe) simply use java ServiceStopper. The listener Thread will be started as a daemon Thread.


Inner Class Summary
(package private)  class ServiceStopper.Stopper
           
 
Field Summary
static int PORT
          Port for stopping the application.
(package private) static ServiceStopper singleton
           
protected  ServiceStopper.Stopper stopper
          The queue that a single stop thread will stop
protected  java.util.Vector stoppers
          List of Stopable queues the singleton will stop on signal
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ
 
Constructor Summary
private ServiceStopper()
           
private ServiceStopper(ServiceStopper.Stopper stopper)
           
 
Method Summary
protected  boolean _stop(Stopable stopable)
           
protected  boolean _stopAfter(Stopable stopAfter, Stopable stopable)
           
protected  ServiceStopper.Stopper find(Stopable stopAfter)
           
private static ServiceStopper get()
           
static void main(java.lang.String[] arg)
          Stop the service on the default port.
 void run()
           
static boolean stop(Stopable stopable)
          Stop the stopable on exit.
static boolean stopAfter(Stopable stopAfter, Stopable stopable)
          Stop the stopable on exit.
protected  void stopAll()
           
protected  void stopSingle()
           
protected  int timeToWait()
           
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

singleton

static ServiceStopper singleton

PORT

public static int PORT
Port for stopping the application. Default is 8375

stoppers

protected java.util.Vector stoppers
List of Stopable queues the singleton will stop on signal

stopper

protected ServiceStopper.Stopper stopper
The queue that a single stop thread will stop
Constructor Detail

ServiceStopper

private ServiceStopper()

ServiceStopper

private ServiceStopper(ServiceStopper.Stopper stopper)
Method Detail

get

private static ServiceStopper get()

stop

public static boolean stop(Stopable stopable)
Stop the stopable on exit. Remark that a Stopable passed here will be stopped asychronously. In other words, each Stopable will be called in it's own thread concurrently.

stopAfter

public static boolean stopAfter(Stopable stopAfter,
                                Stopable stopable)
Stop the stopable on exit. Remark that a Stopable passed here will be stopped synchronized with stopAfter. In other words, you can create a queue of stopables which will be called one after the other all synchronized in the same thread.

_stop

protected boolean _stop(Stopable stopable)

_stopAfter

protected boolean _stopAfter(Stopable stopAfter,
                             Stopable stopable)

find

protected ServiceStopper.Stopper find(Stopable stopAfter)

run

public void run()
Overrides:
run in class java.lang.Thread

stopAll

protected void stopAll()

timeToWait

protected int timeToWait()

stopSingle

protected void stopSingle()

main

public static void main(java.lang.String[] arg)
Stop the service on the default port. This is useful for debugging purposes when running the java app from command line. A simple java ServiceStopper [port] will stop the application.