public static <T>T doUsing(Object context,RestrictedTokenAction<T> action) throws Exception {
  Object savedContext=currentContext.get();
  try {
    currentContext.set(context);
    return action.run();
  }
  finally {
    currentContext.set(savedContext);
  }
}

public static < T > T doUsing ( Object context , RestrictedTokenAction < T > action ) throws Exception { Object savedContext = currentContext . get ( ) ; try { currentContext . set ( context ) ; return action . run ( ) ; } finally { currentContext . set ( savedContext ) ; } }
performs an action while temporary replacing the current token restriction checking context associated with the running thread after returning from action run ( ) method original context is restored
