Skip to content
Browse files

[MSC-126] fixing issue - it is possible that dependent can be null on…

… MSC shutdown
  • Loading branch information...
1 parent 2a737b4 commit 05f5c74d7212d6c8a34c384f1997708aecaf3545 @ropalka ropalka committed with dmlloyd
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/main/java/org/jboss/msc/service/OptionalDependency.java
View
6 src/main/java/org/jboss/msc/service/OptionalDependency.java
@@ -180,6 +180,7 @@ public void removeDemand() {
final boolean depFailed;
final Dependent dependent;
synchronized (this) {
+ dependent = this.dependent;
demandedByDependent = false;
depState = dependencyState;
transDepUnavailable = transitiveDependencyUnavailable;
@@ -189,9 +190,8 @@ public void removeDemand() {
startNotifying = false;
} else {
notifyOptionalDependency = false;
- startNotifying = forwardNotifications = dependencyState.compareTo(DependencyState.AVAILABLE) >= 0;//);
+ startNotifying = forwardNotifications = dependencyState.compareTo(DependencyState.AVAILABLE) >= 0 && dependent != null;
}
- dependent = this.dependent;
}
if (startNotifying) {
if (depState == DependencyState.AVAILABLE) {
@@ -295,7 +295,7 @@ public void immediateDependencyUnavailable(ServiceName dependencyName) {
depState = dependencyState;
transitiveDepUnavailable = transitiveDependencyUnavailable;
depFailed = dependencyFailed;
- notificationsForwarded = forwardNotifications;
+ notificationsForwarded = forwardNotifications && dependent != null;
forwardNotifications = false;
dependencyState = DependencyState.UNAVAILABLE;
demandNotified = demandedByDependent;

0 comments on commit 05f5c74

Please sign in to comment.
Something went wrong with that request. Please try again.