use of com.swiftmq.tools.timer.TimerEvent in project swiftmq-client by iitsoftware.
the class ConnectionDispatcher method visit.
public void visit(POOpen po) {
if (pTracer.isEnabled())
pTracer.trace(toString(), ", visit, po=" + po + " ...");
openPO = po;
try {
OpenFrame openFrame = new OpenFrame(0);
openFrame.setContainerId(new AMQPString(po.getContainerId()));
openFrame.setChannelMax(new AMQPUnsignedShort(po.getMaxChannel()));
if (myConnection.getOpenHostname() == null)
openFrame.setHostname(new AMQPString(remoteHostname));
else
openFrame.setHostname(new AMQPString(myConnection.getOpenHostname()));
maxLocalFrameSize = po.getMaxFrameSize() > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) po.getMaxFrameSize();
openFrame.setMaxFrameSize(new AMQPUnsignedInt(maxLocalFrameSize));
myIdleTimeout = po.getIdleTimeout();
if (myIdleTimeout > 0) {
openFrame.setIdleTimeOut(new Milliseconds(myIdleTimeout));
idleTimeoutDelay = po.getIdleTimeout() / 2;
idleTimeoutChecker = new TimerListener() {
public void performTimeAction(TimerEvent evt) {
dispatch(new POCheckIdleTimeout(null));
}
};
TimerRegistry.Singleton().addTimerListener(idleTimeoutDelay, idleTimeoutChecker);
}
outboundHandler.send(openFrame);
} catch (Exception e) {
e.printStackTrace();
}
checkBothSidesOpen();
if (pTracer.isEnabled())
pTracer.trace(toString(), ", visit, po=" + po + " done");
}
Aggregations