private ObjectName makeRootObjectName(String name, ObjectID id) { try { return new ObjectName(DSO_OBJECT_NAME_PREFIX + "rootID=" + id.toLong()); } catch (MalformedObjectNameException e) { // this shouldn't happen throw new RuntimeException(e); } }
@Override public boolean equals(final Object o) { if (o instanceof Node) { final Node other = (Node) o; return this.id.equals(other.id); } return false; }
@Override public synchronized ObjectID next(ClientTransaction txn, Object pojo, GroupID gid) { long oidLong = -1; if (cachedObjectIds.size() > 0) { oidLong = this.cachedObjectIds.first(); this.cachedObjectIds.remove(oidLong); } else { oidLong = this.sequence.next(); } return new ObjectID(oidLong); }
public int getGroupID() { if (isNull()) { return 0; } // Null ObjectIDs are mapped to Group 0 long oid = toLong(); long gid = oid & 0xFF00000000000000L; gid = gid >>> 56; if ((gid < 0 || gid > 254)) { throw new AssertionError("Group ID is not between 0 and 254, the value was = " + gid + " id = " + toLong()); } return (int) gid; }
@Override public String toString() { if (toLong() == -1 || getGroupID() == 0) { return super.toString(); } return getIdentifierType() + "=" + "[" + getGroupID() + ":" + getMaskedObjectID() + "]"; }
@Override public boolean add(ObjectID id) { if ( start == end ) { start = id.getMaskedObjectID(); end = id.getMaskedObjectID() + 1; return false; } if ( id.getMaskedObjectID() < start ) { return left.add(id); } if ( id.getMaskedObjectID() >= end ) { for (long x=end;x<id.getMaskedObjectID();x++) { super.add(new ObjectID(x)); } end = id.getMaskedObjectID() + 1; return false; } else { return !super.remove(id); } }
public synchronized void addRoot(String name, ObjectID oid) { GroupID gid = new GroupID(oid.getGroupID()); Map<String, ObjectID> roots = groupToRoots.get(gid); if (roots == null) { roots = new HashMap<String, ObjectID>(); groupToRoots.put(gid, roots); } roots.put(name, oid); }
public synchronized DNA basicRetrieve(final ObjectID id, final int depth) throws AbortedOperationException { boolean isInterrupted = false; if (id.getGroupID() != this.groupID.toInt()) { throw new AssertionError("Looking up in the wrong Remote Manager : " + this.groupID + " id : " + id + " depth : " + depth); } } else if (ols.isMissing()) { this.objectLookupStates.remove(id); throw new TCObjectNotFoundException(id.toString()); } else if (ols.isPrefetch()) { ols.makeLookupRequest();
public void addReachableObjectIDs(final Set<ObjectID> objectReferences) { if (this.maxReachableObjects <= 0) { return; } for (final ObjectID oid : objectReferences) { if (oid.isNull()) { continue; } final Object state = this.oids.get(oid); if (state == null) { this.oids.put(oid, State.REACHABLE); } } }
public synchronized void destroyKeyValueStorage(ObjectID oid) { storageManager.destroyKeyValueStorage(oid.toString()); } }
@Override public boolean contains(ObjectID id) { if ( id.getMaskedObjectID() < start ) { return left.contains(id); } if ( id.getMaskedObjectID() >= end ) { return false; } return !super.contains(id); }
public int getGroupID() { if (isNull()) { return 0; } // Null ObjectIDs are mapped to Group 0 long oid = toLong(); long gid = oid & 0xFF00000000000000L; gid = gid >>> 56; if ((gid < 0 || gid > 254)) { throw new AssertionError("Group ID is not between 0 and 254, the value was = " + gid + " id = " + toLong()); } return (int) gid; }
@Override public String toString() { if (toLong() == -1 || getGroupID() == 0) { return super.toString(); } return getIdentifierType() + "=" + "[" + getGroupID() + ":" + getMaskedObjectID() + "]"; }
public synchronized void addRoot(String name, ObjectID oid) { GroupID gid = new GroupID(oid.getGroupID()); Map<String, ObjectID> roots = groupToRoots.get(gid); if (roots == null) { roots = new HashMap<String, ObjectID>(); groupToRoots.put(gid, roots); } roots.put(name, oid); }
public synchronized DNA basicRetrieve(final ObjectID id, final int depth, final ObjectID parentContext) throws AbortedOperationException { boolean isInterrupted = false; if (id.getGroupID() != this.groupID.toInt()) { throw new AssertionError("Looking up in the wrong Remote Manager : " + this.groupID + " id : " + id + " depth : " + depth + " parent : " } else if (ols.isMissing()) { this.objectLookupStates.remove(id); throw new TCObjectNotFoundException(id.toString()); } else if (ols.isPrefetch()) { ols.makeLookupRequest();
public void addRequiredObjectIDs(final Set<ObjectID> objectReferences) { for (final ObjectID oid : objectReferences) { if (oid.isNull()) { continue; } final Object state = this.oids.get(oid); if (state == null || state == State.REACHABLE) { this.oids.put(oid, State.REQUIRED); } } }
public synchronized KeyValueStorage<Object, Object> getKeyValueStorage(ObjectID objectID, final boolean create) throws ObjectNotFoundException { KeyValueStorage<Object, Object> map = storageManager.getKeyValueStorage(objectID.toString(), Object.class, Object.class); if (map == null) { if (create) { map = storageManager.createKeyValueStorage(objectID.toString(), defaultConfig); } else { throw new ObjectNotFoundException("Map for object id " + objectID + " not found."); } } return map; }
@Override public boolean add(ObjectID id) { if ( start == end ) { start = id.getMaskedObjectID(); end = id.getMaskedObjectID() + 1; return false; } if ( id.getMaskedObjectID() < start ) { return left.add(id); } if ( id.getMaskedObjectID() >= end ) { for (long x=end;x<id.getMaskedObjectID();x++) { super.add(new ObjectID(x)); } end = id.getMaskedObjectID() + 1; return false; } else { return !super.remove(id); } }
@Override public boolean contains(ObjectID id) { if ( id.getMaskedObjectID() < start ) { return left.contains(id); } if ( id.getMaskedObjectID() >= end ) { return false; } return !super.contains(id); }
@Override public void serialize(ObjectOutput out) throws IOException { out.writeLong(version); out.writeLong(oid.toLong()); }