Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.Packet


        }

        public void run() {
            while (internalCount < localCount) {
                try {
                    Packet obj = queue.dequeue();
                    if (obj != null) {
                        count.increment();
                        internalCount++;
                        if (count.get() == TOTAL_LOAD) {
                            synchronized (mutex) {
View Full Code Here


            byte type = is.readByte();
            if (type != PACKET_RECORD_TYPE) {
                throw new IOException("Record is not a packet type.");
            }
            String destination = is.readUTF();
            Packet packet = wireFormat.readPacket(is);
            is.close();
            return packet;

        }
        catch (InvalidRecordLocationException e) {
View Full Code Here

            org.activeio.Packet data = journal.read(pos);
            DataInputStream is = new DataInputStream(new PacketInputStream(data));

            // Read the destination and packate from the record.
            String destination = null;
            Packet packet = null;
            try {
                byte type = is.readByte();
                switch (type) {
                    case PACKET_RECORD_TYPE:
View Full Code Here

                    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

                    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

                    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

                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

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

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.