/** * Obtains a proxy of the specified {@link NamedCache} available in the * {@link CoherenceCluster}. * * @param cacheName the name of the {@link NamedCache} * * @return a proxy to the {@link NamedCache} */ public NamedCache getCache(String cacheName) { Iterator<CoherenceClusterMember> members = iterator(); return members.hasNext() ? members.next().getCache(cacheName) : null; }
@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 onRelaunching(CoherenceClusterMember member, OptionsByType optionsByType) { // get the current MemberUID and record it (or make the application remember it) UID memberUID = member.getLocalMemberUID(); // add the member as a decoration to the OptionsByType optionsByType.add(Decoration.of(memberUID)); // notify the assembly of the change onChanged(optionsByType); }
@Override protected CoherenceCluster createAssembly(OptionsByType optionsByType) { // introduce a StabilityPredicate optionsByType.addIfAbsent(StabilityPredicate.of(CoherenceCluster.Predicates.autoStartServicesSafe())); return new CoherenceCluster(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 onRelaunching(CoherenceClusterMember member, OptionsByType optionsByType) { // get the current MemberUID and record it (or make the application remember it) UID memberUID = member.getLocalMemberUID(); // add the member as a decoration to the OptionsByType optionsByType.add(Decoration.of(memberUID)); // notify the assembly of the change onChanged(optionsByType); }
@Override protected CoherenceCluster createAssembly(OptionsByType optionsByType) { // introduce a StabilityPredicate optionsByType.addIfAbsent(StabilityPredicate.of(CoherenceCluster.Predicates.autoStartServicesSafe())); return new CoherenceCluster(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); }
/** * Obtains the member {@link UID}s for the {@link CoherenceCluster}. * * @return a {@link Set} of {@link UID}, one for each {@link CoherenceClusterMember} */ public Set<UID> getClusterMemberUIDs() { Iterator<CoherenceClusterMember> members = iterator(); return members.hasNext() ? members.next().getClusterMemberUIDs() : new TreeSet<UID>(); }
@Override protected void onRelaunching(CoherenceClusterMember member, OptionsByType optionsByType) { // get the current MemberUID and record it (or make the application remember it) UID memberUID = member.getLocalMemberUID(); // add the member as a decoration to the OptionsByType optionsByType.add(Decoration.of(memberUID)); // notify the assembly of the change onChanged(optionsByType); }
@Override protected CoherenceCluster createAssembly(OptionsByType optionsByType) { // introduce a StabilityPredicate optionsByType.addIfAbsent(StabilityPredicate.of(CoherenceCluster.Predicates.autoStartServicesSafe())); return new CoherenceCluster(optionsByType); } }
/** * 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 member {@link UID}s for the {@link CoherenceCluster}. * * @return a {@link Set} of {@link UID}, one for each {@link CoherenceClusterMember} */ public Set<UID> getClusterMemberUIDs() { Iterator<CoherenceClusterMember> members = iterator(); return members.hasNext() ? members.next().getClusterMemberUIDs() : new TreeSet<UID>(); }
/** * 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 a proxy of the specified {@link NamedCache} available in the * {@link CoherenceCluster}. * * @param cacheName the name of the {@link NamedCache} * * @return a proxy to the {@link NamedCache} */ public NamedCache getCache(String cacheName) { Iterator<CoherenceClusterMember> members = iterator(); return members.hasNext() ? members.next().getCache(cacheName) : null; }
/** * Obtains the member {@link UID}s for the {@link CoherenceCluster}. * * @return a {@link Set} of {@link UID}, one for each {@link CoherenceClusterMember} */ public Set<UID> getClusterMemberUIDs() { Iterator<CoherenceClusterMember> members = iterator(); return members.hasNext() ? members.next().getClusterMemberUIDs() : new TreeSet<UID>(); }
/** * 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; }