Hi All,

I am trying to build a bundle which would run a scheduled service to do some background tasks at a regular interval.

I used the blog post from oktober 2015 to get started so I made the following service:

@Component( property = CronJob.CRON + "=* * * * * * ?" ) public class CronComponent implements CronJob @Override public void run(Object data) throws Exception { System.out.println("Cron Component"); } } This service should run every second. When I run this bundle nothing actually happens.... When I create a service tracker for the scheduler service and initiate the service tracker in the bundle Activator I get a NullPointerException with the message the cron syntax is incorrect. When I stop and start the bundle in the running session all of a sudden see the println statement output. It seems I need to start the Scheduler Service or the CronComponent service in some different order. (I assume the Scheduler service needs to be running first...)
How could this be done?
With kind regards,

Misja Heuveling
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to