All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.drools.grid.internal.commands.ExecutionNodeClientConnectCommand Maven / Gradle / Ivy

There is a newer version: 5.6.0.Final
Show newest version
package org.drools.grid.internal.commands;

import org.drools.command.Context;
import org.drools.command.impl.GenericCommand;
import org.drools.command.impl.KnowledgeCommandContext;
import org.drools.grid.io.impl.NodeData;
import org.drools.runtime.impl.ExecutionResultImpl;

public class ExecutionNodeClientConnectCommand
    implements
    GenericCommand {

    private String outIdentifier;

    public ExecutionNodeClientConnectCommand(String outIdentifier) {
        this.outIdentifier = outIdentifier;
    }

    public Integer execute(Context context) {
        NodeData data = (NodeData) context.get( NodeData.NODE_DATA );

        Integer sessionId = data.getSessionIdCounter().getAndIncrement();
        if ( this.outIdentifier != null ) {
            ((ExecutionResultImpl) ((KnowledgeCommandContext) context).getExecutionResults()).getResults().put( this.outIdentifier,
                                                                                                                sessionId );
        }

        return sessionId;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy