}
}
}
catch (InterruptedException e)
{
throw new HornetQInterruptedException(e);
}
}
response = null;
if (resendCache != null && packet.isRequiresConfirmations())
{
resendCache.add(packet);
}
connection.getTransportConnection().write(buffer, false, false);
long toWait = connection.getBlockingCallTimeout();
long start = System.currentTimeMillis();
while (!closed && (response == null || (response.getType() != PacketImpl.EXCEPTION &&
response.getType() != expectedPacket)) && toWait > 0)
{
try
{
sendCondition.await(toWait, TimeUnit.MILLISECONDS);
}
catch (InterruptedException e)
{
throw new HornetQInterruptedException(e);
}
if (response != null && response.getType() != PacketImpl.EXCEPTION && response.getType() != expectedPacket)
{
HornetQClientLogger.LOGGER.packetOutOfOrder(response, new Exception ("trace"));