Package net.timewalker.ffmq3.utils

Examples of net.timewalker.ffmq3.utils.RawDataBuffer


        // Start senders
        TopicPublisherThread[] senders = new TopicPublisherThread[params.senderCount];
        int totalExpected = params.messageCount*params.receiverCount;
        for (int n = 0 ; n < senders.length ; n++)
        {
            senders[n] = new TopicPublisherThread("Sender"+(n+1),
                                                  msgFactory,
                                                  startSynchro,
                                                  connection,
                                                  params.senderTransacted,
                                                  params.messageCount/params.senderCount,
View Full Code Here


        // Start senders
        TopicPublisherThread[] senders = new TopicPublisherThread[params.senderCount];
        int totalExpected = params.messageCount*params.receiverCount;
        for (int n = 0 ; n < senders.length ; n++)
        {
            senders[n] = new TopicPublisherThread("Sender"+(n+1),
                                                  msgFactory,
                                                  startSynchro,
                                                  sendersConnections[n],
                                                  params.senderTransacted,
                                                  params.messageCount/params.senderCount,
View Full Code Here

        // Start senders
        TopicPublisherThread[] senders = new TopicPublisherThread[params.senderCount];
        int totalExpected = params.messageCount*params.receiverCount;
        for (int n = 0 ; n < senders.length ; n++)
        {
            senders[n] = new TopicPublisherThread("Sender"+(n+1),
                                                  msgFactory,
                                                  startSynchro,
                                                  sendersConnections[n],
                                                  params.senderTransacted,
                                                  params.messageCount/params.senderCount,
View Full Code Here

          connection = createTopicConnection();
         
          // Start receivers
          TopicSubscriberThread[] receivers = new TopicSubscriberThread[params.receiverCount];
          for (int n = 0 ; n < receivers.length ; n++)
              receivers[n] = new TopicSubscriberThread("Receiver"+(n+1),
                                                   startSynchro,
                                                       connection,
                                                       params.receiverTransacted,
                                                       params.acknowledgeMode,
                                                       topic,
View Full Code Here

            receiverConnections[n] = createTopicConnection();
       
        // Start receivers
        TopicSubscriberThread[] receivers = new TopicSubscriberThread[params.receiverCount];
        for (int n = 0 ; n < receivers.length ; n++)
            receivers[n] = new TopicSubscriberThread("Receiver"+(n+1),
                                               startSynchro,
                                                   receiverConnections[n],
                                                   params.receiverTransacted,
                                                   params.acknowledgeMode,
                                                   topic,
View Full Code Here

{
    private static final int MSG_SIZE = 100;
   
    private byte[] serialize( AbstractMessage message ) throws Exception
    {
        RawDataBuffer buffer = new RawDataBuffer(1024);
        MessageSerializer.serializeTo(message, buffer);
        return buffer.toByteArray();
    }
View Full Code Here

        return buffer.toByteArray();
    }
   
    private AbstractMessage unserialize( byte[] data ) throws Exception
    {
        RawDataBuffer buffer = new RawDataBuffer(data);
        return MessageSerializer.unserializeFrom(buffer, false);
    }
View Full Code Here

  /**
     * Serialize a message
     */
    public static byte[] serialize( AbstractMessage message , int typicalSize )
    {
        RawDataBuffer rawMsg = message.getRawMessage();
        if (rawMsg != null)
            return rawMsg.toByteArray();

        RawDataBuffer buffer = new RawDataBuffer(typicalSize);
        buffer.writeByte(message.getType());
        message.serializeTo(buffer);
       
        return buffer.toByteArray();
    }
View Full Code Here

    /**
     * Unserialize a message
     */
    public static AbstractMessage unserialize( byte[] rawData , boolean asInternalCopy )
    {
      RawDataBuffer rawIn = new RawDataBuffer(rawData);
        byte type = rawIn.readByte();
        AbstractMessage message = MessageType.createInstance(type);
        message.initializeFromRaw(rawIn);
        if (asInternalCopy)
          message.setInternalCopy(true);
       
View Full Code Here

     * Serialize a message to the given output stream
     */
    public static void serializeTo( AbstractMessage message , RawDataBuffer out )
    {
        // Do we have a cached version of the raw message ?
      RawDataBuffer rawMsg = message.getRawMessage();
        if (rawMsg != null)
        {
          out.writeInt(rawMsg.size());
          rawMsg.writeTo(out);
        }
        else
        {
            // Serialize the message
          out.writeInt(0); // Write a dummy size
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.utils.RawDataBuffer

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.