/** * Performs a copy of the specified value allocated outside of the * current allocator context. * * @param value the value to be copied. * @return a copy allocated using the outer allocator. */ public static <T extends ValueType> T outerCopy( T value) { Context.enter(OuterContext.class); try { Object copy = value.copy(); return ( T ) copy; } finally { Context.exit(OuterContext.class); } }
/** * Performs a copy of the specified values outside of the * current stack context (convenience method). This method is * equivalent to:[code] * AllocatorContext.outerExecute(new Runnable() { * public void run() { * for (int i = 0; i < values.length; i++) { * values[i] = {ValueType) values[i].copy(); * } * } * });[/code] * @param values the array whose elements are exported. */ public static void outerCopy(ValueType[] values) { Context.enter(OuterContext.class); try { for (int i = 0; i < values.length; i++) { values[i] = (ValueType) values[i].copy(); } } finally { Context.exit(OuterContext.class); } }