public void doneWithExecutingUnsafeCodeOnSameThread() throws SecurityException, IllegalStateException {
  if (!privilegedThreads.contains(Thread.currentThread())) {
    throw new SecurityException("Only a privileged thread can return from unsafe code execution");
  }
  if (privilegedThreadToIgnore == null) {
    throw new IllegalStateException("The thread was not executing unsafe code");
  }
  privilegedThreadToIgnore=null;
}

public void doneWithExecutingUnsafeCodeOnSameThread ( ) throws SecurityException , IllegalStateException { if ( ! privilegedThreads . contains ( Thread . currentThread ( ) ) ) { throw new SecurityException ( "Only a privileged thread can return from unsafe code execution" ) ; } if ( privilegedThreadToIgnore == null ) { throw new IllegalStateException ( "The thread was not executing unsafe code" ) ; } privilegedThreadToIgnore = null ; }
call after goingtoexecuteunsafecodeonsamethread when done with unsafe code
