/** * If in SE environment, this method wraps the collection of tasks in such a way that it sets the TCCL to null before * executing them and re-sets it to previous value once done. This affect the CL Weld will pick up when invoking * {@link org.jboss.weld.environment.deployment.WeldResourceLoader#getClassLoader()}. * * @see WELD-2494 */ @Override public <T> Collection<? extends Callable<T>> wrap(Collection<? extends Callable<T>> tasks) { // try to detect environment, if it's SE, we want to null TCCL, otherwise leave it as it is if (Container.getEnvironment().equals(Environments.SE)) { List<Callable<T>> wrapped = new ArrayList<>(tasks.size()); for (Callable<T> task : tasks) { wrapped.add(() -> { ClassLoader oldTccl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(null); try { return task.call(); } finally { Thread.currentThread().setContextClassLoader(oldTccl); } }); } return wrapped; } else { return tasks; } } }
/** * If in SE environment, this method wraps the collection of tasks in such a way that it sets the TCCL to null before * executing them and re-sets it to previous value once done. This affect the CL Weld will pick up when invoking * {@link org.jboss.weld.environment.deployment.WeldResourceLoader#getClassLoader()}. * * @see WELD-2494 */ @Override public <T> Collection<? extends Callable<T>> wrap(Collection<? extends Callable<T>> tasks) { // try to detect environment, if it's SE, we want to null TCCL, otherwise leave it as it is if (Container.getEnvironment().equals(Environments.SE)) { List<Callable<T>> wrapped = new ArrayList<>(tasks.size()); for (Callable<T> task : tasks) { wrapped.add(() -> { ClassLoader oldTccl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(null); try { return task.call(); } finally { Thread.currentThread().setContextClassLoader(oldTccl); } }); } return wrapped; } else { return tasks; } } }
/** * If in SE environment, this method wraps the collection of tasks in such a way that it sets the TCCL to null before * executing them and re-sets it to previous value once done. This affect the CL Weld will pick up when invoking * {@link org.jboss.weld.environment.deployment.WeldResourceLoader#getClassLoader()}. * * @see WELD-2494 */ @Override public <T> Collection<? extends Callable<T>> wrap(Collection<? extends Callable<T>> tasks) { // try to detect environment, if it's SE, we want to null TCCL, otherwise leave it as it is if (Container.getEnvironment().equals(Environments.SE)) { List<Callable<T>> wrapped = new ArrayList<>(tasks.size()); for (Callable<T> task : tasks) { wrapped.add(() -> { ClassLoader oldTccl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(null); try { return task.call(); } finally { Thread.currentThread().setContextClassLoader(oldTccl); } }); } return wrapped; } else { return tasks; } } }
/** * If in SE environment, this method wraps the collection of tasks in such a way that it sets the TCCL to null before * executing them and re-sets it to previous value once done. This affect the CL Weld will pick up when invoking * {@link org.jboss.weld.environment.deployment.WeldResourceLoader#getClassLoader()}. * * @see WELD-2494 */ @Override public <T> Collection<? extends Callable<T>> wrap(Collection<? extends Callable<T>> tasks) { // try to detect environment, if it's SE, we want to null TCCL, otherwise leave it as it is if (Container.getEnvironment().equals(Environments.SE)) { List<Callable<T>> wrapped = new ArrayList<>(tasks.size()); for (Callable<T> task : tasks) { wrapped.add(() -> { ClassLoader oldTccl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(null); try { return task.call(); } finally { Thread.currentThread().setContextClassLoader(oldTccl); } }); } return wrapped; } else { return tasks; } } }
/** * If in SE environment, this method wraps the collection of tasks in such a way that it sets the TCCL to null before * executing them and re-sets it to previous value once done. This affect the CL Weld will pick up when invoking * {@link org.jboss.weld.environment.deployment.WeldResourceLoader#getClassLoader()}. * * @see WELD-2494 */ @Override public <T> Collection<? extends Callable<T>> wrap(Collection<? extends Callable<T>> tasks) { // try to detect environment, if it's SE, we want to null TCCL, otherwise leave it as it is if (Container.getEnvironment().equals(Environments.SE)) { List<Callable<T>> wrapped = new ArrayList<>(tasks.size()); for (Callable<T> task : tasks) { wrapped.add(() -> { ClassLoader oldTccl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(null); try { return task.call(); } finally { Thread.currentThread().setContextClassLoader(oldTccl); } }); } return wrapped; } else { return tasks; } } }
static boolean isAnnotationClassExpected(InterceptionType interceptionType) { if (InterceptionType.POST_ACTIVATE.equals(interceptionType) || InterceptionType.PRE_PASSIVATE.equals(interceptionType)) { Environment environment = Container.getEnvironment(); if (environment != null && (Environments.SE.equals(environment) || Environments.SERVLET.equals(environment))) { return false; } } return true; } }
static boolean isAnnotationClassExpected(InterceptionType interceptionType) { if (InterceptionType.POST_ACTIVATE.equals(interceptionType) || InterceptionType.PRE_PASSIVATE.equals(interceptionType)) { Environment environment = Container.getEnvironment(); if (environment != null && (Environments.SE.equals(environment) || Environments.SERVLET.equals(environment))) { return false; } } return true; } }
static boolean isAnnotationClassExpected(InterceptionType interceptionType) { if (InterceptionType.POST_ACTIVATE.equals(interceptionType) || InterceptionType.PRE_PASSIVATE.equals(interceptionType)) { Environment environment = Container.getEnvironment(); if (environment != null && (Environments.SE.equals(environment) || Environments.SERVLET.equals(environment))) { return false; } } return true; } }
static boolean isAnnotationClassExpected(InterceptionType interceptionType) { if (InterceptionType.POST_ACTIVATE.equals(interceptionType) || InterceptionType.PRE_PASSIVATE.equals(interceptionType)) { Environment environment = Container.getEnvironment(); if (environment != null && (Environments.SE.equals(environment) || Environments.SERVLET.equals(environment))) { return false; } } return true; } }
static boolean isAnnotationClassExpected(InterceptionType interceptionType) { if (InterceptionType.POST_ACTIVATE.equals(interceptionType) || InterceptionType.PRE_PASSIVATE.equals(interceptionType)) { Environment environment = Container.getEnvironment(); if (environment != null && (Environments.SE.equals(environment) || Environments.SERVLET.equals(environment))) { return false; } } return true; } }