Java AddingActionListener to Terminate Creo Session Not Working
Hi everyone,
I am working in Java with Creo's OTK, and through JLink, I was able to connect to the currently running Creo Session. I want to add an ActionListener to my session object that detects when the session terminates. So far, I have this:
class CreoTerminationListener extends ActionListener_u implements AsyncActionListener {
@Override
public void OnTerminate(TerminationStatus terminationStatus) {
System.out.println("Termination detected!");
}
}
After loading in the pfcasyncmt library, I retrieve the session as such:
AsyncConnection async = null;
try {
async = pfcAsyncConnection.AsyncConnection_Connect(null, null, null, 5);
} catch (Exception e) {
System.err.println(e);
}
if (async == null) {
System.err.println("Async connection to Creo not established!");
return;
}
Session sess = async.GetSession();
creoTerminationListener = new CreoTerminationListener();
sess.AddActionListener(creoTerminationListener);
Then, I start an HTTP server through Creoson which communicates with the Creo client. My goal is to automate the termination of the Creoson server by detecting that the active Creo session has terminated, but as of right now, when I terminate the Creo session, nothing happens. There are no errors or anything either, which leads me to think the listener isn't picking anything up, Am I setting up the Action Listener wrong, or is there something else that I'm doing incorrectly? Any feedback will be greatly appreciated!

