T - The Builder type, one of the following: ActionBuilder, ReturnValueEvaluatorBuilder, AssignmentBuilder or
ProcessClassBuilder.public abstract class ThreadLocalAbstractBuilderFacade<T> extends Object
BPMN2DataServiceImpl instance collects process information,
we use the same DataServiceExpressionBuilder instance. This happens because of the ThreadLocal<DataServiceExpressionBuilder>
field in the implementations of this class.
However, the DataServiceExpressionBuilder instance also contains
a ThreadLocal variable to store ProcessDescRepoHelper instances.
That way we can use a particular thread local ProcessDescRepoHelper instance
per thread to save all the information for the particular process being built: see
useDataServiceBuilder(ProcessDescRepoHelper).
The main reason for this architecture is that the jbpm-flow/jbpm-bpmn2 infrastructure calls
ProcessDialectRegistry.getDialect(String) directly -- while the data service
only needs to replace the result of the ProcessDialect.getActionBuilder() and similar methods.
The logic looks like this:
BPMN2DataServiceImpl sets the thread-local ProcessDescRepoHelper instance on the various builders
(via this class)KnowledgeBuilder is processing a definition, ProcessDialectRegistry.getDialect(String) is called
when a script or expression is encountered.ProcessDialectRegistry.getDialect(String) returns a data service implemenation of a dialect,
for example: DataServiceJavaProcessDialect.ProcessDialect.getActionBuilder() returns the (singleton) ThreadLocalAbstractBuilderFacade implementation
of the ActionBuilder instanceActionBuilder instance is called, it collects information into the thread-local
ProcessDescRepoHelper instanceActionBuilder field in the
ThreadLocalAbstractBuilderFacade implementation is reset to the defaul JavaActionBuilder.
| Constructor and Description |
|---|
ThreadLocalAbstractBuilderFacade() |
| Modifier and Type | Method and Description |
|---|---|
abstract DataServiceExpressionBuilder |
getDataServiceBuilderInstance() |
abstract T |
getDefaultBuilderInstance() |
abstract T |
getThreadLocalBuilder() |
void |
resetThreadLocalBuilder() |
abstract void |
setThreadLocalBuilder(T actionBuilder) |
void |
useDataServiceBuilder(ProcessDescRepoHelper helper) |
public abstract T getThreadLocalBuilder()
public abstract void setThreadLocalBuilder(T actionBuilder)
public abstract DataServiceExpressionBuilder getDataServiceBuilderInstance()
public abstract T getDefaultBuilderInstance()
public void useDataServiceBuilder(ProcessDescRepoHelper helper)
public void resetThreadLocalBuilder()
Copyright © 2001–2015 JBoss by Red Hat. All rights reserved.