A code sample to release the child XU
The child rule session factory is a singleton instance in the managed XOM class loader that is associated to the main ruleset. When you unload the main ruleset (it goes out of the pool or the ruleset is modified), you must explicitly release the rule session factory.
To ensure that IlrJ2SESessionFactory releases all resources correctly, its
release method must be called.
The application cannot call the
release method easily because the instance is
created in a different class loader that cannot be accessed directly. The following code sample
solves this issue by calling the release method when the rule session factory
instance is unloaded from the memory (by calling the method
java.lang.Object.finalize):
private static class SessionFactory extends IlrJ2SESessionFactory {
[..]
@Override
public void finalize() {
release();
}
}