Package org.torquebox.core.runtime

Examples of org.torquebox.core.runtime.SharedRubyRuntimePool


        this.componentResolver.setComponentInstantiator( this.componentClass );
        this.componentResolver.setComponentWrapperClass( ServiceComponent.class );
        this.service = new RubyService( "test service" );
        this.service.setComponentResolver( this.componentResolver );
        this.service.setRubyRuntimePool( new RestartableRubyRuntimePool(
                new SharedRubyRuntimePool( this.ruby ) ) );
    }
View Full Code Here


        if (rubyAppMetaData == null) {
            return;
        }

        if (poolMetaData.isShared()) {
            SharedRubyRuntimePool pool = new SharedRubyRuntimePool();
           
            pool.setName( poolMetaData.getName() );
            pool.setDeferUntilRequested( poolMetaData.isDeferUntilRequested() );

            RestartableRubyRuntimePool restartablePool = new RestartableRubyRuntimePool( pool );
            RubyRuntimeFactoryPoolService service = new RubyRuntimeFactoryPoolService( restartablePool );

            ServiceName name = CoreServices.runtimePoolName( unit, pool.getName() );

            phaseContext.getServiceTarget().addService( name, service )
                    .addDependency( CoreServices.runtimeFactoryName( unit ), RubyRuntimeFactory.class, service.getRubyRuntimeFactoryInjector() )
                    .addDependency( CoreServices.appNamespaceContextSelector( unit ), NamespaceContextSelector.class, service.getNamespaceContextSelectorInjector() )
                    .install();

            unit.addToAttachmentList( DeploymentNotifier.SERVICES_ATTACHMENT_KEY, name );

            ServiceName startName = CoreServices.runtimeStartPoolName( unit, pool.getName() );
            phaseContext.getServiceTarget().addService( startName, new RubyRuntimePoolStartService( pool ) )
                    .addDependency( name )
                    .setInitialMode( Mode.PASSIVE )
                    .install();

            String mbeanName = ObjectNameFactory.create( "torquebox.pools", new Hashtable<String, String>() {
                {
                    put( "app", rubyAppMetaData.getApplicationName() );
                    put( "name", poolMetaData.getName() );
                }
            } ).toString();

            ServiceName mbeanServiceName = name.append( "mbean" );
            MBeanRegistrationService<BasicRubyRuntimePoolMBean> mbeanService = new MBeanRegistrationService<BasicRubyRuntimePoolMBean>( mbeanName, mbeanServiceName );
            phaseContext.getServiceTarget().addService( mbeanServiceName, mbeanService )
                    .addDependency( DependencyType.OPTIONAL, MBeanServerService.SERVICE_NAME, MBeanServer.class, mbeanService.getMBeanServerInjector() )
                    .addDependency( name, BasicRubyRuntimePoolMBean.class, mbeanService.getValueInjector() )
                    .setInitialMode( Mode.PASSIVE )
                    .install();

        } else {
            DefaultRubyRuntimePool pool = new DefaultRubyRuntimePool();
           
            pool.setName( poolMetaData.getName() );
            pool.setMinimumInstances( poolMetaData.getMinimumSize() );
            pool.setMaximumInstances( poolMetaData.getMaximumSize() );
            pool.setDeferUntilRequested( poolMetaData.isDeferUntilRequested() );

            RestartableRubyRuntimePool restartablePool = new RestartableRubyRuntimePool( pool );
            RubyRuntimeFactoryPoolService service = new RubyRuntimeFactoryPoolService( restartablePool );

            ServiceName name = CoreServices.runtimePoolName( unit, pool.getName() );
            phaseContext.getServiceTarget().addService( name, service )
                    .addDependency( CoreServices.runtimeFactoryName( unit ), RubyRuntimeFactory.class, service.getRubyRuntimeFactoryInjector() )
                    .addDependency( CoreServices.appNamespaceContextSelector( unit ), NamespaceContextSelector.class, service.getNamespaceContextSelectorInjector() )
                    .install();
View Full Code Here

        }
        assertTrue( caughtException );
    }

    private RubyJobProxy createJobProxy() {
        RubyRuntimePool runtimePool = new SharedRubyRuntimePool( this.ruby );
        return new RubyJobProxy( runtimePool, this.componentResolver, this.jobDetail );
    }
View Full Code Here

TOP

Related Classes of org.torquebox.core.runtime.SharedRubyRuntimePool

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.