use of org.apache.activemq.artemis.core.protocol.core.impl.wireformat.PacketsConfirmedMessage in project activemq-artemis by apache.
the class ChannelImpl method handlePacket.
@Override
public void handlePacket(final Packet packet) {
if (packet.getType() == PacketImpl.PACKETS_CONFIRMED) {
if (resendCache != null) {
final PacketsConfirmedMessage msg = (PacketsConfirmedMessage) packet;
clearUpTo(msg.getCommandID());
}
if (!connection.isClient()) {
handler.handlePacket(packet);
}
return;
} else {
if (packet.isResponse()) {
confirm(packet);
lock.lock();
try {
response = packet;
sendCondition.signal();
} finally {
lock.unlock();
}
} else if (handler != null) {
handler.handlePacket(packet);
}
}
}
use of org.apache.activemq.artemis.core.protocol.core.impl.wireformat.PacketsConfirmedMessage in project activemq-artemis by apache.
the class ChannelImpl method flushConfirmations.
// Needs to be synchronized since can be called by remoting service timer thread too for timeout flush
@Override
public synchronized void flushConfirmations() {
if (resendCache != null && receivedBytes != 0) {
receivedBytes = 0;
final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID.get());
confirmed.setChannelID(id);
if (logger.isTraceEnabled()) {
logger.trace("RemotingConnectionID=" + (connection == null ? "NULL" : connection.getID()) + " ChannelImpl::flushConfirmation flushing confirmation " + confirmed);
}
doWrite(confirmed);
}
}
use of org.apache.activemq.artemis.core.protocol.core.impl.wireformat.PacketsConfirmedMessage in project activemq-artemis by apache.
the class ChannelImpl method confirm.
@Override
public void confirm(final Packet packet) {
if (resendCache != null && packet.isRequiresConfirmations()) {
lastConfirmedCommandID.incrementAndGet();
if (logger.isTraceEnabled()) {
logger.trace("RemotingConnectionID=" + (connection == null ? "NULL" : connection.getID()) + " ChannelImpl::confirming packet " + packet + " last commandID=" + lastConfirmedCommandID);
}
receivedBytes += packet.getPacketSize();
if (receivedBytes >= confWindowSize) {
receivedBytes = 0;
final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID.get());
confirmed.setChannelID(id);
doWrite(confirmed);
}
}
}
Aggregations