Package com.cloudhopper.mq.util

Examples of com.cloudhopper.mq.util.Tiny


    private byte[] getMetadata(PriorityMQMessage<T> msg) {
  byte[] logItemIdentifier = msg.getLogItemIdentifier().getBytes();
  byte[] b = new byte[14+logItemIdentifier.length];
  ByteBuffer buf = ByteBuffer.wrap(b);
  buf.put(msg.getPriority().byteValue());
  buf.put(new Tiny(msg.getSequence()).byteValue());
  buf.putLong(msg.getTimestamp());
  buf.putShort(msg.getTransferAttemptsCount());
  buf.putShort(msg.getTransferCount());
  buf.put(logItemIdentifier);
  return b;
View Full Code Here


  short transferAttempts = buf.getShort(); //2
  short transfers = buf.getShort(); //2
  byte[] b = new byte[meta.length-14];
  buf.get(b);
  String logItemIdentifier = new String(b);
  return new PriorityMQMessage<T>(transferAttempts, transfers, logItemIdentifier, new Priority(priority), timestamp, new Tiny(sequence).intValue());
    }
View Full Code Here

    /**
     * Sets the sequence number. Will throw an IllegalArgumentException for values > 255
     */
    public void setSequence(int seq) {
  this.sequence = new Tiny(seq);
    }
View Full Code Here

      buf.get(b);
      for (int i = 0; i < b.length; i++) {
    value = (value << 8) + (b[i] & 0xff);
      }
      this._timestamp = value;
      this._sequence = new Tiny(buf.get());
  }
View Full Code Here

  public static Key fromCompactString(String s) {
      String[] es = s.split(":");
      if (es.length != 3) throw new IllegalArgumentException("Must be compact string representation of Key.");
      return new Key(new Priority(Integer.parseInt(es[0])),
         Long.parseLong(es[1]),
         new Tiny(Integer.parseInt(es[2])));
  }
View Full Code Here

    /**
     * Sets the sequence number. Will throw an IllegalArgumentException for values > 255
     */
    public void setSequence(int seq) {
  this.sequence = new Tiny(seq);
    }
View Full Code Here

      buf.get(b);
      for (int i = 0; i < b.length; i++) {
    value = (value << 8) + (b[i] & 0xff);
      }
      this._timestamp = value;
      this._sequence = new Tiny(buf.get());
  }
View Full Code Here

TOP

Related Classes of com.cloudhopper.mq.util.Tiny

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.