/** * Obtains the current number of {@link CoherenceClusterMember}s in the underlying * {@link CoherenceCluster} by asking a {@link CoherenceClusterMember}. * * @return the current number of {@link CoherenceClusterMember}s */ public int getClusterSize() { Iterator<CoherenceClusterMember> members = iterator(); return members.hasNext() ? members.next().getClusterSize() : 0; }
/** * Obtains the current number of {@link CoherenceClusterMember}s in the underlying * {@link CoherenceCluster} by asking a {@link CoherenceClusterMember}. * * @return the current number of {@link CoherenceClusterMember}s */ public int getClusterSize() { Iterator<CoherenceClusterMember> members = iterator(); return members.hasNext() ? members.next().getClusterSize() : 0; }
/** * Obtains the current number of {@link CoherenceClusterMember}s in the underlying * {@link CoherenceCluster} by asking a {@link CoherenceClusterMember}. * * @return the current number of {@link CoherenceClusterMember}s */ public int getClusterSize() { Iterator<CoherenceClusterMember> members = iterator(); return members.hasNext() ? members.next().getClusterSize() : 0; }
@Override protected void onRelaunched(CoherenceClusterMember original, CoherenceClusterMember restarted, OptionsByType optionsByType) { // ensure that the original member UID is no longer in the cluster Decorations decorations = optionsByType.get(Decorations.class); UID originalMemberUID = decorations.get(UID.class); if (originalMemberUID != null) { // ensure that the restarted member is in the member set of the cluster ensure(eventually(invoking(this).getClusterMemberUIDs()), doesNotContain(originalMemberUID)); } // ensure the restarted member has joined the cluster // (without doing this the local member id returned below may be different from // the one when the member joins the cluster) ensure(eventually(invoking(restarted).getClusterSize()), greaterThan(1)); // determine the UID of the restarted member UID restartedMemberUID = restarted.getLocalMemberUID(); // ensure that the restarted member is in the member set of the cluster ensure(eventually(invoking(this).getClusterMemberUIDs()), contains(restartedMemberUID)); // notify the assembly of the change onChanged(optionsByType); }
@Override protected void onRelaunched(CoherenceClusterMember original, CoherenceClusterMember restarted, OptionsByType optionsByType) { // ensure that the original member UID is no longer in the cluster Decorations decorations = optionsByType.get(Decorations.class); UID originalMemberUID = decorations.get(UID.class); if (originalMemberUID != null) { // ensure that the restarted member is in the member set of the cluster ensure(eventually(invoking(this).getClusterMemberUIDs()), doesNotContain(originalMemberUID)); } // ensure the restarted member has joined the cluster // (without doing this the local member id returned below may be different from // the one when the member joins the cluster) ensure(eventually(invoking(restarted).getClusterSize()), greaterThan(1)); // determine the UID of the restarted member UID restartedMemberUID = restarted.getLocalMemberUID(); // ensure that the restarted member is in the member set of the cluster ensure(eventually(invoking(this).getClusterMemberUIDs()), contains(restartedMemberUID)); // notify the assembly of the change onChanged(optionsByType); }
@Override protected void onRelaunched(CoherenceClusterMember original, CoherenceClusterMember restarted, OptionsByType optionsByType) { // ensure that the original member UID is no longer in the cluster Decorations decorations = optionsByType.get(Decorations.class); UID originalMemberUID = decorations.get(UID.class); if (originalMemberUID != null) { // ensure that the restarted member is in the member set of the cluster ensure(eventually(invoking(this).getClusterMemberUIDs()), doesNotContain(originalMemberUID)); } // ensure the restarted member has joined the cluster // (without doing this the local member id returned below may be different from // the one when the member joins the cluster) ensure(eventually(invoking(restarted).getClusterSize()), greaterThan(1)); // determine the UID of the restarted member UID restartedMemberUID = restarted.getLocalMemberUID(); // ensure that the restarted member is in the member set of the cluster ensure(eventually(invoking(this).getClusterMemberUIDs()), contains(restartedMemberUID)); // notify the assembly of the change onChanged(optionsByType); }