Tuesday 24 November 2015

Byteman 3.0.3 release trials module imports using the JBoss Modules plugin

Byteman 3.0.3 is now available from the Byteman downloads page 

This release is a trial release for the new module import capability (contributed by Red Hat's very own James Livingstone). This new feature allows Byteman to be fully integrated into a modular JDK runtime. It includes generic support for module imports and a plugin which implements imports for JBoss Modules (plugins for  OSGi and Jigsaw will follow).

Byteman can now be configured to employ a module system-specific plugin to resolve  IMPORT statements embedded in individual rules or at the top level in a rule script. IMPORT statements allow classes deployed in the module named by the IMPORT statement to be used to resolve types mentioned in rules. This solves two common problems.

Firstly, this allows you to deploy your Helper classes in a module, making it possible for the Helper to rely on other modules in the runtime to implement the desired Helper behaviour. For example, you might want to inject code into a method of an XTS (Web Services Transactions) class and call a Helper method which validates execution at the trigger point by checking the state of the WS (Web Services) stack. You would deploy your Helper class in a module which imports the necessary WS API classes and then use an IMPORT statement to make your Helper class visible to your rule.

Secondly, your rules can directly reference classes in modules which are not visible from the rule's trigger class. For example, you might want to inject code into an EJB method which traces the execution of the EJB and also displays some of the current JBoss Transaction statistics. Importing the JBoss Transaction module allows your rule to refer to the JBoss Transaction static data & methods which expose these statistics.

Details of how to configure the JBoss Modules plugin and examples of how to import modules will be provided in a separate blog post. If you are interested in using the plugin and want more information or advice please contact the developers either on IRC or on the Byteman user forum.

No comments:

Post a Comment