[xSocket-develop] I can catch every event of Pipeline with MultiplexedProtocolAdapter, But not Multi
Status: Inactive
Brought to you by:
grro
|
From: 이성욱 <br...@na...> - 2010-10-28 06:36:16
|
Hello. Really thanks for xSocket.
I’m using xSocket multiplexed socket server.
Below code is simple snippets of my program (Especially part of Socket server).
I can catch every event of Pipeline with MultiplexedProtocolAdapter class.
But I can’t catch event of Connection (parent of a set of pipeline).
Connection can exist without pipeline, But session data could be shared within connection(MultiplexedConnection) not pipeline.
This session data have to be finalized connection(MultiplexedConnection) close time, not pipeline.
Please tell me how can I catch Connection(MultiplexedConnection)’s close or connect event on MultiplexedServer context.
Really thanks.
public class TimeoutServer{
public static void main(String[] args) throws Exception{
MultiplexedProtocolAdapter adapter = new MultiplexedProtocolAdapter(handler);
...
Server tServer = new Server(80, options, adapter, null, true);
tServer.setAutoflush(false);
tServer.start();
}
}
class TestHandler implements
//IConnectHandler,
//IDataHandler,
//IDisconnectHandler,
//IIdleTimeoutHandler,
//IConnectionTimeoutHandler
IPipelineConnectHandler,
IPipelineDataHandler,
IPipelineDisconnectHandler,
IPipelineIdleTimeoutHandler,
IPipelineConnectionTimeoutHandler{
public boolean onData(INonBlockingPipeline pipeline) throws IOException,BufferUnderflowException, MaxReadSizeExceededException {
System.out.println(">> onData called");
return true;
}
public boolean onConnect(INonBlockingPipeline pipeline) throws IOException, BufferUnderflowException, MaxReadSizeExceededException {
System.out.println(">> onConnect called");
return true;
}
public boolean onDisconnect(INonBlockingPipeline pipeline) throws IOException {
System.out.println(">> onDisconnect called");
return false;
}
}
|