Context: This is a client server app. At the moment the EJB looks like:
public class ServerSideJob {
@WebMethod(operationName = "launchJob")
public String launchJob(@WebParam(name = "idUser") String idUser, @WebParam(name = "name") String name, @WebParam(name = "param") Object param) {
Runnable controller = new JobController(screenName, fof, mm, job);
new Thread(controller).start();
return "job launched";
}
}
The job is launching several other threads.
At this point, I'd like to add the possibility for the client to interrupt the job. Interrupting a thread from "the outside" is quite a dirty affair (I'd have to add many more calls per op to a db just for that), and this prompts me to switch to Akka for the multithreading.
Problem: I am not sure how / if I can merge the Akka logic with the code of the EJB above. How do I call the top actor of my hierarchy from my launchJob function? (ok, surely a noob question...)
public class ServerSideJob {
@WebMethod(operationName = "launchJob")
public String launchJob(@WebParam(name = "idUser") String idUser, @WebParam(name = "name") String name, @WebParam(name = "param") Object param) {
//how do I call my Akka actor here?
return "job launched";
}
}