use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-ce by iitsoftware.
the class SessionHandler method close.
public void close() {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", close ...");
closeLock.lock();
if (closeInProgress) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", close in progress, return");
return;
}
closeInProgress = true;
closeLock.unlock();
sessionDisabled = false;
Semaphore sem = new Semaphore();
dispatch(new POCloseSession(sem));
sem.waitHere();
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", close done");
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-ce by iitsoftware.
the class AMQPHandler method close.
public void close() {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", close ...");
closeLock.lock();
if (closeInProgress) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", close in progress, return");
return;
}
closeInProgress = true;
closeLock.unlock();
Semaphore sem = new Semaphore();
dispatch(new POClose(sem));
sem.waitHere();
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", close done");
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-ce by iitsoftware.
the class ServerLink method close.
public void close() {
closed = true;
if (waitingPO != null) {
waitingPO.setSuccess(false);
waitingPO.setException("ServerLink closed");
Semaphore sem = waitingPO.getSemaphore();
if (sem != null)
sem.notifySingleWaiter();
waitingPO = null;
}
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-ce by iitsoftware.
the class DefaultScheduler method close.
public void close() {
// debug ctx.timerSwiftlet.removeTimerListener(tl);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close ...");
synchronized (this) {
if (closed)
return;
for (Iterator iter = connections.iterator(); iter.hasNext(); ) {
ConnectionEntry entry = (ConnectionEntry) iter.next();
iter.remove();
connectionRemoved(entry.getRoutingConnection());
}
}
Semaphore sem = new Semaphore();
enqueueClose(new POCloseObject(null, sem));
sem.waitHere();
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close done");
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-ce by iitsoftware.
the class Consumer method consume.
public void consume() {
sem = new Semaphore();
sem.waitHere();
if (exception != null)
failFast("failed: " + exception);
try {
verifier.verify();
} catch (Exception e) {
failFast("failed: " + e);
}
}
Aggregations