Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another round of MSC fixes #51

Merged
merged 37 commits into from
Oct 30, 2017
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
87314ff
[MSC-170] Fixing startup lifecycleTime computation issue. Moving it t…
ropalka Feb 2, 2017
e7c9701
[MSC-181] Refactoring - no functional change.
ropalka May 24, 2017
a353add
[MSC-181] Refactoring - no functional change.
ropalka May 24, 2017
f95a5a9
[MSC-181] Refactoring - no functional change.
ropalka May 24, 2017
66af7c0
[MSC-180] Refactoring - no functional change.
ropalka Feb 8, 2017
c03c0ac
[MSC-180][MSC-167] Refactoring - no functional change. Splitting Depe…
ropalka Jan 26, 2017
432a97c
[MSC-180][MSC-168] Refactoring - no functional change. Splitting Stop…
ropalka Jan 26, 2017
2404a8c
[MSC-180][MSC-157] Refactoring - no functional change. Introducing ne…
ropalka Feb 2, 2017
4aad96a
Removing obsolete and now useless MSC benchmark tests.
ropalka Jun 5, 2017
f9e61a2
Removing all byteman based tests. There are two kinds of problems wit…
ropalka Jun 5, 2017
21da500
Refactoring - no functional change. Renaming ServiceUn/availableTask …
ropalka Jun 6, 2017
752f802
Refactoring - no functional change. Reordering inner classes.
ropalka Jun 6, 2017
d59ea2f
[MSC-182] Introducing DependenciesControllerTask base class.
ropalka Jun 6, 2017
0fe9f4c
[MSC-182] Refactoring - no functional change. Introducing new categor…
ropalka Jun 6, 2017
4fb8f48
[MSC-183] Introducing DependentsControllerTask base class.
ropalka Jun 6, 2017
8ad920b
[MSC-183] Refactoring - no functional change. Introducing new categor…
ropalka Jun 6, 2017
6b59975
[MSC-183] Refactoring - no functional change. Eliminating ServiceCont…
ropalka Jun 6, 2017
a954cac
[MSC-183] Refactoring - no functional change. Moving execute() to Dep…
ropalka Jun 6, 2017
05abd6f
Refactoring - no functional change. All ServiceControllerImpl inner c…
ropalka Jun 6, 2017
8ca9fe5
[MSC-179] partial revert of commit id a3d68c0a.
ropalka Jun 21, 2017
445d5c4
Refactoring - no functional change. Enforcing FAIL FAST best practices.
ropalka Jun 3, 2017
4a53b8b
Removing tests on OPTIONAL dependencies.
ropalka Jun 9, 2017
cccc4a5
[MSC-184] Completely fixing buggy optional dependency implementation.
ropalka Apr 26, 2017
6d517be
[MSC-184][MSC-185] Implementing 'dependents started counting' mechani…
ropalka Mar 24, 2017
29dbff7
[MSC-186] Since now on listener transition notifications
ropalka Feb 9, 2017
4fe0ccf
[MSC-187] Introducing 'dependent tasks execution completion detection…
ropalka Jun 7, 2017
5fca3e5
[MSC-187] Revisited and reimplemented ServiceRegistrationImpl locking…
ropalka Jun 7, 2017
83ab427
[MSC-188] Fixing controller locked forever in START_REQUESTED state i…
ropalka May 13, 2017
a0dd8e5
[MSC-189] Fixing controller async tasks count invariant breakage.
ropalka Jun 19, 2017
4e716bb
[MSC-190] Controller can create new tasks as response for incoming
ropalka Jun 20, 2017
55c56ec
[MSC-191] Always ensure all controller invariants
ropalka Mar 22, 2017
b0174a0
[MSC-192] Eliminating notion of 'transitive notifications'
ropalka Mar 16, 2017
aaa0cb0
Refactoring - no functional change.
ropalka Sep 5, 2017
6ecde00
Refactoring - no functional change.
ropalka Jun 9, 2017
becc235
Test that attempts to replicate the failure
stuartwdouglas Jan 5, 2017
5ef9dc0
More detailed logging on failure
bstansberry Jan 5, 2017
d07879a
[MSC-193] Fixing broken ServiceContainer shutdown process.
ropalka Sep 14, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
104 changes: 46 additions & 58 deletions src/main/java/org/jboss/msc/service/ServiceControllerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1451,34 +1451,6 @@ ServiceRegistrationImpl[] getAliasRegistrations() {
return aliasRegistrations;
}

/**
* Returns a compiled array of all dependents of this service instance.
*
* @return an array of dependents, including children
*/
private Dependent[][] getDependents() {
IdentityHashSet<Dependent> dependentSet = primaryRegistration.getDependents();
if (aliasRegistrations.length == 0) {
synchronized (dependentSet) {
return new Dependent[][] { dependentSet.toScatteredArray(NO_DEPENDENTS),
children.toScatteredArray(NO_DEPENDENTS)};
}
}
Dependent[][] dependents = new Dependent[aliasRegistrations.length + 2][];
synchronized (dependentSet) {
dependents[0] = dependentSet.toScatteredArray(NO_DEPENDENTS);
}
dependents[1] = children.toScatteredArray(NO_DEPENDENTS);
for (int i = 0; i < aliasRegistrations.length; i++) {
final ServiceRegistrationImpl alias = aliasRegistrations[i];
final IdentityHashSet<Dependent> aliasDependentSet = alias.getDependents();
synchronized (aliasDependentSet) {
dependents[i + 2] = aliasDependentSet.toScatteredArray(NO_DEPENDENTS);
}
}
return dependents;
}

