/** * Generate a unique cluster id, similar to the machine id field in MongoDB ObjectId objects. * * @return the unique machine id */ public static int getUniqueClusterId() { ObjectId objId = new ObjectId(); return objId._machine(); }
private static Id fromObjectId(ObjectId objectId) { return of( objectId._time(), objectId._machine(), objectId._inc()); }
protected void putObjectId(String name, ObjectId oid) { _put(OID, name); // according to spec, values should be stored big endian _buf.writeIntBE(oid._time()); _buf.writeIntBE(oid._machine()); _buf.writeIntBE(oid._inc()); }
protected void putObjectId(String name, ObjectId oid) { this._put(7, name); this._buf.writeIntBE(oid._time()); this._buf.writeIntBE(oid._machine()); this._buf.writeIntBE(oid._inc()); }