use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-ce by iitsoftware.
the class Listener method receive.
public void receive() {
try {
sem = new Semaphore();
receiver.setMessageListener(this);
sem.waitHere();
if (exception != null)
throw exception;
verifier.verify();
} catch (Exception e) {
failFast("test failed: " + e);
}
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-client by iitsoftware.
the class ConnectionImpl method handOver.
public void handOver(com.swiftmq.net.client.Connection connection) {
this.connection = connection;
if (connection != null) {
connectionId++;
myHostname = connection.getLocalHostname();
connection.setInboundHandler(this);
connection.setExceptionHandler(this);
outStream = new DataStreamOutputStream(connection.getOutputStream());
if (connectionQueue != null) {
connectionQueue.clear();
connectionQueue.startQueue();
}
// Blocks new XA Requests
setSessionBlockState(true);
if (requestRegistry != null) {
requestRegistry.setPaused(false);
Semaphore retrySem = new Semaphore();
requestRegistry.retryAllRequests(retrySem);
retrySem.waitHere();
}
resetSessions(false);
notifyReconnectListener();
setSessionBlockState(false);
}
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-client by iitsoftware.
the class Connector method close.
public void close() {
if (debug)
System.out.println(toString() + ", close ...");
Semaphore sem = new Semaphore();
dispatch(new POClose(sem));
sem.waitHere();
if (debug)
System.out.println(toString() + ", close done");
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-client by iitsoftware.
the class MessageConsumerImpl method close.
public void close() throws JMSException {
if (closed)
return;
if (!mySession.isSessionStarted()) {
close(null);
return;
}
CloseConsumer request = new CloseConsumer(consumerId);
request._sem = new Semaphore();
mySession.serviceRequest(request);
request._sem.waitHere();
}
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);
}
Aggregations