@Override public Object lookupObject(final ObjectID id, final ObjectID parentContext) throws ClassNotFoundException, AbortedOperationException { return this.objectManager.lookupObject(id, parentContext); }
@Override public void addMetaData(MetaDataDescriptor mdd) { this.objectManager.getTransactionManager().addMetaDataDescriptor(this, (MetaDataDescriptorInternal) mdd); }
@Override public boolean isObjectCreationInProgress() { return this.clientObjectManager.isCreationInProgress(); }
@Override public void dehydrate(ClientObjectManager objectManager, TCObject tcObject, DNAWriter writer, Object pojo) { if (!objectManager.isPortableInstance(pojo)) { return; } writer.addLiteralValue(pojo); }
if (!isLiteral) { if (p != null) { this.clientObjectManager.checkPortabilityOfLogicalAction(method, parameters, i, pojo); final TCObject tco = this.clientObjectManager.lookupOrCreate(p); parameters[i] = tco.getObjectID(); if (p != null) {
if (!LiteralValues.isLiteralInstance(element)) { if (element != null) { this.clientObjectManager.checkPortabilityOfField(element, String.valueOf(i), pojo); final TCObject tco = this.clientObjectManager.lookupOrCreate(element); objArray[i] = tco.getObjectID();
private TCObject lookupExistingOrNull(Object obj) { return objectManager.lookupExistingOrNull(obj); }
@Override public TCObject lookupOrCreate(final Object obj, GroupID gid) { if (obj instanceof Manageable) { TCObject tco = ((Manageable) obj).__tc_managed(); if (tco != null) { return tco; } } return this.objectManager.lookupOrCreate(obj, gid); }
@Override public void literalValueChanged(Object newValue, Object oldValue) { Assert.eval(newValue != null); getObjectManager().getTransactionManager().literalValueChanged(this, newValue, oldValue); setPeerObject(getObjectManager().newWeakObjectReference(getObjectID(), newValue)); }
@Override public boolean distributedInvoke(Object receiver, String method, Object[] params, boolean runOnAllNodes) { if (feedBack.get() != null) { return false; } if (nesting.get() != null) { return false; } nesting.set(TRUE); Assert.pre(receiver != null); Assert.pre(method != null); Assert.pre(params != null); final String methodName = method.substring(0, method.indexOf('(')); final String paramDesc = method.substring(method.indexOf('(')); final DistributedMethodCall dmc = new DistributedMethodCall(receiver, params, methodName, paramDesc); objMgr.getTransactionManager().begin(lock, LockLevel.CONCURRENT, false); try { final ObjectID receiverId = objMgr.lookupOrCreate(receiver).getObjectID(); final ObjectID dmiCallId = objMgr.lookupOrCreate(dmc).getObjectID(); final DmiClassSpec[] classSpecs = getClassSpecs(classProvider, receiver, params); final DmiDescriptor dd = new DmiDescriptor(receiverId, dmiCallId, classSpecs, runOnAllNodes); objMgr.getTransactionManager().addDmiDescriptor(dd); return true; } finally { try { objMgr.getTransactionManager().commit(lock, LockLevel.CONCURRENT, false, null); } catch (UnlockedSharedObjectException e) { throw new TCRuntimeException(e); } catch (AbortedOperationException e) { throw new TCRuntimeException(e); } } }
private void updateLocalCacheIfNecessary(final Object key, final Object value) { // Null values (i.e. cache misses) & literal values are not cached locally if (value != null && !LiteralValues.isLiteralInstance(value)) { if (isEventual) { // addEventualValueToCache(key, value, this.objectManager.lookupExistingObjectID(value), MapOperationType.GET); } else { addIncoherentValueToCache(key, value, this.objectManager.lookupExistingObjectID(value), MapOperationType.GET); } } }
private int clearArrayReferences(Object[] array) { int cleared = 0; int l = array.length; for (int i = 0; i < l; i++) { Object o = array[i]; if (o == null) continue; if (getObjectManager().isManaged(o)) { ObjectID lid = getObjectManager().lookupExistingObjectID(o); ObjectID old = setReference(Integer.toString(i), lid); if (old != null && !lid.equals(old)) { // Formatting throw new AssertionError("clearArrayReferences : mapped [" + i + "] to " + lid + " while there was an exisiting mapping in references : " + old + " : TCObject = " + getObjectID() + " : " + this + " version = " + this.getVersion()); } array[i] = null; cleared++; } } return cleared; }
private TCObjectServerMapImpl lookupTCObjectServerMapImpl(final ObjectID mapID) throws AbortedOperationException { try { return (TCObjectServerMapImpl) this.objectManager.lookup(mapID); } catch (ClassNotFoundException e) { throw new RuntimeException("ClassNotFoundException for mapID " + mapID); } }
private Object lookupValue(final CompoundResponse value) throws TCObjectNotFoundException, AbortedOperationException { try { final ObjectID oid = (value.getData() instanceof ObjectID) ? (ObjectID)value.getData() : ((DNA)value.getData()).getObjectID(); if (oid.isNull()) { return null; } final Object returnValue = this.objectManager.lookupObjectQuiet(oid); if (returnValue instanceof ExpirableMapEntry) { ExpirableMapEntry expirableMapEntry = (ExpirableMapEntry)returnValue; expirableMapEntry.setCreationTime(value.getCreationTime()); expirableMapEntry.setLastAccessedTime(value.getLastAccessedTime()); expirableMapEntry.setTimeToIdle(value.getTimeToIdle()); expirableMapEntry.setTimeToLive(value.getTimeToLive()); } return returnValue; } catch (final ClassNotFoundException e) { logger.warn("Got ClassNotFoundException for objectId: " + value + ". Ignoring exception and returning null"); return null; } }
private boolean isPortable(MemberValue value) { Object valueObject = value.getValueObject(); if (valueObject != null) return objMgr.isPortableInstance(valueObject); return true; }
if (!isLiteral) { if (p != null) { this.clientObjectManager.checkPortabilityOfLogicalAction(parameters, i, methodName, pojo); final TCObject tco = this.clientObjectManager.lookupOrCreate(p); tco.markAccessed(); parameters[i] = tco.getObjectID();
if (!LiteralValues.isLiteralInstance(element)) { if (element != null) { this.clientObjectManager.checkPortabilityOfField(element, String.valueOf(i), pojo); final TCObject tco = this.clientObjectManager.lookupOrCreate(element); objArray[i] = tco.getObjectID();
@Override public TCObject lookupExistingOrNull(final Object pojo) { if (pojo == null) { return null; } if (pojo instanceof Manageable) { return ((Manageable) pojo).__tc_managed(); } try { return this.objectManager.lookupExistingOrNull(pojo); } catch (final Throwable t) { Util.printLogAndRethrowError(t, logger); // shouldn't get here throw new AssertionError(); } }
@Override public TCObject lookupOrCreate(final Object obj, GroupID gid) { if (obj instanceof Manageable) { TCObject tco = ((Manageable) obj).__tc_managed(); if (tco != null) { return tco; } } return this.objectManager.lookupOrCreate(obj, gid); }
@Override public void literalValueChanged(Object newValue, Object oldValue) { Assert.eval(newValue != null); getObjectManager().getTransactionManager().literalValueChanged(this, newValue, oldValue); setPeerObject(getObjectManager().newWeakObjectReference(getObjectID(), newValue)); }