org.apache.mina.example.imagine.step3.server
Class ImageServerIoHandler

java.lang.Object
  extended by org.apache.mina.core.service.IoHandlerAdapter
      extended by org.apache.mina.example.imagine.step3.server.ImageServerIoHandler
All Implemented Interfaces:
IoHandler

public class ImageServerIoHandler
extends IoHandlerAdapter

server-side IoHandler

Author:
Apache MINA Project

Field Summary
static java.lang.String INDEX_KEY
           
 
Constructor Summary
ImageServerIoHandler(javax.management.MBeanServer mBeanServer)
          Creates a new instance of ImageServerIoHandler.
 
Method Summary
 void exceptionCaught(IoSession session, java.lang.Throwable cause)
          This method will be called whenever an exception occurs.
 void messageReceived(IoSession session, java.lang.Object message)
          Handle incoming messages.
 void sessionCreated(IoSession session)
          This method is called first when a new connection to the server is made.
 void sessionOpened(IoSession session)
          Called when the session is opened, which will come after the session created.
 
Methods inherited from class org.apache.mina.core.service.IoHandlerAdapter
messageSent, sessionClosed, sessionIdle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDEX_KEY

public static final java.lang.String INDEX_KEY
Constructor Detail

ImageServerIoHandler

public ImageServerIoHandler(javax.management.MBeanServer mBeanServer)
Creates a new instance of ImageServerIoHandler. For this step, we pass in a reference to the MBeanServer. This instance will be used to register new IoSession objects so that the JMX subsystem can report statistics on the sessions.

Parameters:
mBeanServer - The JMX MBeanServer that will register the sessions
Method Detail

sessionCreated

public void sessionCreated(IoSession session)
                    throws java.lang.Exception
This method is called first when a new connection to the server is made. In here we will set up the JMX session MBean.

Specified by:
sessionCreated in interface IoHandler
Overrides:
sessionCreated in class IoHandlerAdapter
Throws:
java.lang.Exception
See Also:
IoHandlerAdapter.sessionCreated(org.apache.mina.core.session.IoSession)

sessionOpened

public void sessionOpened(IoSession session)
                   throws java.lang.Exception
Called when the session is opened, which will come after the session created.

Specified by:
sessionOpened in interface IoHandler
Overrides:
sessionOpened in class IoHandlerAdapter
Throws:
java.lang.Exception
See Also:
IoHandlerAdapter.sessionOpened(org.apache.mina.core.session.IoSession)

exceptionCaught

public void exceptionCaught(IoSession session,
                            java.lang.Throwable cause)
                     throws java.lang.Exception
This method will be called whenever an exception occurs. For this handler, the logger will generate a warning message.

Specified by:
exceptionCaught in interface IoHandler
Overrides:
exceptionCaught in class IoHandlerAdapter
Throws:
java.lang.Exception
See Also:
IoHandlerAdapter.exceptionCaught(org.apache.mina.core.session.IoSession, java.lang.Throwable)

messageReceived

public void messageReceived(IoSession session,
                            java.lang.Object message)
                     throws java.lang.Exception
Handle incoming messages.

Specified by:
messageReceived in interface IoHandler
Overrides:
messageReceived in class IoHandlerAdapter
Throws:
java.lang.Exception
See Also:
IoHandlerAdapter.messageReceived(org.apache.mina.core.session.IoSession, java.lang.Object)


Copyright © 2004-2011 Apache MINA Project. All Rights Reserved.