Class ConnectorExecutorImpl
- java.lang.Object
-
- org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl
-
- All Implemented Interfaces:
LifecycleService,TenantLifecycleService,ConnectorExecutor
public class ConnectorExecutorImpl extends java.lang.Object implements ConnectorExecutor
Execute connectors directly- Author:
- Baptiste Mesta, Celine Souchet, Matthieu Chaffotte
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classConnectorExecutorImpl.ExecuteConnectorCallable
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNUMBER_OF_CONNECTORS_EXECUTEDstatic java.lang.StringNUMBER_OF_CONNECTORS_PENDINGstatic java.lang.StringNUMBER_OF_CONNECTORS_RUNNING
-
Constructor Summary
Constructors Constructor Description ConnectorExecutorImpl(int queueCapacity, int corePoolSize, TechnicalLoggerService loggerService, int maximumPoolSize, long keepAliveTimeSeconds, SessionAccessor sessionAccessor, SessionService sessionService, TimeTracker timeTracker, io.micrometer.core.instrument.MeterRegistry meterRegistry, long tenantId, ExecutorServiceMetricsProvider executorServiceMetricsProvider)The handling of threads relies on the JVM The rules to create new thread are: - If the number of threads is less than the corePoolSize, create a new Thread to run a new task.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisconnect(SConnector sConnector)call disconnect method of the connectorjava.util.concurrent.CompletableFuture<ConnectorExecutionResult>execute(SConnector sConnector, java.util.Map<java.lang.String,java.lang.Object> inputParameters, java.lang.ClassLoader classLoader)Executes a connector.protected java.util.concurrent.CompletableFuture<ConnectorExecutionResult>execute(SConnector sConnector, InterruptibleCallable<java.util.Map<java.lang.String,java.lang.Object>> task)voidpause()Temporary halt the execution of this service.voidresume()resume the execution the servicevoidstart()Start the servicevoidstop()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bonitasoft.engine.commons.TenantLifecycleService
init
-
-
-
-
Field Detail
-
NUMBER_OF_CONNECTORS_PENDING
public static final java.lang.String NUMBER_OF_CONNECTORS_PENDING
- See Also:
- Constant Field Values
-
NUMBER_OF_CONNECTORS_RUNNING
public static final java.lang.String NUMBER_OF_CONNECTORS_RUNNING
- See Also:
- Constant Field Values
-
NUMBER_OF_CONNECTORS_EXECUTED
public static final java.lang.String NUMBER_OF_CONNECTORS_EXECUTED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ConnectorExecutorImpl
public ConnectorExecutorImpl(int queueCapacity, int corePoolSize, TechnicalLoggerService loggerService, int maximumPoolSize, long keepAliveTimeSeconds, SessionAccessor sessionAccessor, SessionService sessionService, TimeTracker timeTracker, io.micrometer.core.instrument.MeterRegistry meterRegistry, long tenantId, ExecutorServiceMetricsProvider executorServiceMetricsProvider)The handling of threads relies on the JVM The rules to create new thread are: - If the number of threads is less than the corePoolSize, create a new Thread to run a new task. - If the number of threads is equal (or greater than) the corePoolSize, put the task into the queue. - If the queue is full, and the number of threads is less than the maxPoolSize, create a new thread to run tasks in. - If the queue is full, and the number of threads is greater than or equal to maxPoolSize, reject the task.- Parameters:
queueCapacity- The maximum number of execution of connector to queue for each threadcorePoolSize- the number of threads to keep in the pool, even if they are idle, unlessallowCoreThreadTimeOutis setloggerService-maximumPoolSize- the maximum number of threads to allow in the poolkeepAliveTimeSeconds- when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating. (in seconds)
-
-
Method Detail
-
execute
public java.util.concurrent.CompletableFuture<ConnectorExecutionResult> execute(SConnector sConnector, java.util.Map<java.lang.String,java.lang.Object> inputParameters, java.lang.ClassLoader classLoader) throws SConnectorException
Description copied from interface:ConnectorExecutorExecutes a connector.- Specified by:
executein interfaceConnectorExecutor- Parameters:
sConnector- The connector will be executedinputParameters- The input parameters of connectorclassLoader- The classLoader within the connector will be executed- Returns:
- a completable future with the result
- Throws:
SConnectorException- Error thrown when error occurs in connector executing
-
execute
protected java.util.concurrent.CompletableFuture<ConnectorExecutionResult> execute(SConnector sConnector, InterruptibleCallable<java.util.Map<java.lang.String,java.lang.Object>> task)
-
disconnect
public void disconnect(SConnector sConnector) throws SConnectorException
Description copied from interface:ConnectorExecutorcall disconnect method of the connector- Specified by:
disconnectin interfaceConnectorExecutor- Throws:
SConnectorException
-
start
public void start()
Description copied from interface:LifecycleServiceStart the service- Specified by:
startin interfaceLifecycleService
-
stop
public void stop()
- Specified by:
stopin interfaceLifecycleService
-
pause
public void pause()
Description copied from interface:LifecycleServiceTemporary halt the execution of this service.- Specified by:
pausein interfaceLifecycleService
-
resume
public void resume()
Description copied from interface:LifecycleServiceresume the execution the service- Specified by:
resumein interfaceLifecycleService
-
-