Refine search
public void checkIfActive() { final ODatabaseRecordThreadLocal tl = ODatabaseRecordThreadLocal.instance(); ODatabaseDocumentInternal currentDatabase = tl != null ? tl.get() : null; if (currentDatabase instanceof ODatabaseDocumentTx) { currentDatabase = ((ODatabaseDocumentTx) currentDatabase).internal; } if (currentDatabase != this) throw new IllegalStateException( "The current database instance (" + toString() + ") is not active on the current thread (" + Thread.currentThread() + "). Current active database is: " + currentDatabase); }
public static ODatabaseDocumentInternal getGraphDatabase(final ODatabaseDocumentInternal iCurrentDatabase) { ODatabaseDocumentInternal currentDb = ODatabaseRecordThreadLocal.instance().get(); if (currentDb == null && iCurrentDatabase != null) // GET FROM THE RECORD currentDb = iCurrentDatabase; if (currentDb != null) currentDb = (ODatabaseDocumentInternal) currentDb.getDatabaseOwner(); return currentDb; }
public ORidBagUpdateSerializationOperation(final NavigableMap<OIdentifiable, Change> changedValues, OBonsaiCollectionPointer collectionPointer) { this.changedValues = changedValues; this.collectionPointer = collectionPointer; collectionManager = ODatabaseRecordThreadLocal.instance().get().getSbTreeCollectionManager(); }
public ODocumentComparator(final List<OPair<String, String>> iOrderCriteria, OCommandContext iContext) { this.orderCriteria = iOrderCriteria; this.context = iContext; ODatabaseDocumentInternal internal = ODatabaseRecordThreadLocal.instance().get(); collator = Collator.getInstance(new Locale(internal.get(ATTRIBUTES.LOCALECOUNTRY) + "_" + internal.get(ATTRIBUTES.LOCALELANGUAGE))); }
/** * (Blueprints Extension) Locks current Element to prevent concurrent access. If lock is exclusive, then no concurrent threads can * read/write it. If the lock is shared, then concurrent threads can only read Element properties, but can't change them. Locks * can be freed by calling @unlock or when the current transaction is closed (committed or rollbacked). * * @param iExclusive True = Exclusive Lock, False = Shared Lock * @see #lock(boolean) */ @Override public void lock(final boolean iExclusive) { ODatabaseRecordThreadLocal.instance().get().getTransaction() .lockRecord(this, iExclusive ? OStorage.LOCKING_STRATEGY.EXCLUSIVE_LOCK : OStorage.LOCKING_STRATEGY.SHARED_LOCK); }
@Override public void startup() { ODatabaseDocument db = ODatabaseRecordThreadLocal.instance().get(); profilerPrefix = "db." + db.getName() + ".cache.level1."; profilerMetadataPrefix = "db.*.cache.level1."; CACHE_HIT = profilerPrefix + "cache.found"; CACHE_MISS = profilerPrefix + "cache.notFound"; super.startup(); }