Class SessionCachingMetadataDomainRepository.PentahoAsyncThreadRunner
java.lang.Object
org.pentaho.platform.plugin.services.metadata.SessionCachingMetadataDomainRepository.PentahoAsyncThreadRunner
- Enclosing class:
- SessionCachingMetadataDomainRepository
Asynchronously executes a collection of tasks (ie
Callable
). Contains logic that correctly
sets the IPentahoSession
for each spawned thread. Wrapper around ExecutorService
.-
Constructor Summary
ConstructorsConstructorDescriptionPentahoAsyncThreadRunner
(int numberOfThreads, org.pentaho.platform.api.engine.IPentahoSession pentahoSession) Constructor to set necessary information for underlyingExecutorService
instance.PentahoAsyncThreadRunner
(int numberOfThreads, org.pentaho.platform.api.engine.IPentahoSession pentahoSession, String threadMasterName, String threadExecutorNamingPattern) Constructor to set necessary information for underlyingExecutorService
instance. -
Method Summary
Modifier and TypeMethodDescription<T> Thread
asyncRun
(Collection<? extends Callable<T>> tasks) Asynchronously execute alltasks
.
-
Constructor Details
-
PentahoAsyncThreadRunner
public PentahoAsyncThreadRunner(int numberOfThreads, org.pentaho.platform.api.engine.IPentahoSession pentahoSession, String threadMasterName, String threadExecutorNamingPattern) Constructor to set necessary information for underlyingExecutorService
instance.- Parameters:
numberOfThreads
-pentahoSession
-threadMasterName
-threadExecutorNamingPattern
-
-
PentahoAsyncThreadRunner
public PentahoAsyncThreadRunner(int numberOfThreads, org.pentaho.platform.api.engine.IPentahoSession pentahoSession) Constructor to set necessary information for underlyingExecutorService
instance.- Parameters:
numberOfThreads
-pentahoSession
-
-
-
Method Details
-
asyncRun
Asynchronously execute alltasks
. Setup overhead for initialization of threading infrastructure will have minimal or no effect on runtime execution of calling class. Wrapper aroundExecutorService
.- Parameters:
tasks
- Collection of tasks that will be executed. For each callable, Return non-empty string for success, null otherwise.- Returns:
- thread used to execute the running of the
tasks
. The functionThread.start()
will have already been called.
-