|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.gleamynode.netty2.SessionServer
public class SessionServer
Listens to the TCP/IP port, accepts the incoming connections, and starts the
corresponding Sessions. Usage:
SessionServer server = new SessionServer(); server.setIoProcessor(ioProcessor); server.setEventDispatcher(eventDispatcher); server.setMessageRecognizer(myMessageRecognizer); server.setBindAddress(new InetSocketAddress(8080)); server.addSessionListener(mySessionListener); server.start();
| Constructor Summary | |
|---|---|
SessionServer()
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
addSessionListener(SessionListener listener)
Subscribe a SessionListenerto receive incoming events from the
new session. |
int |
getBacklog()
Returns the backlog value of the server socket. |
SocketAddress |
getBindAddress()
Returns the socket address this server listens on. |
SessionConfig |
getDefaultConfig()
Returns the default configuration of newly created sessions. |
EventDispatcher |
getEventDispatcher()
Returns the EventDispatcherthat will be passed to newly created
sessions' constructor. |
ExceptionMonitor |
getExceptionMonitor()
Returns the ExceptionMonitor. |
IoProcessor |
getIoProcessor()
Returns the IoProcessorthat will be passed to newly created
sessions' constructor. |
MessageRecognizer |
getMessageRecognizer()
Returns the MessageRecognizerthat will be passed to newly
created sessions' constructor. |
String |
getThreadName()
Returns the name of the server thread. |
int |
getThreadPriority()
Returns the priority of the server thread. |
boolean |
isStarted()
Returns true if this server is started. |
void |
removeSessionListener(SessionListener listener)
Unsubscribe a SessionListenerto stop receiving incoming events
from the new session. |
void |
setBacklog(int backLog)
Sets the backlog value of the server socket. |
void |
setBindAddress(SocketAddress bindAddress)
Sets the socket address this server listens on. |
void |
setDefaultConfig(SessionConfig defaultConfig)
Sets the default configuration of newly created sessions. |
void |
setEventDispatcher(EventDispatcher eventDispatcher)
Sets the EventDispatcherthat will be passed to newly created
sessions' constructor. |
void |
setExceptionMonitor(ExceptionMonitor monitor)
Sets the ExceptionMonitor. |
void |
setIoProcessor(IoProcessor ioProcessor)
Sets the IoProcessorthat will be passed to newly created
sessions' constructor. |
void |
setMessageRecognizer(MessageRecognizer messageRecognizer)
Sets the MessageRecognizerthat will be passed to newly created
sessions' constructor. |
void |
setThreadName(String threadName)
Sets the name of the server thread. |
void |
setThreadPriority(int threadPriority)
Sets the priority of the server thread. |
void |
start()
Starts accepting the incoming connections. |
void |
stop()
Stops accepting the incoming connections. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SessionServer()
| Method Detail |
|---|
public SocketAddress getBindAddress()
public void setBindAddress(SocketAddress bindAddress)
IllegalStateException - if the server is already running.public int getBacklog()
public void setBacklog(int backLog)
IllegalStateException - if the server is already running.public SessionConfig getDefaultConfig()
public void setDefaultConfig(SessionConfig defaultConfig)
public EventDispatcher getEventDispatcher()
EventDispatcherthat will be passed to newly created
sessions' constructor.
public void setEventDispatcher(EventDispatcher eventDispatcher)
EventDispatcherthat will be passed to newly created
sessions' constructor.
IllegalStateException - if the server is already running.public IoProcessor getIoProcessor()
IoProcessorthat will be passed to newly created
sessions' constructor.
public void setIoProcessor(IoProcessor ioProcessor)
IoProcessorthat will be passed to newly created
sessions' constructor.
IllegalStateException - if the server is already running.public MessageRecognizer getMessageRecognizer()
MessageRecognizerthat will be passed to newly
created sessions' constructor.
public void setMessageRecognizer(MessageRecognizer messageRecognizer)
MessageRecognizerthat will be passed to newly created
sessions' constructor.
public String getThreadName()
public void setThreadName(String threadName)
public int getThreadPriority()
public void setThreadPriority(int threadPriority)
public boolean isStarted()
true if this server is started.
public void addSessionListener(SessionListener listener)
SessionListenerto receive incoming events from the
new session.
public void removeSessionListener(SessionListener listener)
SessionListenerto stop receiving incoming events
from the new session.
public ExceptionMonitor getExceptionMonitor()
ExceptionMonitor.
public void setExceptionMonitor(ExceptionMonitor monitor)
ExceptionMonitor. Any uncaught exceptions will be
forwarded to the specified ExceptionMonitor
NullPointerException - if monitor is null.
public void start()
throws IOException
IOException - if failed to open the server socket
IllegalStateException - if some properties are not specifiedpublic void stop()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||