Modifier and Type | Class and Description |
---|---|
static class |
ChannelImpl.CHANNEL_ID |
Constructor and Description |
---|
ChannelImpl(CoreRemotingConnection connection,
long id,
int confWindowSize,
List<Interceptor> interceptors) |
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
CoreRemotingConnection being used by the channel |
ChannelHandler |
getHandler()
Gets the
ChannelHandler that this channel should
forward received packets to. |
long |
getID()
Returns the id of this channel.
|
int |
getLastConfirmedCommandID()
returns the last confirmed packet command id
|
Lock |
getLock()
returns the channel lock
|
int |
getReconnectID()
This number increases every time the channel reconnects succesfully.
|
void |
handlePacket(Packet packet)
Called by
CoreRemotingConnection when a packet is received. |
static String |
invokeInterceptors(Packet packet,
List<Interceptor> interceptors,
RemotingConnection connection) |
void |
lock()
locks the channel.
|
void |
replayCommands(int otherLastConfirmedCommandID)
resends any packets that have not received confirmations yet.
|
void |
returnBlocking()
forces any
Channel.sendBlocking(Packet, byte) request to return with an exception. |
void |
returnBlocking(Throwable cause)
forces any
Channel.sendBlocking(Packet, byte) request to return with an exception. |
boolean |
send(Packet packet)
Sends a packet on this channel.
|
boolean |
send(Packet packet,
int reconnectID)
Sends a packet on this channel.
|
boolean |
sendAndFlush(Packet packet)
Sends a packet on this channel and then blocks until it has been written to the connection.
|
boolean |
sendBatched(Packet packet)
Sends a packet on this channel using batching algorithm if appropriate
|
Packet |
sendBlocking(Packet packet,
byte expectedPacket)
Sends a packet on this channel and then blocks until a response is received or a timeout
occurs.
|
Packet |
sendBlocking(Packet packet,
int reconnectID,
byte expectedPacket)
Due to networking issues or server issues the server may take longer to answer than expected..
|
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 packetType)
For protocol check
|
String |
toString() |
void |
transferConnection(CoreRemotingConnection newConnection)
Transfers the connection used by this channel to the one specified.
|
void |
unlock()
unlocks the channel.
|
public ChannelImpl(CoreRemotingConnection connection, long id, int confWindowSize, List<Interceptor> interceptors)
public int getReconnectID()
Channel
getReconnectID
in interface Channel
public boolean supports(byte packetType)
Channel
public long getID()
Channel
public int getLastConfirmedCommandID()
Channel
getLastConfirmedCommandID
in interface Channel
public int getConfirmationWindowSize()
Channel
getConfirmationWindowSize
in interface Channel
public void returnBlocking()
Channel
Channel.sendBlocking(Packet, byte)
request to return with an exception.returnBlocking
in interface Channel
public void returnBlocking(Throwable cause)
Channel
Channel.sendBlocking(Packet, byte)
request to return with an exception.returnBlocking
in interface Channel
public boolean sendAndFlush(Packet packet)
Channel
sendAndFlush
in interface Channel
packet
- the packet to sendpublic boolean send(Packet packet)
Channel
public boolean send(Packet packet, int reconnectID)
Channel
public boolean sendBatched(Packet packet)
Channel
sendBatched
in interface Channel
packet
- the packet to sendpublic void setTransferring(boolean transferring)
Channel
setTransferring
in interface Channel
transferring
- whether the channel is transferringpublic Packet sendBlocking(Packet packet, byte expectedPacket) throws ActiveMQException
Channel
sendBlocking
in interface Channel
packet
- the packet to sendexpectedPacket
- the packet being expected.ActiveMQException
- if an error occurs during the sendpublic Packet sendBlocking(Packet packet, int reconnectID, byte expectedPacket) throws ActiveMQException
sendBlocking
in interface Channel
packet
- the packet to sendexpectedPacket
- the packet being expected.ActiveMQException
- if an error occurs during the sendpublic static String invokeInterceptors(Packet packet, List<Interceptor> interceptors, RemotingConnection connection)
packet
- the packet to interceptfalse
or null
if no interceptors
returned false
.public void setCommandConfirmationHandler(CommandConfirmationHandler handler)
Channel
setCommandConfirmationHandler
in interface Channel
handler
- the handler to callpublic void setHandler(ChannelHandler handler)
Channel
ChannelHandler
that this channel should
forward received packets to.setHandler
in interface Channel
handler
- the handlerpublic ChannelHandler getHandler()
Channel
ChannelHandler
that this channel should
forward received packets to.getHandler
in interface Channel
public void close()
Channel
once closed no packets can be sent.
public void transferConnection(CoreRemotingConnection newConnection)
Channel
All new packets will be sent via this connection.
transferConnection
in interface Channel
newConnection
- the new connectionpublic void replayCommands(int otherLastConfirmedCommandID)
Channel
Typically called after a connection has been transferred.
replayCommands
in interface Channel
otherLastConfirmedCommandID
- the last confirmed packetpublic void lock()
Channel
While locked no packets can be sent or received
public void unlock()
Channel
public CoreRemotingConnection getConnection()
Channel
CoreRemotingConnection
being used by the channelgetConnection
in interface Channel
public void flushConfirmations()
Channel
flushConfirmations
in interface Channel
public void confirm(Packet packet)
Channel
public void clearCommands()
Channel
clearCommands
in interface Channel
public void handlePacket(Packet packet)
Channel
CoreRemotingConnection
when a packet is received.
This method should then call its ChannelHandler
after appropriate processing of
the packet
handlePacket
in interface Channel
packet
- the packet to process.Copyright © 2016 JBoss by Red Hat. All rights reserved.