Skip to content

Commit

Permalink
Never release store using CancellableThreads
Browse files Browse the repository at this point in the history
  • Loading branch information
dnhatn committed Aug 9, 2019
1 parent 67a81ab commit 30339ac
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,12 @@ public interface OnCancel {
*/
void onCancel(String reason, @Nullable Exception beforeCancelException);
}

/**
* Returns {@code true} if the current thread is being executed using {@link CancellableThreads} or was interrupted.
*/
public synchronized boolean isCurrentThreadCancellable() {
final Thread currentThread = Thread.currentThread();
return currentThread.isInterrupted() || threads.contains(currentThread);
}
}
Loading

0 comments on commit 30339ac

Please sign in to comment.