use of com.swiftmq.jms.smqp.v400.CloseProducerRequest in project swiftmq-client by iitsoftware.
the class MessageProducerImpl method close.
/**
* Since a provider may allocate some resources on behalf of a
* MessageProducer outside the JVM, clients should close them when they
* are not needed. Relying on garbage collection to eventually reclaim
* these resources may not be timely enough.
*/
public void close() throws JMSException {
if (closed || mySession.isClosed())
return;
closed = true;
// Fix: 2.1.0
if (producerId == -1)
return;
Reply reply = null;
try {
reply = requestRegistry.request(new CloseProducerRequest(dispatchId, producerId));
} catch (Exception e) {
throw ExceptionConverter.convert(e);
}
if (!reply.isOk()) {
throw ExceptionConverter.convert(reply.getException());
}
}
Aggregations