You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2016/12/14 09:58:21 UTC
svn commit: r1774158 -
/sling/trunk/bundles/extensions/serviceusermapper/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
Author: cziegeler
Date: Wed Dec 14 09:58:21 2016
New Revision: 1774158
URL: http://svn.apache.org/viewvc?rev=1774158&view=rev
Log:
SLING-6397 : Error logged by ServiceUserMapperImpl while unregistering an already unregistered service
Modified:
sling/trunk/bundles/extensions/serviceusermapper/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
Modified: sling/trunk/bundles/extensions/serviceusermapper/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/serviceusermapper/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java?rev=1774158&r1=1774157&r2=1774158&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/serviceusermapper/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java (original)
+++ sling/trunk/bundles/extensions/serviceusermapper/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java Wed Dec 14 09:58:21 2016
@@ -151,10 +151,10 @@ public class ServiceUserMapperImpl imple
@Deactivate
synchronized void deactivate() {
- RegistrationSet registrationSet = null;
+ // this call does not unregister the mappings, but they should be unbound
+ // through the unbind methods anyway
updateServiceRegistrations(new Mapping[0]);
bundleContext = null;
- this.executeServiceRegistrationsAsync(registrationSet);
if (executorService != null) {
executorService.shutdown();
executorService = null;
@@ -305,13 +305,13 @@ public class ServiceUserMapperImpl imple
}
- private void executeServiceRegistrations(RegistrationSet registrationSet) {
+ private void executeServiceRegistrations(final RegistrationSet registrationSet) {
if (registrationSet == null) {
return;
}
- for (Registration registration : registrationSet.removed) {
+ for (final Registration registration : registrationSet.removed) {
ServiceRegistration serviceRegistration = registration.setService(null);
@@ -320,8 +320,8 @@ public class ServiceUserMapperImpl imple
try {
serviceRegistration.unregister();
log.debug("Unregistered ServiceUserMapped {}", registration.mapping);
- } catch (IllegalStateException e) {
- log.error("cannot unregister ServiceUserMapped {}", registration.mapping, e);
+ } catch (final IllegalStateException e) {
+ // this can happen on shutdown, therefore we just ignore it and don't log
}
}
}
@@ -332,7 +332,7 @@ public class ServiceUserMapperImpl imple
return;
}
- for (Registration registration : registrationSet.added) {
+ for (final Registration registration : registrationSet.added) {
Mapping mapping = registration.mapping;
final Dictionary<String, Object> properties = new Hashtable<String, Object>();
if (mapping.getSubServiceName() != null) {
@@ -349,8 +349,8 @@ public class ServiceUserMapperImpl imple
if (oldServiceRegistration != null) {
try {
oldServiceRegistration.unregister();
- } catch (IllegalStateException e) {
- log.error("cannot unregister ServiceUserMapped {}", registration.mapping, e);
+ } catch (final IllegalStateException e) {
+ // this can happen on shutdown, therefore we just ignore it and don't log
}
}
}
@@ -359,9 +359,9 @@ public class ServiceUserMapperImpl imple
private String internalGetUserId(final String serviceName, final String subServiceName) {
log.debug(
- "internalGetUserId: {} active mappings, looking for mapping for {}/{}",
+ "internalGetUserId: {} active mappings, looking for mapping for {}/{}",
new Object[] { this.activeMappings.length, serviceName, subServiceName });
-
+
for (final Mapping mapping : this.activeMappings) {
final String userId = mapping.map(serviceName, subServiceName);
if (userId != null) {
@@ -372,9 +372,9 @@ public class ServiceUserMapperImpl imple
// second round without serviceInfo
log.debug(
- "internalGetUserId: {} active mappings, looking for mapping for {}/<no subServiceName>",
+ "internalGetUserId: {} active mappings, looking for mapping for {}/<no subServiceName>",
this.activeMappings.length, serviceName);
-
+
for (Mapping mapping : this.activeMappings) {
final String userId = mapping.map(serviceName, null);
if (userId != null) {