com.caucho.cloud.network
Class NetworkListenSystem

java.lang.Object
  extended by com.caucho.env.service.AbstractResinSubSystem
      extended by com.caucho.cloud.network.NetworkListenSystem
All Implemented Interfaces:
ResinSubSystem, AlarmListener, java.util.EventListener

public class NetworkListenSystem
extends AbstractResinSubSystem
implements AlarmListener


Field Summary
static int START_PRIORITY_AT_BEGIN
           
static int START_PRIORITY_AT_END
           
 
Fields inherited from interface com.caucho.env.service.ResinSubSystem
START_PRIORITY_CACHE_SERVICE, START_PRIORITY_CLASSLOADER, START_PRIORITY_CLUSTER_SERVICE, START_PRIORITY_DEFAULT, START_PRIORITY_ENV_SYSTEM, START_PRIORITY_NETWORK_CLUSTER
 
Method Summary
 void addListener(TcpSocketLinkListener listener)
           
 void bind(java.lang.String address, int port, QServerSocket ss)
           
static NetworkListenSystem createAndAddService(CloudServer cloudServer)
           
 TcpSocketLink findConnectionByThreadId(long threadId)
          Finds the TcpConnection given the threadId
 TcpSocketLinkListener getClusterListener()
          Returns the cluster listener, if in a clustered environment.
static NetworkListenSystem getCurrent()
           
 java.util.Collection<TcpSocketLinkListener> getListeners()
          Returns the TcpSocketLinkListeners for this server.
 int getStartPriority()
          Returns the start priority of the service, used to determine which services to start first.
 void handleAlarm(Alarm alarm)
          Handles the alarm.
 boolean isBindPortsAfterStart()
          If true, ports are bound at end.
 void setBindPortsAfterStart(boolean bindAtEnd)
          If true, ports are bound at end.
 void start()
          Bind the ports.
 void stop()
          Closes the server.
 
Methods inherited from class com.caucho.env.service.AbstractResinSubSystem
destroy, getStopPriority, preCreate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

START_PRIORITY_AT_BEGIN

public static final int START_PRIORITY_AT_BEGIN
See Also:
Constant Field Values

START_PRIORITY_AT_END

public static final int START_PRIORITY_AT_END
See Also:
Constant Field Values
Method Detail

createAndAddService

public static NetworkListenSystem createAndAddService(CloudServer cloudServer)

getCurrent

public static NetworkListenSystem getCurrent()

getClusterListener

public TcpSocketLinkListener getClusterListener()
Returns the cluster listener, if in a clustered environment.


addListener

public void addListener(TcpSocketLinkListener listener)

setBindPortsAfterStart

public void setBindPortsAfterStart(boolean bindAtEnd)
If true, ports are bound at end.


isBindPortsAfterStart

public boolean isBindPortsAfterStart()
If true, ports are bound at end.


getListeners

public java.util.Collection<TcpSocketLinkListener> getListeners()
Returns the TcpSocketLinkListeners for this server.


bind

public void bind(java.lang.String address,
                 int port,
                 QServerSocket ss)
          throws java.lang.Exception
Throws:
java.lang.Exception

findConnectionByThreadId

public TcpSocketLink findConnectionByThreadId(long threadId)
Finds the TcpConnection given the threadId


getStartPriority

public int getStartPriority()
Description copied from interface: ResinSubSystem
Returns the start priority of the service, used to determine which services to start first.

Specified by:
getStartPriority in interface ResinSubSystem
Overrides:
getStartPriority in class AbstractResinSubSystem

start

public void start()
           throws java.lang.Exception
Bind the ports.

Specified by:
start in interface ResinSubSystem
Overrides:
start in class AbstractResinSubSystem
Throws:
java.lang.Exception

handleAlarm

public void handleAlarm(Alarm alarm)
Handles the alarm.

Specified by:
handleAlarm in interface AlarmListener

stop

public void stop()
Closes the server.

Specified by:
stop in interface ResinSubSystem
Overrides:
stop in class AbstractResinSubSystem