Package org.apache.activemq.command

Examples of org.apache.activemq.command.DataStructure


        if( sequence == null ) {
           
            int size=1;
            if( command != null) {
               
                DataStructure c = (DataStructure) command;
                byte type = c.getDataStructureType();
                DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
                if( dsm == null )
                    throw new IOException("Unknown data type: "+type);
               
                if( tightEncodingEnabled ) {
View Full Code Here


        }
       
        int size=1;
        if( o != null) {
         
            DataStructure c = (DataStructure) o;
            byte type = c.getDataStructureType();
            DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
            if( dsm == null )
                throw new IOException("Unknown data type: "+type);

            if( tightEncodingEnabled ) {
View Full Code Here

     * Used by NIO or AIO transports
     */
    public int tightMarshal1(Object o, BooleanStream bs) throws IOException {
        int size=1;
        if( o != null) {
            DataStructure c = (DataStructure) o;
            byte type = c.getDataStructureType();
            DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
            if( dsm == null )
                throw new IOException("Unknown data type: "+type);

            size += dsm.tightMarshal1(this, c, bs);
View Full Code Here

        if( cacheEnabled ) {
            runMarshallCacheEvictionSweep();
        }
       
        if( o != null) {
            DataStructure c = (DataStructure) o;
            byte type = c.getDataStructureType();
            DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
            if( dsm == null )
                throw new IOException("Unknown data type: "+type);

            ds.writeByte(type);           
View Full Code Here

           
            byte dataType = dis.readByte();
            DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[dataType & 0xFF];
            if( dsm == null )
                throw new IOException("Unknown data type: "+dataType);
            DataStructure data = dsm.createObject();

            if( data.isMarshallAware() && bs.readBoolean() ) {
               
                dis.readInt();
                dis.readByte();
               
                BooleanStream bs2 = new BooleanStream();
View Full Code Here

           
            byte dataType = dis.readByte();
            DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[dataType & 0xFF];
            if( dsm == null )
                throw new IOException("Unknown data type: "+dataType);
            DataStructure data = dsm.createObject();
            dsm.looseUnmarshal(this, data, dis);
            return data;
           
        } else {
            return null;
View Full Code Here

   
    public void testReadAndWriteLotsOfCommands() throws Exception {
        System.out.println("Marshalling: " + commandCount + " objects");
        for (long i = 0; i < commandCount ; i++) {
            logProgress("Marshalling", i);
            DataStructure object = createDataStructure(i);
            writeObject(object);
        }
        ds.writeInt(endOfStreamMarker);
       
        // now lets read from the stream
        ds.close();
       
        System.out.println("Unmarshalling: " + commandCount + " objects");
       
        ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray());
        DataInputStream dis = new DataInputStream(in);
        for (long i = 0; i < commandCount ; i++) {
            logProgress("Unmarshalling", i);
            DataStructure command = null;
            try {
                command = (DataStructure) openWireformat.unmarshal(dis);
            }
            catch (Exception e) {
                e.printStackTrace();
View Full Code Here

        ConnectionContext context = new ConnectionContext(new NonCachedMessageEvaluationContext());

        // While we have records in the journal.
        while ((pos = journal.getNextRecordLocation(pos)) != null) {
            Packet data = journal.read(pos);
            DataStructure c = (DataStructure)wireFormat.unmarshal(toByteSequence(data));

            if (c instanceof Message) {
                Message message = (Message)c;
                JournalMessageStore store = (JournalMessageStore)createMessageStore(message.getDestination());
                if (message.isInTransaction()) {
                    transactionStore.addMessage(store, message, pos);
                } else {
                    store.replayAddMessage(context, message);
                    transactionCounter++;
                }
            } else {
                switch (c.getDataStructureType()) {
                case JournalQueueAck.DATA_STRUCTURE_TYPE: {
                    JournalQueueAck command = (JournalQueueAck)c;
                    JournalMessageStore store = (JournalMessageStore)createMessageStore(command.getDestination());
                    if (command.getMessageAck().isInTransaction()) {
                        transactionStore.removeMessage(store, command.getMessageAck(), pos);
View Full Code Here

        if (sequence == null) {

            int size = 1;
            if (command != null) {

                DataStructure c = (DataStructure)command;
                byte type = c.getDataStructureType();
                DataStreamMarshaller dsm = (DataStreamMarshaller)dataMarshallers[type & 0xFF];
                if (dsm == null) {
                    throw new IOException("Unknown data type: " + type);
                }
                if (tightEncodingEnabled) {
View Full Code Here

        }

        int size = 1;
        if (o != null) {

            DataStructure c = (DataStructure)o;
            byte type = c.getDataStructureType();
            DataStreamMarshaller dsm = (DataStreamMarshaller)dataMarshallers[type & 0xFF];
            if (dsm == null) {
                throw new IOException("Unknown data type: " + type);
            }
            if (tightEncodingEnabled) {
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.DataStructure

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.