The User-Defined-Extension Classloader allows users to create classes that are available in multiple locations in an ACE environment. Let's say you've written some really useful classes, that you want to invoke from both Java Compute Nodes, and from a user-defined extension lil file. Till now this meant you had to place your classes on fairly central Javaclassloaders, which if you happen to rely on a class that ACE itself relies on can cause conflicts during runtime.
There are four "things" here:
- A Java class
MyFakeMap
- A C user-defined node in a lil that wants to use
MyFakeMap
- A Java Compute Node that wants to use
MyFakeMap
- An ACE Application with a flow to drive both of these
The important thing is that there should only ever be one MyFakeMap
class loaded.
Look at the example code in this directory and add similar code to your own:
MyFakeMap.java
Build this into a jar file (you'll need to build againstjplugin2.jar
.MQSI_USER_DEFINED_EXTENSION_CLASSPATH
set this environment to the directory containing the Jar file that you built above. you could set this inserver.conf.yaml
if you so desire.UdeLil.cpp
: This example code invokes a Java Map class to do some useful work, note how we acquire the pointer to the JVM and how we acquire a classloader. Specifically, look at how we acquire thecom/ibm/broker/classloading/ude/UserDefinedExtensionClassLoaderFactory
class, this is the key.Flow_JavaCompute.java
: This code doesn't need to explicitly ask for the above classloader, it has been injected for you.App.bar
contains the Application and the Java Compute Node, we hope these are fairly self-explanatory for advanced ACE users!
The supporting code for this was added in App Connect Enterprise 13.0.4.0