/** * Constructs a {@link CoherenceNamedCache}. * * @param member the {@link CoherenceClusterMember} that owns the {@link NamedCache} * @param cacheName the name of the {@link NamedCache} */ public CoherenceNamedCache(CoherenceClusterMember member, String cacheName) { this.member = member; this.cacheName = cacheName; this.producer = new RemoteCallableStaticMethod<NamedCache>("com.tangosol.net.CacheFactory", "getCache", cacheName); this.interceptor = new NamedCacheMethodInterceptor(); // determine the CoherenceCluster that the CoherenceClusterMember is part of Assembly assembly = member.get(Assembly.class); this.cluster = assembly instanceof CoherenceCluster ? Optional.of((CoherenceCluster) assembly) : Optional.empty(); }
/** * 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>(); }
boolean chooseNewMember = !member.isOperational() || retryCount > 0; throw new IllegalStateException("The underlying Cluster Member [" + member.getName() + "] is no longer available to perform the request [" + methodName + "]"); CompletableFuture future = member.submit(new RemoteMethodInvocation(producer, methodName, arguments,
@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 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 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); }
Set<String> serviceNames = member.invoke(new GetAutoStartServiceNames(), Caching.enabled()); Trilean trilean = member.invoke(new IsServiceStorageEnabled(serviceName)); Set<String> serviceNames = member.invoke(new GetAutoStartServiceNames(), Caching.enabled()); ServiceStatus status = member.invoke(new GetServiceStatus(serviceName)); ServiceStatus status = member.invoke(new GetServiceStatus(serviceName));
boolean chooseNewMember = !member.isOperational() || retryCount > 0; throw new IllegalStateException("The underlying Cluster Member [" + member.getName() + "] is no longer available to perform the request [" + methodName + "]"); CompletableFuture future = member.submit(new RemoteMethodInvocation(producer, methodName, arguments,
@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 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 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); }
Set<String> serviceNames = member.invoke(new GetAutoStartServiceNames(), Caching.enabled()); Trilean trilean = member.invoke(new IsServiceStorageEnabled(serviceName)); Set<String> serviceNames = member.invoke(new GetAutoStartServiceNames(), Caching.enabled()); ServiceStatus status = member.invoke(new GetServiceStatus(serviceName)); ServiceStatus status = member.invoke(new GetServiceStatus(serviceName));
boolean chooseNewMember = !member.isOperational() || retryCount > 0; throw new IllegalStateException("The underlying Cluster Member [" + member.getName() + "] is no longer available to perform the request [" + methodName + "]"); CompletableFuture future = member.submit(new RemoteMethodInvocation(producer, methodName, arguments,
@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 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; }
@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); }
/** * Constructs a {@link CoherenceNamedCache}. * * @param member the {@link CoherenceClusterMember} that owns the {@link NamedCache} * @param cacheName the name of the {@link NamedCache} */ public CoherenceNamedCache(CoherenceClusterMember member, String cacheName) { this.member = member; this.cacheName = cacheName; this.producer = new RemoteCallableStaticMethod<NamedCache>("com.tangosol.net.CacheFactory", "getCache", cacheName); this.interceptor = new NamedCacheMethodInterceptor(); // determine the CoherenceCluster that the CoherenceClusterMember is part of Assembly assembly = member.get(Assembly.class); this.cluster = assembly instanceof CoherenceCluster ? Optional.of((CoherenceCluster) assembly) : Optional.empty(); }