@Override
public void initialize() {
- updateStatus(ThingStatus.UNKNOWN);
-
final ICalendarConfiguration currentConfiguration = getConfigAs(ICalendarConfiguration.class);
configuration = currentConfiguration;
}
final long refreshTime = refreshTimeBD.longValue();
if (calendarFile.isFile()) {
- if (reloadCalendar()) {
- updateStatus(ThingStatus.ONLINE);
- updateStates();
- rescheduleCalendarStateUpdate();
- } else {
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "The calendar seems to be configured correctly, but the local copy of calendar could not be loaded.");
- }
+ updateStatus(ThingStatus.ONLINE);
+
+ scheduler.submit(() -> {
+ // reload calendar file asynchronously
+ if (reloadCalendar()) {
+ updateStates();
+ } else {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
+ "The calendar seems to be configured correctly, but the local copy of calendar could not be loaded.");
+ }
+ });
pullJobFuture = scheduler.scheduleWithFixedDelay(regularPull, refreshTime, refreshTime,
TimeUnit.MINUTES);
} else {