org.jboss.xnio.nio
Class HandlerUtils

java.lang.Object
  extended by org.jboss.xnio.nio.HandlerUtils

public final class HandlerUtils
extends java.lang.Object

Helpful utility methods for SPI implementations.


Method Summary
static
<T> boolean
handleClosed(IoHandler<? super T> handler, T channel)
          Call the handler close method, logging any exceptions that may occur.
static
<T> boolean
handleOpened(IoHandler<? super T> handler, T channel)
          Call the handler open method, logging any exceptions that may occur.
static
<T> boolean
handleReadable(IoHandler<? super T> handler, T channel)
          Call the handler readable method, logging any exceptions that may occur.
static
<T> boolean
handleWritable(IoHandler<? super T> handler, T channel)
          Call the handler writable method, logging any exceptions that may occur.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

handleOpened

public static <T> boolean handleOpened(IoHandler<? super T> handler,
                                       T channel)
Call the handler open method, logging any exceptions that may occur. Returns true if the handler completed without error, which can be used to make a decision to close the channel, or ignored if desired.

Parameters:
handler - the handler
channel - the channel
Returns:
true if the handler completed without error.

handleClosed

public static <T> boolean handleClosed(IoHandler<? super T> handler,
                                       T channel)
Call the handler close method, logging any exceptions that may occur. Returns true if the handler completed without error, which can be ignored if desired.

Parameters:
handler - the handler
channel - the channel
Returns:
true if the handler completed without error.

handleReadable

public static <T> boolean handleReadable(IoHandler<? super T> handler,
                                         T channel)
Call the handler readable method, logging any exceptions that may occur. Returns true if the handler completed without error, which can be used to make a decision to close the channel, or ignored if desired.

Parameters:
handler - the handler
channel - the channel
Returns:
true if the handler completed without error.

handleWritable

public static <T> boolean handleWritable(IoHandler<? super T> handler,
                                         T channel)
Call the handler writable method, logging any exceptions that may occur. Returns true if the handler completed without error, which can be used to make a decision to close the channel, or ignored if desired.

Parameters:
handler - the handler
channel - the channel
Returns:
true if the handler completed without error.