public int g(int a) {
   Context cx = Context.enter();
   try {
     ContinuationPending pending = cx.captureContinuation();
     pending.setApplicationState(2 * a);
     throw pending;
   } finally {
     Context.exit();
   }
 }