}
@Override
public void doRegularTask()
{
Operation protocolHandler = null;
try
{
protocolHandler = outgoingQueue.take();
if (protocolHandler instanceof EndOfOperationProtocolHandler)
{
logger.debug("Signal received; ending PDU sending");
signalEndOfThread();
return;
}
logger.debug("Sending request of " + protocolHandler);
synchronized (protocolHandler)
{
try
{
PDU_type pdu = protocolHandler.produceInitializingRequest();
logger.debug("Sending " + ToStringBuilder.reflectionToString(pdu));
BEROutputStream encoder = new BEROutputStream(DEFAULT_BUFFER_SIZE, charsetEncoding, ProtocolOIDRegister.getInstance());
PDU_codec.getCodec().serialize(encoder, protocolHandler.produceInitializingRequest(), false, "PDU");
encoder.flush();
encoder.writeTo(outputStream);
this.outputStream.flush();
protocolHandler.initializingRequestSubmitted();
}
catch (ProtocolException e)
{
protocolHandler.setError(e);
}
catch (IOException e)
{
logger.debug("I/O error while sending PDU", e);
signalEndOfThread();
}
finally
{
protocolHandler.notifyAll();
}
}
}
catch (InterruptedException e)
{