Liferay 6.2-ce-ga5

com.liferay.portal.kernel.nio.intraband
Class BaseIntraband

java.lang.Object
  extended by com.liferay.portal.kernel.nio.intraband.BaseIntraband
All Implemented Interfaces:
Intraband
Direct Known Subclasses:
ExecutorIntraband, SelectorIntraband

public abstract class BaseIntraband
extends Object
implements Intraband


Nested Class Summary
protected static class BaseIntraband.SendSyncDatagramCompletionHandler
           
 
Field Summary
protected  AtomicReference<DatagramReceiveHandler[]> datagramReceiveHandlersReference
           
protected  long defaultTimeout
           
protected  boolean open
           
protected static EnumSet<CompletionHandler.CompletionType> REPLIED_ENUM_SET
           
protected  Map<Long,Datagram> responseWaitingMap
           
protected  AtomicLong sequenceIdGenerator
           
protected  NavigableMap<Long,Long> timeoutMap
           
 
Constructor Summary
BaseIntraband(long defaultTimeout)
           
 
Method Summary
protected  void addResponseWaitingDatagram(Datagram requestDatagram)
           
protected  void cleanUpTimeoutResponseWaitingDatagrams()
           
 void close()
           
protected abstract  void doSendDatagram(RegistrationReference registrationReference, Datagram datagram)
           
protected  Datagram doSendSyncDatagram(RegistrationReference registrationReference, Datagram datagram, long timeout)
           
protected  void ensureOpen()
           
protected  long generateSequenceId()
           
 DatagramReceiveHandler[] getDatagramReceiveHandlers()
           
protected  void handleReading(ScatteringByteChannel scatteringByteChannel, ChannelContext channelContext)
           
protected  boolean handleWriting(GatheringByteChannel gatheringByteChannel, ChannelContext channelContext)
           
 boolean isOpen()
           
 DatagramReceiveHandler registerDatagramReceiveHandler(byte type, DatagramReceiveHandler datagramReceiveHandler)
           
protected  Datagram removeResponseWaitingDatagram(Datagram responseDatagram)
           
 void sendDatagram(RegistrationReference registrationReference, Datagram datagram)
           
<A> void
sendDatagram(RegistrationReference registrationReference, Datagram datagram, A attachment, EnumSet<CompletionHandler.CompletionType> completionTypes, CompletionHandler<A> completionHandler)
           
<A> void
sendDatagram(RegistrationReference registrationReference, Datagram datagram, A attachment, EnumSet<CompletionHandler.CompletionType> completionTypes, CompletionHandler<A> completionHandler, long timeout, TimeUnit timeUnit)
           
 Datagram sendSyncDatagram(RegistrationReference registrationReference, Datagram datagram)
           
 Datagram sendSyncDatagram(RegistrationReference registrationReference, Datagram datagram, long timeout, TimeUnit timeUnit)
           
 DatagramReceiveHandler unregisterDatagramReceiveHandler(byte type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.liferay.portal.kernel.nio.intraband.Intraband
registerChannel, registerChannel
 

Field Detail

REPLIED_ENUM_SET

protected static final EnumSet<CompletionHandler.CompletionType> REPLIED_ENUM_SET

defaultTimeout

protected final long defaultTimeout

datagramReceiveHandlersReference

protected final AtomicReference<DatagramReceiveHandler[]> datagramReceiveHandlersReference

open

protected volatile boolean open

responseWaitingMap

protected final Map<Long,Datagram> responseWaitingMap

sequenceIdGenerator

protected final AtomicLong sequenceIdGenerator

timeoutMap

protected final NavigableMap<Long,Long> timeoutMap
Constructor Detail

BaseIntraband

public BaseIntraband(long defaultTimeout)
Method Detail

close

public void close()
           throws InterruptedException,
                  IOException
Specified by:
close in interface Intraband
Throws:
InterruptedException
IOException

getDatagramReceiveHandlers

public DatagramReceiveHandler[] getDatagramReceiveHandlers()
Specified by:
getDatagramReceiveHandlers in interface Intraband

isOpen

public boolean isOpen()
Specified by:
isOpen in interface Intraband

registerDatagramReceiveHandler

public DatagramReceiveHandler registerDatagramReceiveHandler(byte type,
                                                             DatagramReceiveHandler datagramReceiveHandler)
Specified by:
registerDatagramReceiveHandler in interface Intraband

sendDatagram

public void sendDatagram(RegistrationReference registrationReference,
                         Datagram datagram)
Specified by:
sendDatagram in interface Intraband

sendDatagram

public <A> void sendDatagram(RegistrationReference registrationReference,
                             Datagram datagram,
                             A attachment,
                             EnumSet<CompletionHandler.CompletionType> completionTypes,
                             CompletionHandler<A> completionHandler)
Specified by:
sendDatagram in interface Intraband

sendDatagram

public <A> void sendDatagram(RegistrationReference registrationReference,
                             Datagram datagram,
                             A attachment,
                             EnumSet<CompletionHandler.CompletionType> completionTypes,
                             CompletionHandler<A> completionHandler,
                             long timeout,
                             TimeUnit timeUnit)
Specified by:
sendDatagram in interface Intraband

sendSyncDatagram

public Datagram sendSyncDatagram(RegistrationReference registrationReference,
                                 Datagram datagram)
                          throws InterruptedException,
                                 IOException,
                                 TimeoutException
Specified by:
sendSyncDatagram in interface Intraband
Throws:
InterruptedException
IOException
TimeoutException

sendSyncDatagram

public Datagram sendSyncDatagram(RegistrationReference registrationReference,
                                 Datagram datagram,
                                 long timeout,
                                 TimeUnit timeUnit)
                          throws InterruptedException,
                                 IOException,
                                 TimeoutException
Specified by:
sendSyncDatagram in interface Intraband
Throws:
InterruptedException
IOException
TimeoutException

unregisterDatagramReceiveHandler

public DatagramReceiveHandler unregisterDatagramReceiveHandler(byte type)
Specified by:
unregisterDatagramReceiveHandler in interface Intraband

addResponseWaitingDatagram

protected void addResponseWaitingDatagram(Datagram requestDatagram)

cleanUpTimeoutResponseWaitingDatagrams

protected void cleanUpTimeoutResponseWaitingDatagrams()

doSendDatagram

protected abstract void doSendDatagram(RegistrationReference registrationReference,
                                       Datagram datagram)

doSendSyncDatagram

protected Datagram doSendSyncDatagram(RegistrationReference registrationReference,
                                      Datagram datagram,
                                      long timeout)
                               throws InterruptedException,
                                      IOException,
                                      TimeoutException
Throws:
InterruptedException
IOException
TimeoutException

ensureOpen

protected void ensureOpen()

generateSequenceId

protected long generateSequenceId()

handleReading

protected void handleReading(ScatteringByteChannel scatteringByteChannel,
                             ChannelContext channelContext)

handleWriting

protected boolean handleWriting(GatheringByteChannel gatheringByteChannel,
                                ChannelContext channelContext)

removeResponseWaitingDatagram

protected Datagram removeResponseWaitingDatagram(Datagram responseDatagram)

Liferay 6.2-ce-ga5