diff --git a/sensorhub-core/src/main/java/org/sensorhub/impl/database/system/SystemDriverDatabase.java b/sensorhub-core/src/main/java/org/sensorhub/impl/database/system/SystemDriverDatabase.java index 4e24155e8..9257b8ec3 100644 --- a/sensorhub-core/src/main/java/org/sensorhub/impl/database/system/SystemDriverDatabase.java +++ b/sensorhub-core/src/main/java/org/sensorhub/impl/database/system/SystemDriverDatabase.java @@ -80,6 +80,9 @@ protected void doStart() throws SensorHubException { throw new DataStoreException("Cannot instantiate underlying database " + config.dbConfig.moduleClass, e); } + + if(!config.autoPurgeConfig.isEmpty()) + autoPurgeTimer = new Timer(); // start auto-purge timer thread if policy is specified and enabled for(var autoPurgeConfig : config.autoPurgeConfig) @@ -88,7 +91,6 @@ protected void doStart() throws SensorHubException { var uids = Collections.unmodifiableCollection(autoPurgeConfig.systemUIDs); final IObsSystemDbAutoPurgePolicy policy = autoPurgeConfig.getPolicy(); - autoPurgeTimer = new Timer(); TimerTask task = new TimerTask() { public void run() {