@Override public OTransaction getTransaction() { checkOpenness(); return internal.getTransaction(); }
public DISTRIBUTED_EXECUTION_MODE getDistributedExecutionMode() { return query != null && !getDatabase().getTransaction().isActive() ? DISTRIBUTED_EXECUTION_MODE.REPLICATE : DISTRIBUTED_EXECUTION_MODE.LOCAL; }
public DISTRIBUTED_EXECUTION_MODE getDistributedExecutionMode() { return query != null && !getDatabase().getTransaction().isActive() ? DISTRIBUTED_EXECUTION_MODE.REPLICATE : DISTRIBUTED_EXECUTION_MODE.LOCAL; }
public DISTRIBUTED_EXECUTION_MODE getDistributedExecutionMode() { return query != null && !getDatabase().getTransaction().isActive() ? DISTRIBUTED_EXECUTION_MODE.REPLICATE : DISTRIBUTED_EXECUTION_MODE.LOCAL; }
@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 unlock() { ODatabaseRecordThreadLocal.instance().get().getTransaction().unlockRecord(this); }
/** * (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 boolean isLocked() { return ODatabaseRecordThreadLocal.instance().get().getTransaction().isLockedRecord(this); }
@Override public OStorage.LOCKING_STRATEGY lockingStrategy() { return ODatabaseRecordThreadLocal.instance().get().getTransaction().lockingStrategy(this); }
@Override public boolean isLocked() { return ODatabaseRecordThreadLocal.instance().get().getTransaction().isLockedRecord(this); }
@Override public boolean isLocked() { return ODatabaseRecordThreadLocal.instance().get().getTransaction().isLockedRecord(this); }
@Override public void unlock() { ODatabaseRecordThreadLocal.instance().get().getTransaction().unlockRecord(this); } }
@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 lock(final boolean iExclusive) { ODatabaseRecordThreadLocal.instance().get().getTransaction().lockRecord(this, iExclusive ? OStorage.LOCKING_STRATEGY.EXCLUSIVE_LOCK : OStorage.LOCKING_STRATEGY.SHARED_LOCK); }
/** * (Blueprints Extension) Checks if an Element is locked */ @Override public boolean isLocked() { return ODatabaseRecordThreadLocal.instance().get().getTransaction().isLockedRecord(this); }
/** * (Blueprints Extension) Unlocks previous acquired @lock against the Element. * * @see #lock(boolean) */ @Override public void unlock() { ODatabaseRecordThreadLocal.instance().get().getTransaction().unlockRecord(this); }
private void ensureTransaction() { final boolean txBegun = getDatabase().getTransaction().isActive(); if (!txBegun) { getDatabase().begin(); getDatabase().getTransaction().setUsingLog(settings.isUseLog()); } }
@Override protected Boolean execute(ODatabaseDocument db) { document.save(); if (document.getDatabase().getTransaction().isActive()){ document.getDatabase().commit(); } return true; } }.execute();
@Override public void begin() { makeActive(); // XXX: Under some circumstances, auto started transactions are committed outside of the graph using the // underlying database and later restarted using the graph. So we have to check the status of the // database transaction to support this behaviour. if (isAutoStartTx() && getDatabase().getTransaction().isActive()) throw new OTransactionException("A mixture of auto started and manually started transactions is not allowed. " + "Disable auto transactions for the graph before starting a manual transaction."); getDatabase().begin(); getDatabase().getTransaction().setUsingLog(settings.isUseLog()); }
@Override protected void autoStartTransaction() { final boolean txBegun = getDatabase().getTransaction().isActive(); if (!isAutoStartTx()) { if (isRequireTransaction() && !txBegun) throw new OTransactionException("Transaction required to change the Graph"); return; } if (!txBegun) { getDatabase().begin(); getDatabase().getTransaction().setUsingLog(settings.isUseLog()); } }