I have a spring application, where i am reading a database constantly and putting filtered data in some other database. App is ready and now i want some other application (may be written in java, php or .net) to manage the execution of this application (I am new in web service), I am trying to integrate axis2 in spring app.
I have one business class extending the Thread class (Singleton):
[CODE]
public class BusinessObject extends Thread {
// ... some code here
private static BusinessObject obj;
private volatile boolean goAhead = false;
private BusinessObject(){
}
public static BusinessObject getInstance(){
if(obj == null){
obj = new BusinessObject();
}
return obj;
}
public void run(){
while(goAhead){
// ... some code here to read the database and update another database.
}
}
public void stop(){
goAhead = false;
}
public boolean status(){
return goAhead;
}
// ... some code here
}
}
[/CODE]
I have one service class extending ServletEndpointSupport
[CODE]
public class ProcessManagerService extends ServletEndpointSupport {
// ... some code here
BusinessObject bo = BusinessObject.getInstance();
public String start(){
if(!bo.status()){
bo.start();
}
return "RUNNING";
}
public String stop(){
if(bo.status()){
bo.stop();
}
return "NOT-RUNNING";
}
public String status(){
return ( ( bo.status )?"RUNNING":"NOT-RUNNING");
}
// ... some code here
}
[/CODE]
I exposed 3 methods:
start(); // to start the process in thread (i just want a single thread)
stop(); // to stop the thread
status(); // check the current status of that thread
i also configured in services.xml that this service will have shared access for all clients
[CODE]
Application
[/CODE]
but seems like still something wrong with the design/application.. it starting the thread but stop and status method not working.. can someone please advise how can i achieve my goal.
Regards
Mubeen