package org.jfox.ejb.invoker;
import java.rmi.RemoteException;
import java.util.Date;
import javax.naming.Context;
import org.huihoo.jfox.system.ServiceSupport;
import org.huihoo.jfox.system.State;
import org.jfox.ejb.Container;
import org.jfox.ejb.ContainerImpl;
public abstract class ContainerServiceSupport extends ServiceSupport {
protected final static String INVOKER_JNDI_PREFIX = ContainerInvokerHelper.INVOKER_JNDI_PREFIX;
protected static transient Context INITIAL_CONTEXT = ContainerInvokerHelper.INITIAL_CONTEXT;
protected final static Container container = ContainerImpl.getInstance();
protected void doInit() throws Exception {
if(State.canInit(container.getState())) {
container.init();
}
}
public void ping() throws RemoteException {
logger.debug("I'm alive :) " + new Date());
}
public void run() {
while(isRunning()){
try{
Thread.sleep(5 * 60 * 1000L);
ping();
}
catch(Exception e){
e.printStackTrace();
}
}
}
}