*/
@Override
public void send(byte[] messageBytes) throws MessageTransportException
{
if (shutdown.get())
throw new MessageTransportException("send called on shutdown queue.");
if (blocking)
{
while (true)
{
try { queue.put(messageBytes); if (statsCollector != null) statsCollector.messageSent(messageBytes); break; }
catch (InterruptedException ie)
{
if (shutdown.get())
throw new MessageTransportException("Shutting down durring send.");
}
}
}
else
{
if (! queue.offer(messageBytes))
{
if (statsCollector != null) statsCollector.messageNotSent();
if (overflowHandler != null)
overflowHandler.overflow(messageBytes);
else
throw new MessageTransportException("Failed to queue message due to capacity.");
}
else
if (statsCollector != null) statsCollector.messageSent(messageBytes);
}
}