public void goingToExecuteUnsafeCodeOnSameThread() throws SecurityException, IllegalStateException {
  if (!privilegedThreads.contains(Thread.currentThread())) {
    throw new SecurityException("Current thread is not privileged");
  }
  if (privilegedThreadToIgnore != null) {
    throw new IllegalStateException("The thread is already executing unsafe code");
  }
  privilegedThreadToIgnore=Thread.currentThread();
}

public void goingToExecuteUnsafeCodeOnSameThread ( ) throws SecurityException , IllegalStateException { if ( ! privilegedThreads . contains ( Thread . currentThread ( ) ) ) { throw new SecurityException ( "Current thread is not privileged" ) ; } if ( privilegedThreadToIgnore != null ) { throw new IllegalStateException ( "The thread is already executing unsafe code" ) ; } privilegedThreadToIgnore = Thread . currentThread ( ) ; }
use this method if you are going to execute sut code from a privileged thread ( ie if you don ' t want to do it on a new thread )
