@Test public void lockByUser() { blc.lockByUser(); assertEquals(OpBlockChain.LOCKED_BY_USER, blc.getStatus()); }
public synchronized void lockByUser() { if(nullObject) { return; } if(this.locked == UNLOCKED) { this.locked = LOCKED_BY_USER; } else if(this.locked != LOCKED_BY_USER) { throw new IllegalStateException("This chain is locked not by user or in a broken state"); } }
OpBlockChain { public synchronized void lockByUser() { if(nullObject) { return; } if(this.locked == UNLOCKED) { this.locked = LOCKED_BY_USER; } else if(this.locked != LOCKED_BY_USER) { throw new IllegalStateException("This chain is locked not by user or in a broken state"); } } }
OpBlockChain { public synchronized void lockByUser() { if(nullObject) { return; } if(this.locked == UNLOCKED) { this.locked = LOCKED_BY_USER; } else if(this.locked != LOCKED_BY_USER) { throw new IllegalStateException("This chain is locked not by user or in a broken state"); } } private  OpBlockChain(boolean nullParent);  OpBlockChain(OpBlockChain parent, OpBlockchainRules rules);  OpBlockChain(OpBlockChain parent, Collection<OpBlock> headers, BlockDbAccessInterface dbAccess, OpBlockchainRules rules);  OpBlockChain(OpBlockChain copy, OpBlockChain parentToMerge, OpBlockchainRules rules); }
OpBlockChain { public synchronized void lockByUser() { if(nullObject) { return; } if(this.locked == UNLOCKED) { this.locked = LOCKED_BY_USER; } else if(this.locked != LOCKED_BY_USER) { throw new IllegalStateException("This chain is locked not by user or in a broken state"); } } private  OpBlockChain(boolean nullParent);  OpBlockChain(OpBlockChain parent, OpBlockchainRules rules);  OpBlockChain(OpBlockChain parent, Collection<OpBlock> headers, BlockDbAccessInterface dbAccess, OpBlockchainRules rules);  OpBlockChain(OpBlockChain copy, OpBlockChain parentToMerge, OpBlockchainRules rules); synchronized void validateLocked(); boolean isQueueEmpty(); boolean isDbAccessed(); int getStatus(); synchronized void lockByUser(); synchronized void unlockByUser(); synchronized OpBlock createBlock(String user, KeyPair keyPair); synchronized boolean removeAllQueueOperations(); synchronized OpBlock replicateBlock(OpBlock block); synchronized OpBlock replicateBlock(OpBlock block, DeletedObjectCtx hctx); synchronized boolean rebaseOperations(OpBlockChain newParent); synchronized boolean changeToEqualParent(OpBlockChain newParent); boolean addOperation(OpOperation op, DeletedObjectCtx historyObjectCtx); boolean addOperation(OpOperation op); boolean validateOperation(OpOperation op); Deque<OpOperation> getQueueOperations(); OpBlockChain getParent(); OpBlockchainRules getRules(); OpBlock getLastBlockHeader(); String getLastBlockFullHash(); String getLastBlockRawHash(); int getLastBlockId(); int getDepth(); boolean isNullBlock(); int getSuperblocksDepth(); Deque<OpBlock> getSuperblockHeaders(); Deque<OpBlock> getSuperblockFullBlocks(); Collection<String> getRawSuperblockTypes(); Stream<Entry<CompoundKey, OpObject>> getRawSuperblockObjects(String type); List<OpBlock> getBlockHeaders(int depth); OpBlock getBlockHeadersById(int id); OpBlock getFullBlockByBlockId(int id); String getSuperBlockHash(); int getSuperblockSize(); int getBlockDepth(OpBlock block); OpBlock getBlockHeaderByRawHash(String hash); OpBlock getFullBlockByRawHash(String hash); OpOperation getOperationByHash(String rawHash); OpObject getObjectByName(String type, String key); OpObject getObjectByName(String type, String key, String secondary); OpObject getObjectByName(String type, List<String> o); void setCacheAfterSearch(ObjectsSearchRequest request, Object cacheObject); int countAllObjects(String type); void fetchAllObjects(String type, ObjectsSearchRequest request); void fetchObjectsByIndex(String type, OpIndexColumn index, ObjectsSearchRequest request, Object... argsToSearch); @Override String toString(); }
OpBlockChain { public synchronized void lockByUser() { if(nullObject) { return; } if(this.locked == UNLOCKED) { this.locked = LOCKED_BY_USER; } else if(this.locked != LOCKED_BY_USER) { throw new IllegalStateException("This chain is locked not by user or in a broken state"); } } private  OpBlockChain(boolean nullParent);  OpBlockChain(OpBlockChain parent, OpBlockchainRules rules);  OpBlockChain(OpBlockChain parent, Collection<OpBlock> headers, BlockDbAccessInterface dbAccess, OpBlockchainRules rules);  OpBlockChain(OpBlockChain copy, OpBlockChain parentToMerge, OpBlockchainRules rules); synchronized void validateLocked(); boolean isQueueEmpty(); boolean isDbAccessed(); int getStatus(); synchronized void lockByUser(); synchronized void unlockByUser(); synchronized OpBlock createBlock(String user, KeyPair keyPair); synchronized boolean removeAllQueueOperations(); synchronized OpBlock replicateBlock(OpBlock block); synchronized OpBlock replicateBlock(OpBlock block, DeletedObjectCtx hctx); synchronized boolean rebaseOperations(OpBlockChain newParent); synchronized boolean changeToEqualParent(OpBlockChain newParent); boolean addOperation(OpOperation op, DeletedObjectCtx historyObjectCtx); boolean addOperation(OpOperation op); boolean validateOperation(OpOperation op); Deque<OpOperation> getQueueOperations(); OpBlockChain getParent(); OpBlockchainRules getRules(); OpBlock getLastBlockHeader(); String getLastBlockFullHash(); String getLastBlockRawHash(); int getLastBlockId(); int getDepth(); boolean isNullBlock(); int getSuperblocksDepth(); Deque<OpBlock> getSuperblockHeaders(); Deque<OpBlock> getSuperblockFullBlocks(); Collection<String> getRawSuperblockTypes(); Stream<Entry<CompoundKey, OpObject>> getRawSuperblockObjects(String type); List<OpBlock> getBlockHeaders(int depth); OpBlock getBlockHeadersById(int id); OpBlock getFullBlockByBlockId(int id); String getSuperBlockHash(); int getSuperblockSize(); int getBlockDepth(OpBlock block); OpBlock getBlockHeaderByRawHash(String hash); OpBlock getFullBlockByRawHash(String hash); OpOperation getOperationByHash(String rawHash); OpObject getObjectByName(String type, String key); OpObject getObjectByName(String type, String key, String secondary); OpObject getObjectByName(String type, List<String> o); void setCacheAfterSearch(ObjectsSearchRequest request, Object cacheObject); int countAllObjects(String type); void fetchAllObjects(String type, ObjectsSearchRequest request); void fetchObjectsByIndex(String type, OpIndexColumn index, ObjectsSearchRequest request, Object... argsToSearch); @Override String toString(); static final String OP_CHANGE_DELETE; static final String OP_CHANGE_INCREMENT; static final String OP_CHANGE_APPEND; static final String OP_CHANGE_SET; static final int LOCKED_ERROR; static final int UNLOCKED; static final int LOCKED_OP_IN_PROGRESS; static final int LOCKED_STATE; static final int LOCKED_BY_USER; static final OpBlockChain NULL; }