Examples of ExternalExecutorService


Examples of org.drools.concurrent.ExternalExecutorService

    public void stopPartitionManagers() {
        startOperation();
        try {
            if ( this.ruleBase.getConfiguration().isMultithreadEvaluation() ) {
                ExternalExecutorService service = this.threadPool.get();
                if ( this.threadPool.compareAndSet( service,
                                                    null ) ) {
                    service.shutdown();
                    partitionManager.shutdown();
                }
            }
        } finally {
            endOperation();
View Full Code Here

Examples of org.drools.concurrent.ExternalExecutorService

            endOperation();
        }
    }

    private ExternalExecutorService createExecutorService(final int maxThreads) {
        return new ExternalExecutorService( Executors.newFixedThreadPool( maxThreads ) );
    }
View Full Code Here

Examples of org.drools.concurrent.ExternalExecutorService

    public void stopPartitionManagers() {
        startOperation();
        try {
            if ( this.ruleBase.getConfiguration().isMultithreadEvaluation() ) {
                ExternalExecutorService service = this.threadPool.get();
                if ( this.threadPool.compareAndSet( service,
                                                    null ) ) {
                    service.shutdown();
                    partitionManager.shutdown();
                }
            }
        } finally {
            endOperation();
View Full Code Here

Examples of org.drools.concurrent.ExternalExecutorService

            endOperation();
        }
    }

    private ExternalExecutorService createExecutorService(final int maxThreads) {
        return new ExternalExecutorService( Executors.newFixedThreadPool( maxThreads ) );
    }
View Full Code Here

Examples of org.drools.concurrent.ExternalExecutorService

    public void stopPartitionManagers() {
        startOperation();
        try {
            if ( this.ruleBase.getConfiguration().isMultithreadEvaluation() ) {
                ExternalExecutorService service = this.threadPool.get();
                if ( this.threadPool.compareAndSet( service,
                                                    null ) ) {
                    service.shutdown();
                    partitionManager.shutdown();
                }
            }
        } finally {
            endOperation();
View Full Code Here

Examples of org.drools.concurrent.ExternalExecutorService

    public void testEnqueueBeforeSettingExecutor() throws InterruptedException {
        final PartitionTaskManager.Action action = mock( PartitionTaskManager.Action.class );

        taskManager.enqueue( action );

        ExternalExecutorService service = new ExternalExecutorService( Executors.newSingleThreadExecutor() );
        // set the pool
        manager.setPool( service );

        service.waitUntilEmpty();
       
        // check expectations
        verify( action ).execute(workingMemory);
    }
View Full Code Here

Examples of org.drools.concurrent.ExternalExecutorService

    @Test
    public void testFireCorrectly() throws InterruptedException {
        // creates a mock action
        final PartitionTaskManager.Action action = mock( PartitionTaskManager.Action.class );
       
        ExternalExecutorService service = new ExternalExecutorService( Executors.newSingleThreadExecutor() );
        // set the pool
        manager.setPool( service );
       
        // fire scenario
        taskManager.enqueue( action );
       
        // executes all pending actions using current thread
        service.waitUntilEmpty();
       
        // check expectations
        verify( action ).execute(workingMemory);
    }
View Full Code Here

Examples of org.drools.concurrent.ExternalExecutorService

        taskManager.enqueue( action );
        taskManager.enqueue( action );

        // TODO: implement a deterministic executor service for testing..
        ExecutorService pool = Executors.newSingleThreadExecutor();
        ExternalExecutorService service = new ExternalExecutorService( pool );
        // set the pool
        manager.setPool( service );
       
        // enqueue after setting the pool
        taskManager.enqueue( action );
        taskManager.enqueue( action );
        taskManager.enqueue( action );
       
        // executes all pending actions using current thread
        service.waitUntilEmpty();
        pool.shutdown();
       
        // check expectations
        verify( action, times(5) ).execute(workingMemory);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.