Fix ISE during WatchService disposal (#3432)
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>pull/3436/head
parent
6d989ea6e2
commit
f9751448c1
|
@ -162,8 +162,12 @@ public class WatchServiceImpl implements WatchService, DirectoryChangeListener {
|
|||
}
|
||||
|
||||
ServiceRegistration<?> localReg = this.reg;
|
||||
if (localReg != null && bundleContext.getService(localReg.getReference()) != null) {
|
||||
localReg.unregister();
|
||||
if (localReg != null) {
|
||||
try {
|
||||
localReg.unregister();
|
||||
} catch (IllegalStateException e) {
|
||||
logger.debug("WatchService '{}' was already unregistered.", name, e);
|
||||
}
|
||||
this.reg = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue