Search in sources :

Example 11 with CloseProducerRequest

use of com.swiftmq.jms.smqp.v610.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());
    }
}
Also used : Reply(com.swiftmq.tools.requestreply.Reply) ProduceMessageReply(com.swiftmq.jms.smqp.v510.ProduceMessageReply) CloseProducerRequest(com.swiftmq.jms.smqp.v510.CloseProducerRequest)

Aggregations

Reply (com.swiftmq.tools.requestreply.Reply)3 CloseProducerRequest (com.swiftmq.jms.smqp.v600.CloseProducerRequest)2 CloseProducerRequest (com.swiftmq.jms.smqp.v610.CloseProducerRequest)2 CloseProducerRequest (com.swiftmq.jms.smqp.v630.CloseProducerRequest)2 CloseProducerRequest (com.swiftmq.jms.smqp.v750.CloseProducerRequest)2 IllegalStateException (javax.jms.IllegalStateException)2 CloseProducerRequest (com.swiftmq.jms.smqp.v400.CloseProducerRequest)1 ProduceMessageReply (com.swiftmq.jms.smqp.v400.ProduceMessageReply)1 CloseProducerRequest (com.swiftmq.jms.smqp.v500.CloseProducerRequest)1 ProduceMessageReply (com.swiftmq.jms.smqp.v500.ProduceMessageReply)1 CloseProducerRequest (com.swiftmq.jms.smqp.v510.CloseProducerRequest)1 ProduceMessageReply (com.swiftmq.jms.smqp.v510.ProduceMessageReply)1 ProduceMessageReply (com.swiftmq.jms.smqp.v600.ProduceMessageReply)1 ProduceMessageRequest (com.swiftmq.jms.smqp.v600.ProduceMessageRequest)1 ProduceMessageReply (com.swiftmq.jms.smqp.v610.ProduceMessageReply)1 ProduceMessageRequest (com.swiftmq.jms.smqp.v610.ProduceMessageRequest)1 ProduceMessageReply (com.swiftmq.jms.smqp.v630.ProduceMessageReply)1 ProduceMessageRequest (com.swiftmq.jms.smqp.v630.ProduceMessageRequest)1 ProduceMessageReply (com.swiftmq.jms.smqp.v750.ProduceMessageReply)1 ProduceMessageRequest (com.swiftmq.jms.smqp.v750.ProduceMessageRequest)1