The Execution Unit (XU) is a resource adapter for Java™ EE Connector Architecture (JCA 1.5). The XU handles the low-level aspects of ruleset execution and collaborates with the server to provide several connector system-level contracts as a Service Provider Interface.
When an application server or container uses a resource adapter, the adapter operates in a managed environment, controlled by the container software.
The XU can also run independently of the management model. The XU makes configuration and runtime data available to the management model and implements the JCA contracts between the application server and the rule engine.
The application server or application client uses the XU to connect to the rule engine.
By plugging into an application server, the XU collaborates with the server to provide the following connector system-level contracts. Together, these contracts form a Service Provider Interface (SPI).
This contract links the XU and the transaction manager of the application server. A transaction is a set of operations that must be either committed all together or not committed at all, to maintain data consistency and integrity.
The XU supports only local transactions. An application server can thus manage only resources that are local to the XU. A local transaction involves only one non-XA resource and requires that all participating application components execute within one process. Local transaction optimization is specific to the resource manager and does not affect the Java EE application. In other words, simple rule sessions have no transaction boundary of their own and therefore do not define a new context for the XU transaction. As a consequence, the calling transaction can use only the XU local transaction resource.
Transaction management is not provided for the server ports supported by JRules V7. For more information, see the transaction.support attribute in res-setup.
This contract is established by the Rule Execution Server execution components. It provides secure access to the XU to protect its resources.
The Java EE Connector Architecture (JCA) defines the following set of system-level contracts:
For more information about Java EE Connector Architecture, see the Java EE Connector Architecture download page and The J2EE Connector Architecture's Resource Adapter article.
The XU is a stand-alone deployable unit that is packaged as a resource adapter archive file (RAR) for all supported Java EE application servers. The RAR file contains the XU and the persistence layer. You can embed the XU RAR file into an EAR file, like any Java EE connector.
The XU reads the ruleset from the persistence layer whenever the application server removes a cache entry from the JCA connection pool. The application server administrator can force the server to flush the pool or the server can choose to remove pool entries, based on resource constraints.
The path to the RAR file is <InstallDir>/executionserver/applicationservers/<appserver>/jrules-res-xu-<version>.rar. For Java SE, a JAR file named jrules-res-execution.jar is provided in the <InstallDir>/executionserver/lib directory.
The XU retrieves rulesets and provides scalability through the following capabilities:
All cache entries are linked to the JCA pool. All the XU resources are managed indirectly by the application server. Each instance of IlrContext is linked to an SPI connection, which is cached by the application server (the JCA pool). IlrRuleset objects are shared and kept in memory until no more IlrContext objects are based on it. At the end of an execution session, the server can decide to put the SPI connection back into the JCA pool. In this case, the associated IlrContext object is reset and ready for another execution.
You can modify the behavior of the Execution Unit by setting configuration properties. See Setting the XU configuration property.
You can also retrieve the XU memory usage for a specific ruleset. See Retrieving the XU memory usage.