Package org.activemq.message

Examples of org.activemq.message.Packet


                    log.trace("The socket peer is now closed");
                    stop();
                    return;
                }
                else if (answer != null) {
                    Packet packet = (Packet) answer;
                    // we might have just got a packet in but we've already shut down
                    if (closed.get()) {
                        break;
                    }
                    doConsumePacket(packet);
View Full Code Here


                socket.setSoTimeout(SO_TIMEOUT);
                while (!socket.isClosed()) {
                    socket.setSoTimeout(0);
                    socket.receive(dpacket);
                    if (dpacket.getLength() > 0) {
                        Packet packet = wireFormat.readPacket(getClientID(), dpacket);
                        if (packet != null) {
                            doConsumePacket(packet);
                        }
                    }
                }
View Full Code Here

    public void asyncSend(Packet packet) throws JMSException {
        doAsyncSend(packet);
    }

    protected Packet doAsyncSend(Packet packet) throws JMSException {
        Packet response = null;
        try {
            synchronized (writeLock) {
                response = getWireFormat().writePacket(packet, dataOut);
                dataOut.flush();
                asynchChannel.write( outputBuffer.getPacket() );
View Full Code Here

     * @throws IOException
     */
    public Packet readPacketFromByteArray(byte[] data) throws IOException {
        ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
        DataInputStream dataIn = new DataInputStream(bytesIn);
        Packet packet = createPacket();
        buildPacket(packet, dataIn);
        return packet;
    }
View Full Code Here

            if (isServerSide() && ++count > 500) {
                count = 0;
                Thread.yield();
            }
            try {
                Packet packet = getWireFormat().readPacket(dataIn);
                if (packet != null) {
                    doConsumePacket(packet);
                }
            }
            catch (SocketTimeoutException e) {
View Full Code Here

     * @param packet
     * @return a response or null
     * @throws JMSException
     */
    protected Packet doAsyncSend(Packet packet) throws JMSException {
        Packet response = null;
        try {
            synchronized (outboundLock) {
                response = getWireFormat().writePacket(packet, dataOut);
                dataOut.flush();
            }
View Full Code Here

     * @throws JMSException
     */
  public ReceiptHolder asyncSendWithReceipt(Packet packet) throws JMSException {
        ReceiptHolder rh = new ReceiptHolder();
        requestMap.put(new Short(packet.getId()), rh);
        Packet response = doAsyncSend(packet);
        if (response != null && response instanceof Receipt){
            rh.setReceipt((Receipt)response);
        }
        return rh;
  }
View Full Code Here

        return null;
    }

    protected synchronized final Packet readPacket(DataInput dataIn, PacketReader reader) throws IOException {
        synchronized (readMutex) {
            Packet packet = reader.createPacket();
            int length = dataIn.readInt();
            packet.setMemoryUsage(length);
            byte[] data = new byte[length];
            dataIn.readFully(data);
            //then splat into the internal datainput
            internalBytesIn.restart(data);
            reader.buildPacket(packet, internalDataIn);
View Full Code Here

public abstract class WireFormatTestSupport extends TestCase {
    protected WireFormat wireFormat;

    public void testMessage() throws Exception {
        ActiveMQMessage expected = createMessage();
        Packet actual = writeThenReadPacket(expected);
        assertMessage(expected, (ActiveMQMessage) actual);
    }
View Full Code Here

        assertMessage(expected, (ActiveMQMessage) actual);
    }

    public void testTextMessage() throws Exception {
        ActiveMQTextMessage expected = createTextMessage();
        Packet actual = writeThenReadPacket(expected);
        assertTextMessage(expected, (ActiveMQTextMessage) actual);
    }
View Full Code Here

TOP

Related Classes of org.activemq.message.Packet

Copyright © 2018 www.massapicom. 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.