Examples of Receipt


Examples of org.codehaus.activemq.message.Receipt

        sendReceipt(packet, null, false);
    }

    private void sendReceipt(Packet packet, Throwable requestEx, boolean failed) {
        if (packet != null && packet.isReceiptRequired()) {
            Receipt receipt = new Receipt();
            receipt.setId(this.packetIdGenerator.generateId());
            receipt.setCorrelationId(packet.getId());
            receipt.setBrokerName(brokerConnector.getBrokerInfo().getBrokerName());
            receipt.setClusterName(brokerConnector.getBrokerInfo().getClusterName());
            receipt.setException(requestEx);
            receipt.setFailed(failed);
            send(receipt);
        }
    }
View Full Code Here

Examples of org.codehaus.activemq.message.Receipt

     * @param timeout
     * @throws JMSException
     */
    public void syncSendPacket(Packet packet, int timeout) throws JMSException {
        if (isTransportOK && !closed.get()) {
            Receipt receipt;
            packet.setReceiptRequired(true);
            receipt = this.transportChannel.send(packet, timeout);
            if (receipt != null) {
                if (receipt.isFailed()) {
                    Throwable e = receipt.getException();
                    if (e != null) {
                        throw JMSExceptionHelper.newJMSException(e);
                    }
                    throw new JMSException("syncSendPacket failed with unknown exception");
                }
View Full Code Here

Examples of org.codehaus.activemq.message.Receipt

    }

    public Receipt syncSendRequest(Packet packet) throws JMSException {
        checkClosed();
        if (isTransportOK && !closed.get()) {
            Receipt receipt;
            packet.setReceiptRequired(true);
            if (packet.getId() == null || packet.getId().length() == 0) {
                packet.setId(this.packetIdGenerator.generateId());
            }
            receipt = this.transportChannel.send(packet);
            if (receipt.isFailed()) {
                Throwable e = receipt.getException();
                if (e != null) {
                    throw (JMSException) new JMSException(e.getMessage()).initCause(e);
                }
                throw new JMSException("syncSendPacket failed with unknown exception");
            }
View Full Code Here

Examples of org.codehaus.activemq.message.Receipt

     */
    public Receipt send(Packet packet, int timeout) throws JMSException {
        ReceiptHolder rh = new ReceiptHolder();
        requestMap.put(packet.getId(), rh);
        doAsyncSend(packet);
        Receipt result = rh.getReceipt(timeout);
        return result;
    }
View Full Code Here

Examples of org.codehaus.activemq.message.Receipt

    protected boolean doHandleReceipt(Packet packet) {
        boolean result = false;
        if (packet != null) {
            if (packet.isReceipt()) {
                result = true;
                Receipt receipt = (Receipt) packet;
                ReceiptHolder rh = (ReceiptHolder) requestMap.remove(receipt.getCorrelationId());
                if (rh != null) {
                    rh.setReceipt(receipt);
                }
                else {
                    log.warn("No Packet found to match Receipt correlationId: " + receipt.getCorrelationId());
                }
            }
        }
        return result;
    }
View Full Code Here

Examples of org.codehaus.activemq.message.Receipt

            }
        });
        t.setPriority(Thread.MAX_PRIORITY);
        t.start();
        for (int i = 0;i < TOTAL_LOAD;i++) {
            Receipt rec = new Receipt();
            rec.setMemoryUsage(TEST_INSTANCE_SIZE);
            queue.enqueue(rec);
        }
        try {
            synchronized (mutex) {
                while (count.get() < TOTAL_LOAD) {
View Full Code Here

Examples of org.codehaus.activemq.message.Receipt

    }

    public void testClear() {
        final MemoryBoundedQueue queue = queueManager.getMemoryBoundedQueue(QUEUE_NAME);
        queueManager.setValueLimit(TEST_INSTANCE_SIZE);
        Receipt obj = new Receipt();
        queue.enqueue(obj);
        queue.clear();
        assertTrue(queue.size() == 0);
        queue.close();
    }
View Full Code Here

Examples of org.codehaus.activemq.message.Receipt

    }

    public void testDequeue() throws Exception {
        final MemoryBoundedQueue queue = queueManager.getMemoryBoundedQueue(QUEUE_NAME);
        queueManager.setValueLimit(TEST_INSTANCE_SIZE * 100);
        Receipt obj = new Receipt();
        queue.enqueue(obj);
        Object result = queue.dequeue();
        assertTrue(result == obj);
        queue.close();
    }
View Full Code Here

Examples of org.codehaus.activemq.message.Receipt

        final MemoryBoundedQueue queue = queueManager.getMemoryBoundedQueue(QUEUE_NAME);
        assertTrue(queueManager.getTotalMemoryUsedSize() == 0);
        Object mutex = new Object();
        queueManager.setValueLimit(TEST_INSTANCE_SIZE * 100);
        for (int i = 0;i < 10;i++) {
            queue.enqueue(new Receipt());
        }
        Receipt test = new Receipt();
        test.setId("FIRST");
        queue.enqueueFirst(test);
        Object obj = queue.dequeue();
        assertTrue(obj == test);
        queue.close();
    }
View Full Code Here

Examples of org.codehaus.activemq.message.Receipt

    }

    public void testEnqueueNoBlock() {
        MemoryBoundedQueue queue = queueManager.getMemoryBoundedQueue(QUEUE_NAME);
        queueManager.setValueLimit(TEST_ENQUEUE_SIZE);
        Receipt test = new Receipt();
        queue.enqueueNoBlock(test);
        assertTrue(true);
        queue.close();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.