THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
package org.servicemix.tutorial;
import java.util.Timer;
import java.util.TimerTask;
import javax.jbi.JBIException;
import org.servicemix.client.ServiceContext;
import org.servicemix.client.ServiceLifeCycleImplementation;
/**
* A simple Timer based component
*
* @author <a href="mailto:pdodds@unity-systems.com">Philip Dodds </a>
*/
public class TimerComponent extends TimerTask implements
ServiceLifeCycleImplementation {
private Timer timer;
private ServiceContext serviceContext;
/*
* (non-Javadoc)
*
* @see org.servicemix.client.ServiceLifeCycleImplementation#init(org.servicemix.client.ServiceContext)
*/
public void init(ServiceContext serviceContext) throws JBIException {
this.serviceContext = serviceContext;
timer = new Timer();
timer.schedule(this, 5000);
}
/*
* (non-Javadoc)
*
* @see org.servicemix.client.ServiceLifeCycleImplementation#start()
*/
public void start() throws JBIException {
timer.schedule(this, 5000);
}
/*
* (non-Javadoc)
*
* @see org.servicemix.client.ServiceLifeCycleImplementation#stop()
*/
public void stop() throws JBIException {
timer.cancel();
}
/*
* (non-Javadoc)
*
* @see java.util.TimerTask#run()
*/
public void run() {
}
}
|
...