Example #1
0
 /**
  * Executes the specified function allocating objects on the stack; the function result is copied
  * to calling context.
  */
 public static <P, R extends Copyable<R>> R execute(Function<P, R> function, P parameter) {
   StackContext ctx = StackContext.enter();
   try {
     return ctx.executeInContext(function, parameter);
   } finally {
     ctx.exit();
   }
 }
Example #2
0
 /** Executes the specified logic allocating objects on the stack. */
 public static void execute(Runnable logic) {
   StackContext ctx = StackContext.enter();
   try {
     ctx.executeInContext(logic);
   } finally {
     ctx.exit();
   }
 }