Examples of ByteArrayPacket


Examples of org.activeio.packet.ByteArrayPacket

        if( isDisabled() ) {
            log.info("test disabled: "+getName());
            return;
        }
        log.info("Start of testManySmallSendReceives");
        Packet outboundPacket = new ByteArrayPacket("Hello World".getBytes());
        long start = System.currentTimeMillis();
        for( int i=0; i < getTestIterations(); i++ ) {
            doSendReceive(outboundPacket.duplicate());
        }
        long end = System.currentTimeMillis();       
        log.info("done. Duration: "+duration(start,end)+", duration per send: "+unitDuration(start, end, getTestIterations()));
    }
View Full Code Here

Examples of org.activeio.packet.ByteArrayPacket

     * @throws IOException
     * @throws URISyntaxException
     * @throws InterruptedException
     */
    private void doSendReceive(final Packet outboundPacket) throws IOException, URISyntaxException, InterruptedException {
        ByteArrayPacket inboundPacket = new ByteArrayPacket(new byte[outboundPacket.remaining()]);

        // Do the send async.
        sendExecutor.execute( new Runnable() {
            public void run() {
                try {
                    clientChannel.write(outboundPacket);
                    clientChannel.flush();
                } catch (IOException e) {
                }
            }
        });
       
        while( inboundPacket.hasRemaining() ) {
          Packet packet = serverChannel.read(1000*5);
          assertNotNull(packet);
          packet.read(inboundPacket);
        }       
        outboundPacket.clear();
        inboundPacket.clear();
        assertEquals(outboundPacket.sliceAsBytes(), inboundPacket.sliceAsBytes());
               
    }
View Full Code Here

Examples of org.activeio.packet.ByteArrayPacket

       
        if( syncFrequency>=0 && (i%syncFrequency)==0 ) {
          sync=true;
        }       
        try {
          journal.write(new ByteArrayPacket(data), sync);
          Thread.sleep(workerThinkTime);
        } catch (Exception e) {
          e.printStackTrace();
          return;
        }
View Full Code Here

Examples of org.apache.activeio.packet.ByteArrayPacket

    public Packet read(RecordLocation location) throws InvalidRecordLocationException, IOException, IllegalStateException {
        ByteSequence rc = dataManager.read(convertFromRecordLocation(location));
        if (rc == null) {
            return null;
        }
        return new ByteArrayPacket(rc.getData(), rc.getOffset(), rc.getLength());
    }
View Full Code Here

Examples of org.apache.activeio.packet.ByteArrayPacket

            throw new IllegalArgumentException("The journal does not support message references.");
        }
    }

    public Packet toPacket(ByteSequence sequence) {
        return new ByteArrayPacket(new org.apache.activeio.packet.ByteSequence(sequence.data, sequence.offset, sequence.length));
    }
View Full Code Here

Examples of org.apache.activeio.packet.ByteArrayPacket

    /**
     * @param string
     * @return
     */
    private Packet createPacket(String string) {
        return new ByteArrayPacket(string.getBytes());
    }
View Full Code Here

Examples of org.apache.activeio.packet.ByteArrayPacket

            throw new IllegalArgumentException("The journal does not support message references.");
        }
    }

    public Packet toPacket(ByteSequence sequence) {
        return new ByteArrayPacket(new org.apache.activeio.packet.ByteSequence(sequence.data, sequence.offset, sequence.length));
    }
View Full Code Here

Examples of org.apache.activeio.packet.ByteArrayPacket

            throw new IllegalArgumentException("The journal does not support message references.");
        }
    }

    public Packet toPacket(ByteSequence sequence) {
        return new ByteArrayPacket(new org.apache.activeio.packet.ByteSequence(sequence.data, sequence.offset, sequence.length));
    }
View Full Code Here

Examples of org.apache.activeio.packet.ByteArrayPacket

    /**
     * @param string
     * @return
     */
    private Packet createPacket(String string) {
        return new ByteArrayPacket(string.getBytes());
    }
View Full Code Here

Examples of org.apache.activeio.packet.ByteArrayPacket

            throw new IllegalArgumentException("The journal does not support message references.");
        }
    }

    public Packet toPacket(ByteSequence sequence) {
        return new ByteArrayPacket(new org.apache.activeio.packet.ByteSequence(sequence.data, sequence.offset, sequence.length));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.