Package org.mule.work

Examples of org.mule.work.MuleWorkManager


        final MuleConfiguration config = getMuleConfiguration();
        // still can be embedded, but in container mode, e.g. in a WAR
        final String threadPrefix = config.isContainerMode()
                ? String.format("[%s].Mule", config.getId())
                : "MuleServer";
        return new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, threadPrefix, config.getShutdownTimeout());
    }
View Full Code Here


        protected MuleContext muleContext;

        public WorkManager createWorkManager(ThreadingProfile profile, String name, int shutdownTimeout)
        {
            final WorkManager workManager = new MuleWorkManager(profile, name, shutdownTimeout);
            if (muleContext != null)
            {
                MuleContextAware contextAware = (MuleContextAware) workManager;
                contextAware.setMuleContext(muleContext);
            }
View Full Code Here

    @Override
    protected MuleWorkManager createWorkManager()
    {
        // use app name in the core Mule thread
        final String threadName = String.format("[%s].Mule", desc.getAppName());
        return new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, threadName, getMuleConfiguration().getShutdownTimeout());

    }
View Full Code Here

    public void testDoWorkExecutesSynchronously() throws Exception
    {
        final Thread callerThread = Thread.currentThread();

        MuleWorkManager wm = new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, null, 5000);
        wm.setMuleContext(muleContext);
       
        try
        {
            wm.start();
           
            wm.doWork(new Work()
            {
                public void release()
                {
                    // no-op
                }

                public void run()
                {
                    Thread calleeThread = Thread.currentThread();
                    assertEquals("WorkManager.doWork() should have been executed in the same thread.",
                                 callerThread, calleeThread);
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("WORK: " + Thread.currentThread());
                    }
                }
            });
            if (logger.isDebugEnabled())
            {
                logger.debug("MAIN: " + Thread.currentThread());
            }
        }
        finally
        {
            wm.dispose();
        }

    }
View Full Code Here

    public void testScheduleWorkExecutesAsynchronously() throws Exception
    {
        final Thread callerThread = Thread.currentThread();

        MuleWorkManager wm = new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, null, 5000);
        wm.setMuleContext(muleContext);

        try
        {
            wm.start();

            wm.scheduleWork(new Work()
            {
                public void release()
                {
                    // no-op
                }

                public void run()
                {
                    Thread calleeThread = Thread.currentThread();
                    assertFalse("WorkManager.scheduleWork() should have been executed in a different thread.",
                                callerThread.equals(calleeThread));
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("WORK: " + Thread.currentThread());
                    }
                }
            });
            if (logger.isDebugEnabled())
            {
                logger.debug("MAIN: " + Thread.currentThread());
            }
        }
        finally
        {
            wm.dispose();
        }

    }
View Full Code Here

    public void testStartWorkExecutesAsynchronously() throws Exception
    {
        final Thread callerThread = Thread.currentThread();

        MuleWorkManager wm = new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, null, 5000);
        wm.setMuleContext(muleContext);

        try
        {
            wm.start();

            wm.startWork(new Work()
            {
                public void release()
                {
                    // no-op
                }

                public void run()
                {
                    Thread calleeThread = Thread.currentThread();
                    assertFalse("WorkManager.startWork() should have been executed in a different thread.",
                                callerThread.equals(calleeThread));
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("WORK: " + Thread.currentThread());
                    }
                }
            });
            if (logger.isDebugEnabled())
            {
                logger.debug("MAIN: " + Thread.currentThread());
            }
        }
        finally
        {
            wm.dispose();
        }

    }
View Full Code Here

        // still can be embedded, but in container mode, e.g. in a WAR
        final String threadPrefix = config.isContainerMode()
                ? String.format("[%s].Mule", config.getId())
                : "MuleServer";
        ImmutableThreadingProfile threadingProfile = createMuleWorkManager();
        return new MuleWorkManager(threadingProfile, threadPrefix, config.getShutdownTimeout());
    }
View Full Code Here

        protected MuleContext muleContext;

        public WorkManager createWorkManager(ThreadingProfile profile, String name, int shutdownTimeout)
        {
            final WorkManager workManager = new MuleWorkManager(profile, name, shutdownTimeout);
            if (muleContext != null)
            {
                MuleContextAware contextAware = (MuleContextAware) workManager;
                contextAware.setMuleContext(muleContext);
            }
View Full Code Here

    @Override
    protected MuleWorkManager createWorkManager()
    {
        // use app name in the core Mule thread
        final String threadName = String.format("[%s].Mule", desc.getAppName());
        return new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, threadName, getMuleConfiguration().getShutdownTimeout());

    }
View Full Code Here

TOP

Related Classes of org.mule.work.MuleWorkManager

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.