StorageLockContext (final @Nullable StorageLockContext storageLockContext) { final StorageLockContext threadContext = THREAD_LOCAL_STORAGE_LOCK_CONTEXT.get(); if (threadContext != null) { if (storageLockContext != null && storageLockContext != threadContext) { throw new IllegalStateException("Context(" + storageLockContext + ") != THREAD_LOCAL_STORAGE_LOCK_CONTEXT(" + threadContext + ")"); } return threadContext; } return storageLockContext != null ? storageLockContext : DEFAULT_LOCK_CONTEXT; }