public interface Channel
CoreRemotingConnection
.
Any packet sent will have its channel id set to the specific channel sending so it can be routed to its correct channel
when received by the CoreRemotingConnection
. see Packet.setChannelID(long)
.
Each Channel should will forward any packets received to its ChannelHandler
.
A Channel *does not* support concurrent access by more than one thread!Modifier and Type | Method and Description |
---|---|
void |
clearCommands()
clears any commands from the cache that are yet to be confirmed.
|
void |
close()
closes this channel.
|
void |
confirm(Packet packet)
sends a confirmation of a packet being received.
|
void |
flushConfirmations()
flushes any confirmations on to the connection.
|
int |
getConfirmationWindowSize()
returns the confirmation window size this channel is using.
|
CoreRemotingConnection |
getConnection()
returns the Remoting Connection being used by the channel
|
long |
getID()
returns the id of this channel.
|
int |
getLastConfirmedCommandID()
returns the last confirmed packet command id
|
Lock |
getLock()
returns the channel lock
|
void |
handlePacket(Packet packet)
Called by
CoreRemotingConnection when a packet is received. |
void |
lock()
locks the channel.
|
void |
replayCommands(int lastConfirmedCommandID)
resends any packets that have not received confirmations yet.
|
void |
returnBlocking()
forces any
sendBlocking(Packet) request to return with an exception. |
void |
send(Packet packet)
sends a packet on this channel.
|
void |
sendAndFlush(Packet packet)
sends a packet on this channel and then blocks until it has been written to the connection.
|
void |
sendBatched(Packet packet)
sends a packet on this channel using batching algorithm if appropriate
|
Packet |
sendBlocking(Packet packet)
sends a packet on this channel and then blocks until a response is received or a timeout occurs.
|
void |
setCommandConfirmationHandler(CommandConfirmationHandler handler)
sets the handler to use when a confirmation is received.
|
void |
setHandler(ChannelHandler handler)
sets the
ChannelHandler that this channel should forward received packets to. |
void |
setTransferring(boolean transferring)
notifies the channel if it is transferring its connection.
|
boolean |
supports(byte packetID)
For protocol check
|
void |
transferConnection(CoreRemotingConnection newConnection)
transfers the connection used by this channel to the one specified.
|
void |
unlock()
unlocks the channel.
|
long getID()
boolean supports(byte packetID)
void send(Packet packet)
packet
- the packet to sendvoid sendBatched(Packet packet)
packet
- the packet to sendvoid sendAndFlush(Packet packet)
packet
- the packet to sendPacket sendBlocking(Packet packet) throws HornetQException
packet
- the packet to sendHornetQException
- if an error occurs during the sendvoid setHandler(ChannelHandler handler)
ChannelHandler
that this channel should forward received packets to.handler
- the handlervoid close()
void transferConnection(CoreRemotingConnection newConnection)
newConnection
- the new connectionvoid replayCommands(int lastConfirmedCommandID)
lastConfirmedCommandID
- the last confirmed packetint getLastConfirmedCommandID()
void lock()
void unlock()
void returnBlocking()
sendBlocking(Packet)
request to return with an exception.Lock getLock()
CoreRemotingConnection getConnection()
void confirm(Packet packet)
packet
- the packet to confirmvoid setCommandConfirmationHandler(CommandConfirmationHandler handler)
handler
- the handler to callvoid flushConfirmations()
void handlePacket(Packet packet)
CoreRemotingConnection
when a packet is received.
This method should then call its ChannelHandler
after appropriate processing of
the packetpacket
- the packet to process.void clearCommands()
int getConfirmationWindowSize()
void setTransferring(boolean transferring)
transferring
- whether the channel is transferringCopyright © 2012 JBoss by Red Hat. All Rights Reserved.