Package org.activemq.message

Examples of org.activemq.message.Packet


        }
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            Packet packet = wireFormat.fromString(readRequestBody(request));
           
            if( packet.getPacketType() == Packet.WIRE_FORMAT_INFO ) {
               
                // Can we handle the requested wire format?
                WireFormatInfo info = (WireFormatInfo) packet;
                if (!canProcessWireFormatVersion(info.getVersion())) {
                  response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot process wire format of version: " + info.getVersion());
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

                    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

                    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(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

            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(data);
            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

                            returnPackets.add(createConnectionInfo());
                            returnPackets.add(createConsumerPacket());
                        }
                    }   
                }else if (name.equals(MESSAGE_QNAME)){
                    Packet pack = readMessage(reader);
                    if (pack != null){
                        returnPackets.add(pack);
                    }
                }else {
                    //general catch all - just say ok ..
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

            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

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.