stopPolls();
OAuthClientService oAuthService = this.oAuthService;
if (oAuthService != null) {
- oAuthService.close();
+ oAuthService.removeAccessTokenRefreshListener(this);
+ oAuthFactory.ungetOAuthService(getThing().toString());
+ this.oAuthService = null;
}
}
+ @Override
+ public void handleRemoval() {
+ OAuthClientService oAuthService = this.oAuthService;
+ if (oAuthService != null) {
+ oAuthFactory.deleteServiceAndAccessToken(getThing().toString());
+ }
+ super.handleRemoval();
+ }
+
@Override
public Collection<Class<? extends ThingHandlerService>> getServices() {
return Collections.singleton(MyQDiscoveryService.class);