public static <T, E extends Exception> void acceptWithInterruptHandler(InterruptHandler interruptHandler, ExceptionObjIntConsumer<T, E> function, T param1, int param2) throws E { final JBossThread thread = currentThread(); if (thread == null) { function.accept(param1, param2); return; } else { final InterruptHandler old = thread.interruptHandler; thread.interruptHandler = interruptHandler; try { function.accept(param1, param2); return; } finally { thread.interruptHandler = old; } } }
public <T, E extends Exception> void performConsumer(ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { consumer.accept(param1, param2); return; } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { consumer.accept(param1, param2); } } }
public static <T, E extends Exception> void acceptInterruptDeferredEx(final ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E { final JBossThread thread = currentThread(); if (registerDeferral(thread)) try { consumer.accept(param1, param2); } finally { unregisterDeferral(thread); } else { // already deferred consumer.accept(param1, param2); } }
public static <T, E extends Exception> void acceptInterruptResumedEx(final ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E { final JBossThread thread = currentThread(); if (unregisterDeferral(thread)) try { consumer.accept(param1, param2); } finally { registerDeferral(thread); } else { // already resumed consumer.accept(param1, param2); } }
default ExceptionObjIntConsumer<T, E> compose(ExceptionObjLongConsumer<? super T, ? extends E> before) { Assert.checkNotNullParam("before", before); return (t, v) -> { before.accept(t, v); accept(t, v); }; } }
default ExceptionObjIntConsumer<T, E> andThen(ExceptionObjLongConsumer<? super T, ? extends E> after) { Assert.checkNotNullParam("after", after); return (t, v) -> { accept(t, v); after.accept(t, v); }; }
public <T, E extends Exception> void runAsObjIntConsumerEx(final ExceptionObjIntConsumer<T, E> action, final T parameter1, final int parameter2) throws E { final Supplier<SecurityIdentity> old = securityDomain.getAndSetCurrentSecurityIdentity(this); try { action.accept(parameter1, parameter2); } finally { securityDomain.setCurrentSecurityIdentity(old); } }
/** * Run an action under this identity. * * @param parameter1 the first parameter to pass to the action * @param parameter2 the second parameter to pass to the action * @param action the action to run * @param <T> the action first parameter type * @param <E> the action exception type * @throws E if the action throws this exception */ public <T, E extends Exception> void runAsObjIntConsumerEx(ExceptionObjIntConsumer<T, E> action, T parameter1, int parameter2) throws E { if (action == null) return; final Supplier<SecurityIdentity>[] oldWithIdentities = establishIdentities(); final Supplier<SecurityIdentity> oldIdentity = securityDomain.getAndSetCurrentSecurityIdentity(this); try { action.accept(parameter1, parameter2); } finally { securityDomain.setCurrentSecurityIdentity(oldIdentity); restoreIdentities(oldWithIdentities); } }
public static <T, E extends Exception> void acceptWithInterruptHandler(InterruptHandler interruptHandler, ExceptionObjIntConsumer<T, E> function, T param1, int param2) throws E { final JBossThread thread = currentThread(); if (thread == null) { function.accept(param1, param2); return; } else { final InterruptHandler old = thread.interruptHandler; thread.interruptHandler = interruptHandler; try { function.accept(param1, param2); return; } finally { thread.interruptHandler = old; } } }
public static <T, E extends Exception> void acceptWithInterruptHandler(InterruptHandler interruptHandler, ExceptionObjIntConsumer<T, E> function, T param1, int param2) throws E { final JBossThread thread = currentThread(); if (thread == null) { function.accept(param1, param2); return; } else { final InterruptHandler old = thread.interruptHandler; thread.interruptHandler = interruptHandler; try { function.accept(param1, param2); return; } finally { thread.interruptHandler = old; } } }
public <T, E extends Exception> void performConsumer(ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { consumer.accept(param1, param2); return; } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { consumer.accept(param1, param2); } } }
public <T, E extends Exception> void performConsumer(ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { consumer.accept(param1, param2); return; } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { consumer.accept(param1, param2); } } }
public static <T, E extends Exception> void acceptInterruptResumedEx(final ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E { final JBossThread thread = currentThread(); if (unregisterDeferral(thread)) try { consumer.accept(param1, param2); } finally { registerDeferral(thread); } else { // already resumed consumer.accept(param1, param2); } }
public static <T, E extends Exception> void acceptInterruptDeferredEx(final ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E { final JBossThread thread = currentThread(); if (registerDeferral(thread)) try { consumer.accept(param1, param2); } finally { unregisterDeferral(thread); } else { // already deferred consumer.accept(param1, param2); } }