LockToken makeToken() { LockToken token = new LockToken(); token.info = lock.lockInfo; token.timeout = new LockTimeout(lock.seconds); token.tokenId = lock.lockId; return token; }
public LockToken getCurrentLock() { if (this.lock == null) return null; LockToken token = new LockToken(); token.info = this.lock.lockInfo; token.timeout = new LockTimeout(this.lock.seconds); token.tokenId = this.lock.lockId; return token; }
public LockResult lock(LockTimeout timeout, LockInfo lockInfo) { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX locking"); // if( lock != null ) { // // todo // throw new RuntimeException("already locked"); // } LockTimeout.DateAndSeconds lockedUntil = timeout.getLockedUntil(60l, 3600l); this.lock = new TLock(lockedUntil.date, UUID.randomUUID().toString(), lockedUntil.seconds, lockInfo); LockToken token = new LockToken(); token.info = lockInfo; token.timeout = new LockTimeout(lockedUntil.seconds); token.tokenId = this.lock.lockId; return LockResult.success(token); }