Package javax.util.concurrent

Examples of javax.util.concurrent.ManagedThreadFactory.newThread()


        BasicTask task = new BasicTask();
       
        ManagedThreadFactory threadFactory = getManagedThreadFactory();
       
        ManagedThread thread =
            (ManagedThread)threadFactory.newThread(task);
           
        thread.setHungTaskThreshold(1000 * 5);
       
        assertFalse(thread.isTaskHung());
       
View Full Code Here


   
    private void testExpectedProperties(Runnable task, String expectedName, String expectedDescription) throws Exception {
        ManagedThreadFactory threadFactory = getManagedThreadFactory();
       
        ManagedThread thread =
            (ManagedThread)threadFactory.newThread(task);
       
        assertNull(thread.getTaskIdentityDescription());
        assertNull(thread.getTaskIdentityDescription(Locale.getDefault().toString()));
        assertNull(thread.getTaskIdentityName());
        assertEquals(0, thread.getTaskRunTime());
View Full Code Here

                       
        assertEquals(expected, TestContextHandler.getCurrentObject());
        TestContextHandler.setCurrentObject(null);
        assertNull(TestContextHandler.getCurrentObject());
       
        Thread thread = threadFactory.newThread(task);       
        thread.start();
        thread.join();
       
        assertEquals(Arrays.asList(expected), task.getList());       
    }
View Full Code Here

        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) {
View Full Code Here

        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) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.