Package org.drools.concurrent

Examples of org.drools.concurrent.ExecutorService


public class ExecutorServiceFactory {
   
    public static ExecutorService createExecutorService(String className) {       

        try {
            ExecutorService service = ( ExecutorService ) ClassUtils.instantiateObject( className );
           
            return service;           
        } catch ( Throwable e ) {
            throw new RuntimeException("Unable to instantiate ExecutorService '" + className + "'", e );
        }       
View Full Code Here


        synchronized ( this.pkgs ) {
            ((InternalWorkingMemory) session).setRuleBase( this );
            ((InternalWorkingMemory) session).setId( ( nextWorkingMemoryCounter() ) );
           
            ExecutorService executor = ExecutorServiceFactory.createExecutorServicethis.config.getExecutorService() );;

            executor.setCommandExecutor( new CommandExecutor( session ) );
            ((InternalWorkingMemory) session).setExecutorService( executor );

            if ( keepReference ) {
                addStatefulSession( session );
                for( Iterator it = session.getRuleBaseUpdateListeners().iterator(); it.hasNext(); ) {
View Full Code Here

            throw new RuntimeException( "Cannot have a stateful rule session, with sequential configuration set to true" );
        }
        ReteooStatefulSession session = null;

        synchronized ( this.pkgs ) {
            ExecutorService executor = ExecutorServiceFactory.createExecutorServicethis.config.getExecutorService() );;
            session = new ReteooStatefulSession( nextWorkingMemoryCounter(),
                                                 this,
                                                 executor );

            executor.setCommandExecutor( new CommandExecutor( session ) );

            if ( keepReference ) {
                super.addStatefulSession( session );
                for( Iterator it = session.getRuleBaseUpdateListeners().iterator(); it.hasNext(); ) {
                    addEventListener( (RuleBaseEventListener) it.next() );
View Full Code Here

                                              final Environment environment) {
        if ( this.getConfig().isSequential() ) {
            throw new RuntimeException( "Cannot have a stateful rule session, with sequential configuration set to true" );
        }

        ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.getConfig().getExecutorService() );
        readLock();
        try {
            ReteooStatefulSession session = new ReteooStatefulSession( id,
                                                                       this,
                                                                       executor,
                                                                       sessionConfig,
                                                                       environment );
            new StatefulKnowledgeSessionImpl(session);

            executor.setCommandExecutor( new CommandExecutor( session ) );

            if ( sessionConfig.isKeepReference() ) {
                super.addStatefulSession( session );
                for (Object listener : session.getRuleBaseUpdateListeners()) {
                    addEventListener((RuleBaseEventListener) listener);
View Full Code Here

                                              final Environment environment) {
        if ( this.getConfig().isSequential() ) {
            throw new RuntimeException( "Cannot have a stateful rule session, with sequential configuration set to true" );
        }

        ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.getConfig().getExecutorService() );
        readLock();
        try {
            ReteooStatefulSession session = new ReteooStatefulSession( id,
                                                                       this,
                                                                       executor,
                                                                       sessionConfig,
                                                                       environment );
            new StatefulKnowledgeSessionImpl(session);

            executor.setCommandExecutor( new CommandExecutor( session ) );

            if ( sessionConfig.isKeepReference() ) {
                super.addStatefulSession( session );
                for (Object listener : session.getRuleBaseUpdateListeners()) {
                    addEventListener((RuleBaseEventListener) listener);
View Full Code Here

            throw new RuntimeException( "Cannot have a stateful rule session, with sequential configuration set to true" );
        }
        ReteooStatefulSession session  ;

        synchronized ( this.pkgs ) {
            ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.getConfig().getExecutorService() );
            session = new ReteooStatefulSession( id,
                                                 this,
                                                 executor,
                                                 sessionConfig,
                                                 environment );

            executor.setCommandExecutor( new CommandExecutor( session ) );

            if ( sessionConfig.isKeepReference() ) {
                super.addStatefulSession( session );
                for (Object listener : session.getRuleBaseUpdateListeners()) {
                    addEventListener((RuleBaseEventListener) listener);
View Full Code Here

    public void asyncExecute(final Object object) {
        InternalWorkingMemory wm = newWorkingMemory();

        final AssertObject assertObject = new AssertObject( object );
        ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.ruleBase.getConfiguration().getExecutorService() );
        executor.setCommandExecutor( new CommandExecutor( wm ) );
        executor.submit( assertObject );
        executor.submit( new FireAllRules( this.agendaFilter ) );
    }
View Full Code Here

    public void asyncExecute(final Object[] array) {
        InternalWorkingMemory wm = newWorkingMemory();

        final AssertObjects assertObjects = new AssertObjects( array );
        ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.ruleBase.getConfiguration().getExecutorService() );
        executor.setCommandExecutor( new CommandExecutor( wm ) );
        executor.submit( assertObjects );
        executor.submit( new FireAllRules( this.agendaFilter ) );
    }
View Full Code Here

    public void asyncExecute(final Collection collection) {
        InternalWorkingMemory wm = newWorkingMemory();

        final AssertObjects assertObjects = new AssertObjects( collection );
        ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.ruleBase.getConfiguration().getExecutorService() );
        executor.setCommandExecutor( new CommandExecutor( wm ) );
        executor.submit( assertObjects );
        executor.submit( new FireAllRules( this.agendaFilter ) );
    }
View Full Code Here

public class ExecutorServiceFactory {
   
    public static ExecutorService createExecutorService(String className) {       

        try {
            ExecutorService service = ( ExecutorService ) ClassUtils.instantiateObject( className );
           
            return service;           
        } catch ( Throwable e ) {
            throw new RuntimeException("Unable to instantiate ExecutorService '" + className + "'", e );
        }       
View Full Code Here

TOP

Related Classes of org.drools.concurrent.ExecutorService

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.