public ObjectLookupState(final TCObject set) { this.objectID = set.getObjectID(); this.object = set; this.isSet = true; this.owner = null; this.session = currentSession; }
public LockID generateLockIdentifier(final Object obj, final String fieldName) { TCObject tco; if (obj instanceof TCObject) { tco = (TCObject) obj; } else { tco = this.mgr.lookupExistingOrNull(obj); } if ((tco == null) || tco.autoLockingDisabled()) { return UnclusteredLockID.UNCLUSTERED_LOCK_ID; } else { return new DsoVolatileLockID(tco.getObjectID(), fieldName); } }
private TCChangeBuffer getOrCreateChangeBuffer(TCObject object) { addReferenced(object.getPeerObject()); ObjectID oid = object.getObjectID(); TCChangeBuffer cb = objectChanges.get(oid); if (cb == null) { cb = new TCChangeBufferImpl(object); objectChanges.put(oid, cb); } return cb; }
public void remove(final TCObject tcobj) { if (tcobj instanceof TCObjectSelf) { throw new AssertionError( "TCObjectSelf should not have called removed from here: " + tcobj); } if (tcobj.isCacheManaged()) { this.cache.remove(tcobj); } else { this.cacheUnmanaged.remove(tcobj.getObjectID()); } }
final Object obj = tcobj == null ? null : tcobj.getPeerObject(); l.add(obj); if (obj != null) { this.tcObjectSelfStore.removeObjectById(tcobj.getObjectID()); } else { tcobj.hydrate(dna, force, null);
disableTransactionLogging(); final Object pojo = source.getPeerObject(); ClientTransaction tx; tco.markAccessed(); parameters[i] = tco.getObjectID(); if (p != null) {
final TCChangeBuffer changeBuffer = (TCChangeBuffer) i.next(); final TCObject tco = changeBuffer.getTCObject(); if (tco.isNew()) { if (DEBUG) { logger.info("isNew for " + tco.getObjectID()); final ObjectID oid = tco.getObjectID(); final FoldingKey key = (FoldingKey) this.foldingKeys.get(oid); if (key == null) {
final TCObject removed = (TCObject) i.next(); if (removed != null) { final Object pr = removed.getPeerObject(); if (pr != null) { final int cleared; try { cleared = removed.clearReferences(toClear); } finally { this.clientTxManager.enableTransactionLogging(); this.logger.debug("Clearing:" + removed.getObjectID() + " class:" + pr.getClass() + " Total cleared = " + totalReferencesCleared);
final boolean isNew = tco.isNew(); final TCClass tcc = tco.getTCClass(); writer = new DNAWriterImpl(this.output, oid, tcc.getExtendingClassName(), this.serializer, this.encoding, !isNew); tco.dehydrate(writer); tco.setNotNew(); logger.error("not sending meta data attached to \"new\" object of type " + tco.getTCClass().getName());
public int __tc_clearReferences(int toClear) { if (!__tc_isManaged()) { throw new AssertionError("clearReferences() called on Unmanaged Map"); } int cleared = 0; for (Object key : store.keySet()) { Object v = store.get(key); TCObject tcObject = ManagerUtil.lookupExistingOrNull(v); if (tcObject != null && !tcObject.recentlyAccessed()) { ObjectID oid = tcObject.getObjectID(); if (store.replace(key, v, oid) && (++cleared == toClear)) break; } } return cleared; }
@Override public void hydrate(final TCObject tcObject, final DNA dna, final Object pojo, final boolean force) throws IOException, ClassNotFoundException { // Okay...long story here The application of the DNA used to be a synchronized(applicator) block. As best as Steve // and I could tell, the synchronization was solely a memory boundary and not a mutual exlusion mechanism. For the // time being, we have resolved that we need no synchronization here (either for memory, or exclusion). The memory // barrier aspect isn't known to be a problem and the concurrency is handled by the server (ie. we won't get // concurrent updates). At some point it would be a good idea to detect (and error out) when updates are received // from L2 but local read/writes have been made on the target TCObject final long localVersion = tcObject.getVersion(); final long dnaVersion = dna.getVersion(); if (force || (localVersion < dnaVersion)) { tcObject.setVersion(dnaVersion); this.applicator.hydrate(this.objectManager, tcObject, dna, pojo); } else if (logger.isDebugEnabled()) { logger .debug("IGNORING UPDATE, local object at version " + localVersion + ", dna update is version " + dnaVersion); } }
private void logicalAddAllInvoke(final Collection<?> collection, final TCObject tcobj) { for (Object obj : collection) { tcobj.logicalInvoke(LogicalOperation.ADD, new Object[] { obj }); } }
@Override public boolean shouldTraverse(final Object object) { // literals should be skipped -- without this check, literal members (field values, array element values, in // collection, etc) of newly shared instances would get TCObjects and ObjectIDs assigned to them. if (LiteralValues.isLiteralInstance(object)) { return false; } final TCObject tco = basicLookup(object); if (tco == null) { return true; } return tco.isNew(); }
private Object lookupObject(final ObjectID objectID, final boolean noDepth, final boolean quiet) throws ClassNotFoundException, AbortedOperationException { if (objectID.isNull()) { return null; } Object o = null; while (o == null) { final TCObject tco = lookup(objectID, noDepth, quiet); if (tco == null) { throw new AssertionError("TCObject was null for " + objectID);// continue; } o = tco.getPeerObject(); if (o == null) { reap(objectID); } } return o; }
public void hydrate(final ClientObjectManager objMgr, final TCObject tco, final DNA dna, final Object pojo) throws IOException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); while (cursor.next(encoding)) { PhysicalAction a = cursor.getPhysicalAction(); if (a.isEntireArray()) { tco.setValue(VALUE_FIELD, a.getObject()); } else { tco.setValue(a.getFieldName(), a.getObject()); } } } }
private TCObject createObjectWithDNA(DNA dna) throws ClassNotFoundException { TCObject obj = null; Class clazz = this.classProvider.getClassFor(dna.getTypeName()); TCClass tcClazz = clazzFactory.getOrCreate(clazz, this); Object pojo = createNewPojoObject(tcClazz, dna); obj = this.factory.getNewInstance(dna.getObjectID(), pojo, clazz, false); Assert.assertFalse(dna.isDelta()); // now hydrate the object, this could call resolveReferences which would call this method recursively if (obj instanceof TCObjectSelf) { obj.hydrate(dna, false, null); } else { obj.hydrate(dna, false, newWeakObjectReference(dna.getObjectID(), pojo)); } basicAddLocal(obj); return obj; }
final Object obj = tcobj == null ? null : tcobj.getPeerObject(); l.add(obj); if (obj != null) { this.tcObjectSelfStore.removeObjectById(tcobj.getObjectID()); } else { tcobj.hydrate(dna, force, null);
disableTransactionLogging(); final Object pojo = source.getPeerObject(); ClientTransaction tx; tco.markAccessed(); parameters[i] = tco.getObjectID(); if (p != null) {
final TCChangeBuffer changeBuffer = (TCChangeBuffer) i.next(); final TCObject tco = changeBuffer.getTCObject(); if (tco.isNew()) { if (DEBUG) { logger.info("isNew for " + tco.getObjectID()); final ObjectID oid = tco.getObjectID(); final FoldingKey key = (FoldingKey) this.foldingKeys.get(oid); if (key == null) {
final boolean isNew = tco.isNew(); final TCClass tcc = tco.getTCClass(); writer = new DNAWriterImpl(this.output, oid, tcc.getExtendingClassName(), this.serializer, this.encoding, !isNew); tco.dehydrate(writer); tco.setNotNew(); logger.error("not sending meta data attached to \"new\" object of type " + tco.getTCClass().getName());