Package javax.enterprise.concurrent

Examples of javax.enterprise.concurrent.ManagedThreadFactory


            blockingQueue = new LinkedBlockingQueue<Runnable>();
        } else {
            blockingQueue = new ArrayBlockingQueue<Runnable>(queue);
        }

        ManagedThreadFactory managedThreadFactory;
        try {
            managedThreadFactory = ManagedThreadFactory.class.cast(Thread.currentThread().getContextClassLoader().loadClass(threadFactory).newInstance());
        } catch (final Exception e) {
            Logger.getInstance(LogCategory.OPENEJB, ManagedExecutorServiceImplFactory.class).warning("Can't create configured thread factory: " + threadFactory, e);
            managedThreadFactory = new ManagedThreadFactoryImpl();
View Full Code Here


    public ManagedScheduledExecutorServiceImpl create() {
        return new ManagedScheduledExecutorServiceImpl(createScheduledExecutorService());
    }

    private ScheduledExecutorService createScheduledExecutorService() {
        ManagedThreadFactory managedThreadFactory;
        try {
            managedThreadFactory = ManagedThreadFactory.class.cast(Thread.currentThread().getContextClassLoader().loadClass(threadFactory).newInstance());
        } catch (final Exception e) {
            Logger.getInstance(LogCategory.OPENEJB, ManagedScheduledExecutorServiceImplFactory.class).warning("Unable to create configured thread factory: " + threadFactory, e);
            managedThreadFactory = new ManagedThreadFactoryImpl();
View Full Code Here

            blockingQueue = new LinkedBlockingQueue<Runnable>();
        } else {
            blockingQueue = new ArrayBlockingQueue<Runnable>(queue);
        }

        ManagedThreadFactory managedThreadFactory;
        try {
            managedThreadFactory = ManagedThreadFactory.class.cast(Thread.currentThread().getContextClassLoader().loadClass(threadFactory).newInstance());
        } catch (final Exception e) {
            Logger.getInstance(LogCategory.OPENEJB, ManagedExecutorServiceImplFactory.class).warning("Can't create configured thread factory: " + threadFactory, e);
            managedThreadFactory = new ManagedThreadFactoryImpl();
View Full Code Here

    public ManagedScheduledExecutorServiceImpl create() {
        return new ManagedScheduledExecutorServiceImpl(createScheduledExecutorService(), waitAtShutdown);
    }

    private ScheduledExecutorService createScheduledExecutorService() {
        ManagedThreadFactory managedThreadFactory;
        try {
            managedThreadFactory = ManagedThreadFactory.class.cast(Thread.currentThread().getContextClassLoader().loadClass(threadFactory).newInstance());
        } catch (final Exception e) {
            Logger.getInstance(LogCategory.OPENEJB, ManagedScheduledExecutorServiceImplFactory.class).warning("Can't create configured thread factory: " + threadFactory, e);
            managedThreadFactory = new ManagedThreadFactoryImpl();
View Full Code Here

            blockingQueue = new LinkedBlockingQueue<Runnable>();
        } else {
            blockingQueue = new ArrayBlockingQueue<Runnable>(queue);
        }

        ManagedThreadFactory managedThreadFactory;
        try {
            managedThreadFactory = ManagedThreadFactory.class.cast(Thread.currentThread().getContextClassLoader().loadClass(threadFactory).newInstance());
        } catch (final Exception e) {
            Logger.getInstance(LogCategory.OPENEJB, ManagedExecutorServiceImplFactory.class).warning("Can't create configured thread factory: " + threadFactory, e);
            managedThreadFactory = new ManagedThreadFactoryImpl();
View Full Code Here

            out.println("<body>");
            out.println("<h1>Getting ManagedThreadFactory using JNDI lookup</h1>");
            try {
                InitialContext ctx = new InitialContext();
               
                ManagedThreadFactory factory = (ManagedThreadFactory) ctx.lookup("java:comp/DefaultManagedThreadFactory");
//                ManagedExecutorService executor = (ManagedExecutorService) ctx.lookup("concurrent/myExecutor");
                out.println("Getting ManageableThread<br>");
                Thread thread = factory.newThread(new MyTask(2));
                out.println("Starting thread<br>");
                thread.start();
                out.println("Thread started<br><br>");
            } catch (NamingException ex) {
                Logger.getLogger(TestResourceServlet.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

            out.println("<body>");
            out.println("<h1>Getting ManagedThreadFactory using JNDI lookup</h1>");
            try {
                InitialContext ctx = new InitialContext();
               
                ManagedThreadFactory factory = (ManagedThreadFactory) ctx.lookup("java:comp/DefaultManagedThreadFactory");
//                ManagedExecutorService executor = (ManagedExecutorService) ctx.lookup("concurrent/myExecutor");
                out.println("Getting ManageableThread<br>");
                Thread thread = factory.newThread(new MyTask(2));
                out.println("Starting thread<br>");
                thread.start();
                out.println("Thread started<br><br>");
            } catch (NamingException ex) {
                Logger.getLogger(TestResourceServlet.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

        ar.setTimeout(4000, TimeUnit.MILLISECONDS);
       
        ar.register(new MyCompletionCallback());
        ar.register(new MyConnectionCallback());
       
        ManagedThreadFactory threadFactory = (ManagedThreadFactory) new InitialContext()
                .lookup("java:comp/DefaultManagedThreadFactory");
       
        Executors.newSingleThreadExecutor(threadFactory).submit(new Runnable() {

            @Override
View Full Code Here

TOP

Related Classes of javax.enterprise.concurrent.ManagedThreadFactory

Copyright © 2018 www.massapicom. 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.