I try to make my msf4j jar become runnable (public class abcService implements Runnable, Microservice) When i deployed the jar to wso2 msf4j container, the runnable part is not working as "Main thread " and "Child Thread " is not displayed at the console.
package test.msf4j.abc;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.wso2.msf4j.Microservice;
@Path("/abcService")
public class abcService implements Runnable, Microservice {
@GET
@Path("/greeting")
public String message() {
System.out.println("hello");
return "Hello World";
}
public void run() {
for (int i = 0; i < 3; i++) {
System.out.println("Child Thread ");
try {
Thread.sleep(200);
} catch (InterruptedException ie) {
System.out.println("Child thread interrupted! " + ie);
}
}
System.out.println("Child thread finished!");
}
public static void main(String[] args) {
Thread t = new Thread(new abcService ());
t.start();
for (int i = 0; i < 3; i++) {
System.out.println("Main thread ");
try {
Thread.sleep(200);
} catch (InterruptedException ie) {
System.out.println("Child thread interrupted! " + ie);
}
}
System.out.println("Main thread finished!");
}
}