Class ShutdownMonitor
java.lang.Object
org.eclipse.jetty.server.ShutdownMonitor
Shutdown/Stop Monitor thread.
This thread listens on the host/port specified by the STOP.HOST/STOP.PORT system parameter (defaults to 127.0.0.1/-1 for not listening) for request authenticated with the key given by the STOP.KEY system parameter for admin requests.
If the stop port is set to zero, then a random port is assigned and the port number is printed to stdout.
Commands "stop" and "status" are currently supported.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate classThread for listening to STOP.PORT for command to stop Jetty. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCreates a ShutdownMonitor using configuration from the System properties. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddLifeCycles(LifeCycle... lifeCycles) (package private) voidawait()private booleancontainsLifeCycle(LifeCycle lifeCycle) private voidprivate voidstatic voidderegister(LifeCycle lifeCycle) static ShutdownMonitorgetKey()intgetPort()protected booleanisAlive()booleanisExitVm()static booleanisRegistered(LifeCycle lifeCycle) private ServerSocketlisten()static voidprivate voidremoveLifeCycle(LifeCycle lifeCycle) protected static voidreset()voidsetDebug(boolean flag) voidsetExitVm(boolean exitVm) voidvoidsetPort(int port) protected voidstart()private voidstop()toString()
-
Field Details
-
_lifeCycles
-
debug
private boolean debug -
host
-
port
private int port -
key
-
exitVm
private boolean exitVm -
alive
private boolean alive
-
-
Constructor Details
-
ShutdownMonitor
private ShutdownMonitor()Creates a ShutdownMonitor using configuration from the System properties.STOP.PORT= the port to listen on (empty, null, or values less than 0 disable the stop ability)
STOP.KEY= the magic key/passphrase to allow the stop
Note: server socket will only listen on localhost, and a successful stop will issue a System.exit() call.
-
-
Method Details
-
getInstance
-
reset
protected static void reset() -
register
-
deregister
-
isRegistered
-
addLifeCycles
-
removeLifeCycle
-
containsLifeCycle
-
debug
-
debug
-
getKey
-
getPort
public int getPort() -
isExitVm
public boolean isExitVm() -
setDebug
public void setDebug(boolean flag) -
setExitVm
public void setExitVm(boolean exitVm) - Parameters:
exitVm- true to exit the VM on shutdown
-
setKey
-
setPort
public void setPort(int port) -
start
-
stop
private void stop() -
await
- Throws:
InterruptedException
-
isAlive
protected boolean isAlive() -
listen
-
toString
-