enonic / app-snapshotter

A snapshotter app that captures snapshots of an EnonicXP installation at regular intervals
Other
0 stars 0 forks source link

SnapshotService may be unavailable #13

Closed rymsha closed 4 years ago

rymsha commented 4 years ago

SnapshotterHandler gets service in SnapshotService in initialize. But application can start before SnapshotService is started and null will be returned for context.getService().get() and SnapshotterHandler caches null value "forever".

The idea is that ServiceRegistry.get() is called every time when service is needed and checked for null. (Skipping a snapshot when service is not available is better than always issuing NPE). It could be a warning written into logs saying that service is not available.

anatol-sialitski commented 4 years ago

In case if service is null will be thrown an illegal argument exception 'Service not found, so no sense to do check on null