BEA Systems, Inc.

com.connecterra.ale.reader
Interface SocketAcceptorDeviceChannel.SocketAcceptorListener

Enclosing class:
SocketAcceptorDeviceChannel

public static interface SocketAcceptorDeviceChannel.SocketAcceptorListener

This interface must be implemented by any class which is set as an asynchronous listener on this channel.


Method Summary
 void acceptorError(SocketAcceptorDeviceChannel sarc, IOException e)
          This callback is invoked when the accept throws an IOException.
 void connectionAccepted(SocketAcceptorDeviceChannel sarc, SocketChannel schan)
          This callback is invoked when a new connection is accepted.
 void connectionClosed(SocketAcceptorDeviceChannel sarc, SocketChannel schan, IOException e)
          This callback is invoked when the connection can no longer continue operating.
 void connectionReadable(SocketAcceptorDeviceChannel sarc, SocketChannel schan)
          This callback is invoked when data ia available on a connection accepted by the channel.
 

Method Detail

connectionAccepted

void connectionAccepted(SocketAcceptorDeviceChannel sarc,
                        SocketChannel schan)
                        throws IOException
This callback is invoked when a new connection is accepted.

If reading or writing to the channel fails, or for some reason the channel cannot be used, IOException should be thrown. This will cause the connectionClosed callback to be invoked, and the connection to be closed and thrown away. It will not cause ChannelManager.reactivateChannels() to be invoked.

Parameters:
sarc - the SocketAcceptorDeviceChannel which accepted the connection
schan - the newly accepted SocketChannel
Throws:
IOException - if an I/O error occurs

connectionReadable

void connectionReadable(SocketAcceptorDeviceChannel sarc,
                        SocketChannel schan)
                        throws IOException
This callback is invoked when data ia available on a connection accepted by the channel. If reading or writing to the channel fails, IOException should be thrown. This will cause the connectionClosed callback to be invoked, and the connection to be closed and thrown away. It will not cause ChannelManager.reactivateChannels() to be invoked.

See SocketDeviceChannel.SocketInputListener.connectionReadable(com.connecterra.ale.reader.SocketDeviceChannel) for additional comments on input buffering and blocking.

Parameters:
sarc - the SocketAcceptorDeviceChannel which accepted the connection
schan - the SocketChannel which has input available.
Throws:
IOException - if an I/O error occurs

connectionClosed

void connectionClosed(SocketAcceptorDeviceChannel sarc,
                      SocketChannel schan,
                      IOException e)
This callback is invoked when the connection can no longer continue operating. When the channel is closed, all connections receive this callback. When the connectionAccepted or connectionReadable callback throws an IOException, the relevant connection receives this callback and is then closed.

Parameters:
sarc - the SocketAcceptorDeviceChannel which accepted the connection
schan - the SocketChannel which is no longer usable
e - if a callback failed, the IOException which was thrown. Otherwise, null.

acceptorError

void acceptorError(SocketAcceptorDeviceChannel sarc,
                   IOException e)
This callback is invoked when the accept throws an IOException.

Parameters:
sarc - the SocketAcceptorDeviceChannel which tried to accept
e - the IOException which was thrown. Otherwise, null.

Documentation is available at
${DOCSWEBROOT}
Copyright 2007 BEA Systems Inc.