Я создал очень простой Schedular, которые выполняются после каждой минуты, как показано ниже:Schedular не выполняется при добавлении массива значений
@Service(value = Runnable.class)
@Component(name = "Job A", label = "Job A", description = "Job will run after 1 min", metatype = true, immediate = true)
@Properties({
@Property(label = "Quartz Cron Expression", description = "Quartz Scheduler specific cron expression.", name = "scheduler.expression", value = "0 0/1 * 1/1 * ? *"),
@Property(unbounded=PropertyUnbounded.ARRAY, value={"*"}, label = "Root Path", name = "domain.rootpath",
description = "Root Page"),
@Property(
label = "Allow concurrent executions",
description = "Allow concurrent executions of this Scheduled Service",
name = "scheduler.concurrent",
boolValue = true,
propertyPrivate = true
)
})
public class SimpleSchedular implements Runnable {
private static Logger logger = LoggerFactory.getLogger(SimpleSchedular.class);
private String[] rootPath;
public void run() {
logger.info("JOB A ::: "+rootPath.length);
}
@Activate
private void activate(final ComponentContext componentContext) {
final Dictionary<?, ?> properties = componentContext.getProperties();
this.rootPath = (String [])properties.get("domain.rootpath");
logger.info("JOB A Length of array ::: "+this.rootPath.length); //prints correct length
}
@Modified
private void modified(final ComponentContext componentContext) {
activate(componentContext);
}
}
Когда я построить код, этот код работает отлично и печать JOB A ::: 1
после одного мин. Но когда я добавляю несколько значений через domain.rootpath
через консоль OSGi, его вызов не вызывает метод run. Я могу видеть правильную длину массива при активации вызовов, но запуск menthod не выполняется. Есть идеи?