/** * Sets long at specified position. * * @param pos Specified position. * @param l Long to set. */ public void set(int pos, long l) { assert pos >= 0; assert pos + 8 <= size; U.longToBytes(l, data, pos); }
/** * Converts message to bytes to send over network. * * @return Bytes representing this packet. */ public byte[] toBytes() { byte[] buf = new byte[PACKET_SIZE]; int off = 0; off = U.longToBytes(origNodeId.getLeastSignificantBits(), buf, off); off = U.longToBytes(origNodeId.getMostSignificantBits(), buf, off); off = U.longToBytes(targetNodeId.getLeastSignificantBits(), buf, off); off = U.longToBytes(targetNodeId.getMostSignificantBits(), buf, off); off = U.longToBytes(origTs, buf, off); off = U.longToBytes(replyTs, buf, off); assert off == PACKET_SIZE; return buf; }
/** * Appends long to the next 8 bytes of list. * * @param l Long to append. */ public void add(long l) { requestFreeSize(8); U.longToBytes(l, data, size); size += 8; }
/** * Converts GridUuid to bytes. * * @param uuid GridUuid to convert. * @param out Output array to write to. * @param off Offset from which to write. */ public static void gridUuidToBytes(GridUuid uuid, byte[] out, int off) { assert uuid != null; U.longToBytes(uuid.globalId().getMostSignificantBits(), out, off); U.longToBytes(uuid.globalId().getLeastSignificantBits(), out, off + 8); U.longToBytes(uuid.localId(), out, off + 16); }
/** * Creates new header with given request ID and command. * * @param reqId Request ID. * @param cmd Command. * @return Created header. */ public static byte[] fillHeader(byte[] hdr, long reqId, GridGgfsIpcCommand cmd) { assert cmd != null; Arrays.fill(hdr, (byte)0); U.longToBytes(reqId, hdr, 0); U.intToBytes(cmd.ordinal(), hdr, 8); return hdr; }
/** * Creates new header with given request ID and command. * * @param reqId Request ID. * @param cmd Command. * @return Created header. */ public static byte[] fillHeader(byte[] hdr, long reqId, GridGgfsIpcCommand cmd) { assert cmd != null; Arrays.fill(hdr, (byte)0); U.longToBytes(reqId, hdr, 0); U.intToBytes(cmd.ordinal(), hdr, 8); return hdr; }
/** * Creates new header with given request ID and command. * * @param reqId Request ID. * @param cmd Command. * @return Created header. */ public static byte[] createHeader(long reqId, GridGgfsIpcCommand cmd) { assert cmd != null; byte[] hdr = new byte[HEADER_SIZE]; U.longToBytes(reqId, hdr, 0); U.intToBytes(cmd.ordinal(), hdr, 8); return hdr; }
/** * Creates new header with given request ID and command. * * @param reqId Request ID. * @param cmd Command. * @return Created header. */ public static byte[] createHeader(long reqId, GridGgfsIpcCommand cmd) { assert cmd != null; byte[] hdr = new byte[HEADER_SIZE]; U.longToBytes(reqId, hdr, 0); U.intToBytes(cmd.ordinal(), hdr, 8); return hdr; }
data = U.longToBytes((Long)obj); data = U.longToBytes(((Date)obj).getTime()); data = U.longToBytes(Double.doubleToLongBits((Double)obj));
data = U.longToBytes((Long)obj); data = U.longToBytes(((Date)obj).getTime()); data = U.longToBytes(Double.doubleToLongBits((Double)obj));
out.write(U.longToBytes(ldrId));
/** * Converts cache version to byte array. * * @param ver Version. * @return Byte array. */ public static byte[] versionToBytes(GridCacheVersion ver) { assert ver != null; byte[] bytes = new byte[28]; U.intToBytes(ver.topologyVersion(), bytes, 0); U.longToBytes(ver.globalTime(), bytes, 4); U.longToBytes(ver.order(), bytes, 12); U.intToBytes(ver.nodeOrderAndDrIdRaw(), bytes, 20); return bytes; }
off = U.intToBytes(metrics.getTotalCancelledJobs(), data , off); off = U.intToBytes(metrics.getTotalExecutedJobs(), data , off); off = U.longToBytes(metrics.getMaximumJobWaitTime(), data, off); off = U.longToBytes(metrics.getCurrentJobWaitTime(), data, off); off = U.doubleToBytes(metrics.getAverageJobWaitTime(), data, off); off = U.longToBytes(metrics.getMaximumJobExecuteTime(), data, off); off = U.longToBytes(metrics.getCurrentJobExecuteTime(), data, off); off = U.doubleToBytes(metrics.getAverageJobExecuteTime(), data, off); off = U.intToBytes(metrics.getTotalExecutedTasks(), data, off); off = U.longToBytes(metrics.getCurrentIdleTime(), data, off); off = U.longToBytes(metrics.getTotalIdleTime(), data , off); off = U.intToBytes(metrics.getTotalCpus(), data, off); off = U.doubleToBytes(metrics.getCurrentCpuLoad(), data, off); off = U.doubleToBytes(metrics.getAverageCpuLoad(), data, off); off = U.doubleToBytes(metrics.getCurrentGcCpuLoad(), data, off); off = U.longToBytes(metrics.getHeapMemoryInitialized(), data, off); off = U.longToBytes(metrics.getHeapMemoryUsed(), data, off); off = U.longToBytes(metrics.getHeapMemoryCommitted(), data, off); off = U.longToBytes(metrics.getHeapMemoryMaximum(), data, off); off = U.longToBytes(metrics.getNonHeapMemoryInitialized(), data, off); off = U.longToBytes(metrics.getNonHeapMemoryUsed(), data, off); off = U.longToBytes(metrics.getNonHeapMemoryCommitted(), data, off); off = U.longToBytes(metrics.getNonHeapMemoryMaximum(), data, off); off = U.longToBytes(metrics.getStartTime(), data, off); off = U.longToBytes(metrics.getNodeStartTime(), data, off); off = U.longToBytes(metrics.getUpTime(), data, off); off = U.intToBytes(metrics.getCurrentThreadCount(), data, off); off = U.intToBytes(metrics.getMaximumThreadCount(), data, off); off = U.longToBytes(metrics.getTotalStartedThreadCount(), data, off);
U.longToBytes(req.streamId(), hdr, 12);
U.longToBytes(req.streamId(), hdr, 12);