Package org.torquebox.core.runtime

Examples of org.torquebox.core.runtime.PoolMetaData


    @Test
    public void testMinMaxPool() throws Exception {
        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        PoolMetaData poolMetaData = new PoolMetaData( "pool_one" );
        poolMetaData.setMinimumSize( 2 );
        poolMetaData.setMaximumSize( 200 );

        unit.addToAttachmentList( PoolMetaData.ATTACHMENTS_KEY, poolMetaData );
       
        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "test-app");
        rubyAppMetaData.attachTo( unit );
View Full Code Here


    @Test
    public void testSharedPoolWithFactory() throws Exception {
        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        PoolMetaData poolMetaData = new PoolMetaData( "pool_one" );
        poolMetaData.setInstanceFactoryName( "instance_factory" );
        poolMetaData.setShared();
       
        unit.addToAttachmentList( PoolMetaData.ATTACHMENTS_KEY, poolMetaData );
       
        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "test-app");
        rubyAppMetaData.attachTo( unit );
View Full Code Here

        if ( ! unit.hasAttachment( ServiceMetaData.ATTACHMENTS_KEY ) ) {
            return;
        }
       
        List<PoolMetaData> allMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );
        PoolMetaData poolMetaData = PoolMetaData.extractNamedMetaData( allMetaData, "services" );
       
        if ( poolMetaData == null ) {
            poolMetaData = new PoolMetaData("services");
            poolMetaData.setShared();
            unit.addToAttachmentList( PoolMetaData.ATTACHMENTS_KEY, poolMetaData );
        }
    }
View Full Code Here

        deploy( phaseContext );

        List<PoolMetaData> allPools = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );
        assertEquals( 1, allPools.size() );

        PoolMetaData servicePoolMetaData = allPools.get( 0 );
        assertEquals( "services", servicePoolMetaData.getName() );
        assertTrue( servicePoolMetaData.isShared() );
        assertTrue( servicePoolMetaData.isDeferUntilRequested() );
    }
View Full Code Here

        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }

        List<PoolMetaData> allMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );
        PoolMetaData jobsPool = PoolMetaData.extractNamedMetaData( allMetaData, "jobs" );

        if (jobsPool == null) {
            RubyAppMetaData envMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );
            boolean devMode = envMetaData != null && envMetaData.isDevelopmentMode();
            jobsPool = devMode ? new PoolMetaData( "jobs", 1, 10 ) : new PoolMetaData( "jobs" );
            unit.addToAttachmentList( PoolMetaData.ATTACHMENTS_KEY, jobsPool );
        }
    }
View Full Code Here

        if ( ! unit.hasAttachment( RackMetaData.ATTACHMENT_KEY ) ) {
            return;
        }
       
        List<PoolMetaData> allMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );
        PoolMetaData poolMetaData = PoolMetaData.extractNamedMetaData( allMetaData, "web" );
       
        if ( poolMetaData == null ) {
            poolMetaData = new PoolMetaData("web");
            poolMetaData.setShared();
            poolMetaData.setDeferUntilRequested( false );
            unit.addToAttachmentList( PoolMetaData.ATTACHMENTS_KEY, poolMetaData );
        }
       
        String forceConnectorStart = System.getProperty( "org.torquebox.web.force_http_connector_start", "false" );
        if (Boolean.parseBoolean( forceConnectorStart )) {
View Full Code Here

        List<PoolMetaData> allMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );

        assertEquals( 1, allMetaData.size() );

        PoolMetaData poolMetaData = allMetaData.get( 0 );

        assertNotNull( poolMetaData );
        assertTrue( poolMetaData.isShared() );
        assertFalse( poolMetaData.isDeferUntilRequested() );

        unit.removeAttachment( PoolMetaData.ATTACHMENTS_KEY );

        unit.addToAttachmentList( PoolMetaData.ATTACHMENTS_KEY, new PoolMetaData( "web", 2, 4 ) );

        deploy( phaseContext );

        allMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );

        assertEquals( 1, allMetaData.size() );

        poolMetaData = allMetaData.get( 0 );

        assertNotNull( poolMetaData );
        assertFalse( poolMetaData.isShared() );
        assertEquals( 2, poolMetaData.getMinimumSize() );
        assertEquals( 4, poolMetaData.getMaximumSize() );
    }
View Full Code Here

        deploy( phaseContext );
        List<PoolMetaData> allMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );

        assertEquals( 1, allMetaData.size() );

        PoolMetaData poolMetaData = allMetaData.get( 0 );
       
        assertNotNull( poolMetaData );
        assertFalse( poolMetaData.isShared() );
        assertEquals( 2, poolMetaData.getMinimumSize() );
        assertEquals( 4, poolMetaData.getMaximumSize() );
    }
View Full Code Here

        if (pooling != null) {
            for (String name : pooling.keySet()) {

                Object pool = pooling.get( name );

                PoolMetaData poolMetaData = new PoolMetaData( name );
                if (name.equals( "web" )) {
                    // Web runtimes default to eager
                    poolMetaData.setDeferUntilRequested( false );
                }

                if (pool instanceof Map) {
                    Map<String, Object> poolMap = (Map<String, Object>) pool;

                    if (poolMap.get( "type" ) != null) {
                        String type = poolMap.get( "type" ).toString();
                        if (type.equals( "shared" )) {
                            poolMetaData.setShared();
                        } else if (type.equals( "global" )) {
                            poolMetaData.setGlobal();
                        }
                    }

                    if (poolMap.get( "min" ) != null) {
                        poolMetaData.setMinimumSize( ((Number) poolMap.get( "min" )).intValue() );
                    }

                    if (poolMap.get( "max" ) != null) {
                        poolMetaData.setMaximumSize( ((Number) poolMap.get( "max" )).intValue() );
                    }

                    if (poolMap.get( "lazy" ) != null) {
                        poolMetaData.setDeferUntilRequested( (Boolean) poolMap.get( "lazy" ) );
                    }
                } else if (pool instanceof String) {
                    if (pool.toString().equals( "shared" )) {
                        poolMetaData.setShared();
                    } else if (pool.toString().equals( "global" )) {
                        poolMetaData.setGlobal();
                    }
                }
                unit.addToAttachmentList( PoolMetaData.ATTACHMENTS_KEY, poolMetaData );
            }
        }
View Full Code Here

        if (allMetaData.isEmpty()) {
            return;
        }
       
        List<PoolMetaData> allPoolMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );
        PoolMetaData poolMetaData = PoolMetaData.extractNamedMetaData( allPoolMetaData, "stomplets" );
       
        if ( poolMetaData == null ) {
            poolMetaData = new PoolMetaData("stomplets");
            poolMetaData.setMinimumSize( allMetaData.size()  );
            poolMetaData.setMaximumSize( allMetaData.size()  );
            unit.addToAttachmentList( PoolMetaData.ATTACHMENTS_KEY, poolMetaData );
        }
    }
View Full Code Here

TOP

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

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.