org.abstracthorizon.extend.server.support
Class Control

java.lang.Object
  extended by org.abstracthorizon.extend.server.support.Control
All Implemented Interfaces:
Runnable

public class Control
extends Object
implements Runnable

Little control class that knows how gracefully to shutdown the spring application server.

Author:
Daniel Sendula

Field Summary
protected  InetAddress address
          Address to bind to
protected  org.slf4j.Logger logger
          Logger
static String MAGIC
          String that must be passed down the socket for control to react
protected  int port
          Local port control class is going to wait for signal to shutdown the server.
protected  SpringBasedServer server
          Reference to the server instance
protected  ServerSocket serverSocket
          Server socket this control is operating on
protected  Thread thread
          Thread this control class is going to run under
 
Constructor Summary
Control()
          Empty constructor
 
Method Summary
 InetAddress getAddress()
          Returns bind address
 int getPort()
          Returns the port control is going to run on
 SpringBasedServer getServer()
          Reference to the server instance
protected  String processLine(String line)
           
 void run()
          Main method
 void setAddress(InetAddress address)
          Sets bind address
 void setPort(int port)
          Sets the port control is going to run on
 void setServer(SpringBasedServer server)
          Sets reference to the server instance
 void shutdownServer()
          Stops the server invoking stop and destory methods.
 void start()
          Starts the thread
 void stop()
          Signals the thread that it should stop as soon as possible
protected  void writeControlFile()
          This method writes control file with server socket's port number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAGIC

public static final String MAGIC
String that must be passed down the socket for control to react

See Also:
Constant Field Values

logger

protected final org.slf4j.Logger logger
Logger


port

protected int port
Local port control class is going to wait for signal to shutdown the server. Default is 8019


thread

protected Thread thread
Thread this control class is going to run under


server

protected SpringBasedServer server
Reference to the server instance


serverSocket

protected ServerSocket serverSocket
Server socket this control is operating on


address

protected InetAddress address
Address to bind to

Constructor Detail

Control

public Control()
Empty constructor

Method Detail

start

public void start()
Starts the thread


stop

public void stop()
Signals the thread that it should stop as soon as possible


run

public void run()
Main method

Specified by:
run in interface Runnable

getPort

public int getPort()
Returns the port control is going to run on

Returns:
the port control is going to run on

setPort

public void setPort(int port)
Sets the port control is going to run on

Parameters:
port - the port control is going to run on

getAddress

public InetAddress getAddress()
Returns bind address

Returns:
bind address

setAddress

public void setAddress(InetAddress address)
Sets bind address

Parameters:
address - bind address

getServer

public SpringBasedServer getServer()
Reference to the server instance

Returns:
the server instance

setServer

public void setServer(SpringBasedServer server)
Sets reference to the server instance

Parameters:
server - the server instance

shutdownServer

public void shutdownServer()
Stops the server invoking stop and destory methods.


writeControlFile

protected void writeControlFile()
This method writes control file with server socket's port number


processLine

protected String processLine(String line)


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.