Package org.apache.cocoon.components.thread

Examples of org.apache.cocoon.components.thread.RunnableManager


        final int keepAliveTimeMs = poolConfig.getChild("keep-alive-time-ms").getValueAsInteger(-1);
        final String blockPolicy = poolConfig.getChild("block-policy").getValue(null);
        m_shutdownGraceful = poolConfig.getChild("shutdown-graceful").getValueAsBoolean(true);

        final int shutdownWaitTimeMs = poolConfig.getChild("shutdown-wait-time-ms").getValueAsInteger(-1);
        final RunnableManager runnableManager = (RunnableManager)this.manager.lookup(RunnableManager.ROLE);
        final QuartzThreadPool pool = new QuartzThreadPool(runnableManager.createPool(queueSize,
                                                                                      maxPoolSize,
                                                                                      minPoolSize,
                                                                                      Thread.NORM_PRIORITY,
                                                                                      false, // no daemon
                                                                                      keepAliveTimeMs,
View Full Code Here


        try {
            Process p = Runtime.getRuntime().exec(toStringArray(fillArguments(args)));

            BufferedInputStream compilerErr = new BufferedInputStream(p.getErrorStream());

            RunnableManager runnableManager = null;
            try
            {
                runnableManager = (RunnableManager)m_serviceManager.lookup( RunnableManager.ROLE );
            }
            catch( final ServiceException se )
            {
                getLogger().error( "Cannot get RunnableManager", se );
                throw new IOException( "Cannot get RunnableManager" );
            }

            final CountDown done = new CountDown( 1 );
            StreamPumper errPumper = new StreamPumper(compilerErr, tmpErr, done);
            runnableManager.execute( errPumper );
            m_serviceManager.release( runnableManager );

            p.waitFor();
            exitValue = p.exitValue();
View Full Code Here

        // create a thread that invalidates the continuations
        final Configuration expireConf = config.getChild("expirations-check");
        final long initialDelay = expireConf.getChild("offset", true).getValueAsLong(180000);
        final long interval = expireConf.getChild("period", true).getValueAsLong(180000);
        try {
            final RunnableManager runnableManager = (RunnableManager)serviceManager.lookup(RunnableManager.ROLE);
            runnableManager.execute( new Runnable() {
                    public void run()
                    {
                        expireContinuations();
                    }
                }, initialDelay, interval);
View Full Code Here


            public IncludeBuffer(IncludeElement element) {
                this.element = element;

                RunnableManager runnable = null;
                try {
                    runnable = (RunnableManager) IncludeTransformer.this.manager.lookup(RunnableManager.ROLE);
                    runnable.execute(IncludeTransformer.this.threadPool, this);
                } catch (final ServiceException e) {
                    // In case we failed to spawn a thread
                    throw new CascadingRuntimeException(e.getMessage(), e);
                } finally {
                    IncludeTransformer.this.manager.release(runnable);
View Full Code Here

                        this.getLogger().debug("Booting preemptive loader: " + this.preemptiveLoaderURI);
                    }
                    PreemptiveBooter thread = new PreemptiveBooter( this.preemptiveLoaderURI );
                    try
                    {
                        final RunnableManager runnableManager = (RunnableManager)this.manager.lookup( RunnableManager.ROLE );
                        runnableManager.execute( thread );
                        this.manager.release( runnableManager );
                    }
                    catch( final ServiceException se )
                    {
                        getLogger().error( "Cannot lookup RunnableManager", se );
View Full Code Here

        m_serviceManager = serviceManager;
    }

    /** Start the server */
    public void start() {
        RunnableManager runnableManager = null;
        try {
            runnableManager = (RunnableManager) m_serviceManager.lookup(RunnableManager.ROLE);
            runnableManager.execute(m_daemonThreadPoolName, this);
        } catch(final ServiceException e) {
            throw new CascadingRuntimeException("Cannot get RunnableManager", e);
        } finally {
            if (null != runnableManager) {
                m_serviceManager.release(runnableManager);
View Full Code Here

        final int keepAliveTimeMs = poolConfig.getChild("keep-alive-time-ms").getValueAsInteger(-1);
        final String blockPolicy = poolConfig.getChild("block-policy").getValue(null);
        m_shutdownGraceful = poolConfig.getChild("shutdown-graceful").getValueAsBoolean(true);

        final int shutdownWaitTimeMs = poolConfig.getChild("shutdown-wait-time-ms").getValueAsInteger(-1);
        final RunnableManager runnableManager = (RunnableManager)this.manager.lookup(RunnableManager.ROLE);
        this.executor = runnableManager.createPool(queueSize,
                                                   maxPoolSize,
                                                   minPoolSize,
                                                   Thread.NORM_PRIORITY,
                                                   false, // no daemon
                                                   keepAliveTimeMs,
View Full Code Here

        try {
            Process p = Runtime.getRuntime().exec(toStringArray(fillArguments(args)));

            BufferedInputStream compilerErr = new BufferedInputStream(p.getErrorStream());

            RunnableManager runnableManager = null;
            try
            {
                runnableManager = (RunnableManager)m_serviceManager.lookup( RunnableManager.ROLE );
            }
            catch( final ServiceException se )
            {
                getLogger().error( "Cannot get RunnableManager", se );
                throw new IOException( "Cannot get RunnableManager" );
            }

            final CountDown done = new CountDown( 1 );
            StreamPumper errPumper = new StreamPumper(compilerErr, tmpErr, done);
            runnableManager.execute( errPumper );
            m_serviceManager.release( runnableManager );

            p.waitFor();
            exitValue = p.exitValue();
View Full Code Here

                        this.getLogger().debug("Booting preemptive loader: " + this.preemptiveLoaderURI);
                    }
                    PreemptiveBooter thread = new PreemptiveBooter( this.preemptiveLoaderURI );
                    try
                    {
                        final RunnableManager runnableManager = (RunnableManager)this.manager.lookup( RunnableManager.ROLE );
                        runnableManager.execute( thread );
                        this.manager.release( runnableManager );
                    }
                    catch( final ServiceException se )
                    {
                        getLogger().error( "Cannot lookup RunnableManager", se );
View Full Code Here

        final Configuration expireConf = config.getChild("expirations-check");
        final long initialDelay = expireConf.getChild("offset", true).getValueAsLong(180000);
        final long interval = expireConf.getChild("period", true).getValueAsLong(180000);
        try {
            final RunnableManager runnableManager = (RunnableManager)serviceManager.lookup(RunnableManager.ROLE);
            runnableManager.execute( new Runnable() {
                public void run()
                {
                    expireContinuations();
                }
            }, initialDelay, interval);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.thread.RunnableManager

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.