/**
* Returns a compiled map of all dependents of this service mapped by the dependency name.
* This map can be used when it is necessary to perform notifications to these dependents that require
Expand Down Expand Up @@ -1621,9 +1593,11 @@ final boolean execute() {
}

private abstract class DependentsControllerTask extends ControllerTask {
protected final Dependent[][] dependents;
protected final Map<ServiceName, Dependent[]> dependents;
protected final Dependent[] children;
private DependentsControllerTask() {
dependents = getDependents();
dependents = getDependentsByDependencyName();
children = ServiceControllerImpl.this.children.toScatteredArray(NO_DEPENDENTS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we benchmarked this against the array approach? The array approach was ugly but fast.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for benchmarking now because this is work in progress that will be changed in next pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to have a look in advance this is the change I am talking about:
ropalka@0bfdddf#diff-fd8643d01445d7e64971875e1b6a1d26R1684

}
}

Expand All @@ -1648,14 +1622,6 @@ private class DependentStoppedTask extends DependenciesControllerTask {
}

private class DependencyAvailableTask extends DependentsControllerTask {
private final Map<ServiceName, Dependent[]> dependents;
private final Dependent[] children;

DependencyAvailableTask() {
dependents = getDependentsByDependencyName();
children = ServiceControllerImpl.this.children.toScatteredArray(NO_DEPENDENTS);
}

boolean execute() {
for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) {
ServiceName serviceName = dependentEntry.getKey();
Expand All @@ -1672,14 +1638,6 @@ boolean execute() {
}

private class DependencyUnavailableTask extends DependentsControllerTask {
private final Map<ServiceName, Dependent[]> dependents;
private final Dependent[] children;

DependencyUnavailableTask() {
dependents = getDependentsByDependencyName();
children = ServiceControllerImpl.this.children.toScatteredArray(NO_DEPENDENTS);
}

boolean execute() {
for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) {
ServiceName serviceName = dependentEntry.getKey();
Expand All @@ -1697,66 +1655,96 @@ boolean execute() {

private class DependencyStartedTask extends DependentsControllerTask {
boolean execute() {
for (Dependent[] dependentArray : dependents) {
for (Dependent dependent : dependentArray) {
for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) {
ServiceName serviceName = dependentEntry.getKey();
for (Dependent dependent : dependentEntry.getValue()) {
if (dependent != null) dependent.immediateDependencyUp();
}
}
final ServiceName primaryRegistrationName = primaryRegistration.getName();
for (Dependent child : children) {
if (child != null) child.immediateDependencyUp();
}
return true;
}
}

private class DependencyStoppedTask extends DependentsControllerTask {
boolean execute() {
for (Dependent[] dependentArray : dependents) {
for (Dependent dependent : dependentArray) {
for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) {
ServiceName serviceName = dependentEntry.getKey();
for (Dependent dependent : dependentEntry.getValue()) {
if (dependent != null) dependent.immediateDependencyDown();
}
}
final ServiceName primaryRegistrationName = primaryRegistration.getName();
for (Dependent child : children) {
if (child != null) child.immediateDependencyDown();
}
return true;
}
}

private class DependencyFailedTask extends DependentsControllerTask {
boolean execute() {
for (Dependent[] dependentArray : dependents) {
for (Dependent dependent : dependentArray) {
for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) {
ServiceName serviceName = dependentEntry.getKey();
for (Dependent dependent : dependentEntry.getValue()) {
if (dependent != null) dependent.dependencyFailed();
}
}
final ServiceName primaryRegistrationName = primaryRegistration.getName();
for (Dependent child : children) {
if (child != null) child.dependencyFailed();
}
return true;
}
}

private class DependencyRetryingTask extends DependentsControllerTask {
boolean execute() {
for (Dependent[] dependentArray : dependents) {
for (Dependent dependent : dependentArray) {
for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) {
ServiceName serviceName = dependentEntry.getKey();
for (Dependent dependent : dependentEntry.getValue()) {
if (dependent != null) dependent.dependencyFailureCleared();
}
}
final ServiceName primaryRegistrationName = primaryRegistration.getName();
for (Dependent child : children) {
if (child != null) child.dependencyFailureCleared();
}
return true;
}
}

private class TransitiveDependencyAvailableTask extends DependentsControllerTask {
boolean execute() {
for (Dependent[] dependentArray : dependents) {
for (Dependent dependent : dependentArray) {
for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) {
ServiceName serviceName = dependentEntry.getKey();
for (Dependent dependent : dependentEntry.getValue()) {
if (dependent != null) dependent.transitiveDependencyAvailable();
}
}
final ServiceName primaryRegistrationName = primaryRegistration.getName();
for (Dependent child : children) {
if (child != null) child.transitiveDependencyAvailable();
}
return true;
}
}

private class TransitiveDependencyUnavailableTask extends DependentsControllerTask {
boolean execute() {
for (Dependent[] dependentArray : dependents) {
for (Dependent dependent : dependentArray) {
for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) {
ServiceName serviceName = dependentEntry.getKey();
for (Dependent dependent : dependentEntry.getValue()) {
if (dependent != null) dependent.transitiveDependencyUnavailable();
}
}
final ServiceName primaryRegistrationName = primaryRegistration.getName();
for (Dependent child : children) {
if (child != null) child.transitiveDependencyUnavailable();
}
return true;
}
}
Expand Down