Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.Packet


     * @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


    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

                    socket.setSoTimeout(soTimeout);
                }
                if (changeTimeout) {
                    socket.setSoTimeout(0);
                }
                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

    private BrokerClient brokerClient;
    private Packet packet;


    public static TransactionTask fromBytes(byte[] data) throws IOException {
        Packet packet = wireFormat.fromBytes(data);
        return createTask(packet);
    }
View Full Code Here

    public byte[] toBytes() throws JMSException, IOException {
        return wireFormat.toBytes(packet);
    }

    public static TransactionTask readTask(ObjectInput in) throws IOException {
        Packet packet = readPacket(in);
        return createTask(packet);
    }
View Full Code Here

                    ThreadedExecutor exec = new ThreadedExecutor();
                    exec.execute(new Runnable() {
                        public void run() {
                            while (!closed.get()) {
                                try {
                                    Packet packet = bpq.dequeue();
                                    if (packet != null) {
                                        dispatchToClient(packet);
                                    }
                                }
                                catch (InterruptedException e) {
View Full Code Here

        packet.setMemoryUsage(count);
        dataOut.write(data, 0, count);
    }

    protected synchronized final Packet readPacket(DataInput dataIn, PacketReader reader) throws IOException {
        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

     * @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

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

TOP

Related Classes of org.codehaus.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.