Package org.torquebox.core.runtime

Examples of org.torquebox.core.runtime.RestartableRubyRuntimePool


       
        ServiceName poolServiceName = CoreServices.runtimePoolName( unit, "pool_one" );
       
        MockServiceBuilder<?> poolServiceBuilder = phaseContext.getMockServiceTarget().getMockServiceBuilder( poolServiceName );
        Value<?> poolServiceValue = poolServiceBuilder.getValue();
        RestartableRubyRuntimePool poolOne = (RestartableRubyRuntimePool) poolServiceValue.getValue();

        assertNotNull( poolOne );
        assertEquals( "pool_one", poolOne.getName() );
        assertEquals( 2, poolOne.getMinimumInstances() );
        assertEquals( 200, poolOne.getMaximumInstances() );
    }
View Full Code Here


       
        ServiceName poolServiceName = CoreServices.runtimePoolName( unit, "pool_one" );
       
        MockServiceBuilder<?> poolServiceBuilder = phaseContext.getMockServiceTarget().getMockServiceBuilder( poolServiceName );
        Value<?> poolServiceValue = poolServiceBuilder.getValue();
        RestartableRubyRuntimePool poolOne = (RestartableRubyRuntimePool) poolServiceValue.getValue();

        assertNotNull( poolOne );
        assertEquals( "pool_one", poolOne.getName() );
    }
View Full Code Here

        this.componentResolver = new ComponentResolver( false );
        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

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

TOP

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

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.