}
public void testContextMigration(boolean testEjbSecurity) throws Exception {
// since ee context is captured on jndi lookup for ManagedThreadFactory
// lookup ThreadFactory here to get the right security context
ManagedThreadFactory threadFactory = getThreadFactory();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
BasicTaskRunnable runnable = new BasicTaskRunnable(classLoader);
runnable.setTestEjbSecurity(testEjbSecurity);
RunnableWrapper wrapper = new RunnableWrapper(runnable);
Thread t = threadFactory.newThread(wrapper);
t.start();
t.join();
Throwable throwable = wrapper.getThrowable();
if (throwable instanceof Exception) {