org.apache.mina.example.gettingstarted.timeserver
Class TimeServerHandler
java.lang.Object
org.apache.mina.core.service.IoHandlerAdapter
org.apache.mina.example.gettingstarted.timeserver.TimeServerHandler
- All Implemented Interfaces:
- IoHandler
public class TimeServerHandler
- extends IoHandlerAdapter
The Time Server handler : it return the current date when a message is received,
or close the session if the "quit" message is received.
- Author:
- Apache MINA Project
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimeServerHandler
public TimeServerHandler()
exceptionCaught
public void exceptionCaught(IoSession session,
java.lang.Throwable cause)
throws java.lang.Exception
- Trap exceptions.
- Specified by:
exceptionCaught
in interface IoHandler
- Overrides:
exceptionCaught
in class IoHandlerAdapter
- Throws:
java.lang.Exception
messageReceived
public void messageReceived(IoSession session,
java.lang.Object message)
throws java.lang.Exception
- If the message is 'quit', we exit by closing the session. Otherwise,
we return the current date.
- Specified by:
messageReceived
in interface IoHandler
- Overrides:
messageReceived
in class IoHandlerAdapter
- Throws:
java.lang.Exception
sessionIdle
public void sessionIdle(IoSession session,
IdleStatus status)
throws java.lang.Exception
- On idle, we just write a message on the console
- Specified by:
sessionIdle
in interface IoHandler
- Overrides:
sessionIdle
in class IoHandlerAdapter
- Throws:
java.lang.Exception
Copyright © 2004-2011 Apache MINA Project. All Rights Reserved.