Class ConnectorExecutorImpl
java.lang.Object
org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl
- All Implemented Interfaces:
LifecycleService,TenantLifecycleService,ConnectorExecutor
Execute connectors directly
- Author:
- Baptiste Mesta, Celine Souchet, Matthieu Chaffotte
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConnectorExecutorImpl(int queueCapacity, int corePoolSize, 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
Modifier and TypeMethodDescriptionvoiddisconnect(SConnector sConnector) call disconnect method of the connectorexecute(SConnector sConnector, Map<String, Object> inputParameters, ClassLoader classLoader) Executes a connector.protected CompletableFuture<ConnectorExecutionResult>execute(SConnector sConnector, InterruptibleCallable<Map<String, 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, waitMethods inherited from interface org.bonitasoft.engine.commons.TenantLifecycleService
init
-
Field Details
-
NUMBER_OF_CONNECTORS_PENDING
- See Also:
-
NUMBER_OF_CONNECTORS_RUNNING
- See Also:
-
NUMBER_OF_CONNECTORS_EXECUTED
- See Also:
-
-
Constructor Details
-
ConnectorExecutorImpl
public ConnectorExecutorImpl(int queueCapacity, int corePoolSize, 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 setmaximumPoolSize- 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 Details
-
execute
public CompletableFuture<ConnectorExecutionResult> execute(SConnector sConnector, Map<String, Object> inputParameters, ClassLoader classLoader) throws SConnectorExceptionDescription 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 CompletableFuture<ConnectorExecutionResult> execute(SConnector sConnector, InterruptibleCallable<Map<String, Object>> task) -
disconnect
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
-