Skip to content

ot4i/UserDefinedExtensionClassLoader

Repository files navigation

User Defined Extension Classloader

Why?

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.

What?

There are four "things" here:

  1. A Java class MyFakeMap
  2. A C user-defined node in a lil that wants to use MyFakeMap
  3. A Java Compute Node that wants to use MyFakeMap
  4. 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.

How?

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 against jplugin2.jar.
  • MQSI_USER_DEFINED_EXTENSION_CLASSPATH set this environment to the directory containing the Jar file that you built above. you could set this in server.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 the com/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!

When?

The supporting code for this was added in App Connect Enterprise 13.0.4.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published