@ Nullable public static < T > Throwable terminate ( AtomicReferenceFieldUpdater < T , Throwable > field , T instance ) { Throwable current = field . get ( instance ) ; if ( current != TERMINATED ) { current = field . getAndSet ( instance , TERMINATED ) ; } return current ; }
Atomic utility to safely mark a volatile throwable reference with a terminal marker .