protected override LockTransactionResult DoExecuteLockTransaction(LockSession session, LockTransaction transaction) { return(Contracts.ServiceClientHub.CallWithRetry <Contracts.ILockerClient, LockTransactionResult> ( (locker) => locker.ExecuteLockTransaction(session.Data, transaction), session.ServerHosts )); }
protected override bool DoEndLockSession(LockSession session) { return(Contracts.ServiceClientHub.CallWithRetry <Contracts.ILockerClient, bool> ( (locker) => locker.EndLockSession(session.Data.ID), session.ServerHosts )); }
public virtual LockSession MakeSession(string path, object shardingID, string description = null, int?maxAgeSec = null) { var session = new LockSession(this, path, shardingID, description, maxAgeSec); m_Sessions[session.ID] = session; return(session); }
protected override Task <bool> DoEndLockSessionAsync(LockSession session) { return(Contracts.ServiceClientHub.CallWithRetryAsync <Contracts.ILockerClient, bool> ( (locker) => locker.Async_EndLockSession(session.Data.ID).AsTaskReturning <bool>(), session.ServerHosts )); }
private void checkSessionExists(LockSession session) { var s = this[session.ID]; if (s == null) { throw new LockingException(StringConsts.LOCK_SESSION_NOT_ACTIVE_ERROR.Args(session.ID, session.Description)); } }
public Task <bool> EndLockSessionAsync(LockSession session) { if (!Running) { return(Task.FromResult(false)); } if (session == null) { throw new LockingException(StringConsts.ARGUMENT_ERROR + GetType().Name + ".EndLockSessionAsync(session==null)"); } checkSessionExists(session); LockSession d; m_Sessions.TryRemove(session.ID, out d); return(DoEndLockSessionAsync(session)); }
public Task <LockTransactionResult> ExecuteLockTransactionAsync(LockSession session, LockTransaction transaction) { if (!Running) { return(Task.FromResult(LockTransactionResult.CallFailed)); } if (session == null || transaction == null) { throw new LockingException(StringConsts.ARGUMENT_ERROR + GetType().Name + ".ExecuteLockTransactionAsync(session|tran==null)"); } checkSessionExists(session); if (m_InstrumentationEnabled) { m_Stats.IncrementLong(session.Path); } return(DoExecuteLockTransactionAsync(session, transaction)); }
public bool EndLockSession(LockSession session) { if (!Running) { return(false); } if (session == null) { throw new LockingException(StringConsts.ARGUMENT_ERROR + GetType().Name + ".EndLockSession(session==null)"); } checkSessionExists(session); var ended = DoEndLockSession(session); LockSession d; m_Sessions.TryRemove(session.ID, out d); return(ended); }
public bool EndLockSession(LockSession session) { return(true); }
public LockTransactionResult ExecuteLockTransaction(LockSession session, LockTransaction transaction) { return(new LockTransactionResult(Guid.Empty, null, LockStatus.TransactionOK, LockErrorCause.Unspecified, null, 0, 0d, null)); }
public Task <bool> EndLockSessionAsync(LockSession session) { return(Task.FromResult(EndLockSession(session))); }
protected override Task <LockTransactionResult> DoExecuteLockTransactionAsync(LockSession session, LockTransaction transaction) { return(Contracts.ServiceClientHub.CallWithRetryAsync <Contracts.ILockerClient, LockTransactionResult> ( (locker) => locker.Async_ExecuteLockTransaction(session.Data, transaction).AsTaskReturning <LockTransactionResult>(), session.ServerHosts )); }
protected abstract Task <bool> DoEndLockSessionAsync(LockSession session);
protected override LockTransactionResult DoExecuteLockTransaction(LockSession session, LockTransaction transaction) { return(m_Server.ExecuteLockTransaction(session.Data, transaction)); }
protected abstract Task <LockTransactionResult> DoExecuteLockTransactionAsync(LockSession session, LockTransaction transaction);
protected abstract bool DoEndLockSession(LockSession session);
protected abstract LockTransactionResult DoExecuteLockTransaction(LockSession session, LockTransaction transaction);
protected override Task <LockTransactionResult> DoExecuteLockTransactionAsync(LockSession session, LockTransaction transaction) { return(TaskUtils.AsCompletedTask(() => m_Server.ExecuteLockTransaction(session.Data, transaction))); }
public Task <LockTransactionResult> ExecuteLockTransactionAsync(LockSession session, LockTransaction transaction) { return(Task.FromResult(ExecuteLockTransaction(session, transaction))); }
protected override bool DoEndLockSession(LockSession session) { return(m_Server.EndLockSession(session.ID)); }
protected override Task <bool> DoEndLockSessionAsync(LockSession session) { return(TaskUtils.AsCompletedTask(() => m_Server.EndLockSession(session.ID))); }