Object writeReplace() { String s = uri.getScheme(); if (s.equals("node")) { return new NodeAffinity(uri.getSchemeSpecificPart()); } else if (s.equals("cluster")) { return new ClusterAffinity(uri.getSchemeSpecificPart()); } else if (s.equals("local")) { return LOCAL; } else { // keep same object return this; } }
/** * Get the affinity specification corresponding to the given URI. * * @param uri the URI * @return the affinity specification (not {@code null}) */ public static Affinity forUri(URI uri) { if (uri == null || ! uri.isAbsolute()) return NONE; final String scheme = uri.getScheme(); assert scheme != null; // due to isAbsolute() check switch (scheme) { case "node": return new NodeAffinity(uri.getSchemeSpecificPart()); case "cluster": return new ClusterAffinity(uri.getSchemeSpecificPart()); case "local": return LOCAL; default: return new URIAffinity(uri); } }
private Affinity getClusterAffinity() { Registry<String, List<ClientMapping>> registry = this.clientMappingRegistry; Group group = registry != null ? registry.getGroup() : null; return group != null && !group.isSingleton() ? new ClusterAffinity(group.getName()) : null; }
EJBRootContext(final NamingProvider namingProvider, final FastHashtable<String, Object> env, final ProviderEnvironment providerEnvironment) { super(env); this.namingProvider = namingProvider; this.providerEnvironment = providerEnvironment; // TODO, Switch to providerEnvironment using WildFLy Naming, when attachments are added Object learned = env.get(LEARNED_AFFINITY_KEY); if (learned == null || ! (learned instanceof LearnedAffinity)) { // check if strong affinity for this context has been set in the environment String clusterName = getClusterAffinityValueFromEnvironment(); if (clusterName != null) { learned = new LearnedAffinity(new ClusterAffinity(clusterName)); } else { learned = new LearnedAffinity(shouldLearnAffinity() ? null : Affinity.NONE); } env.put(LEARNED_AFFINITY_KEY, learned); } this.baseAffinity = (LearnedAffinity) learned; }
@Override public Affinity getStrictAffinity() { Group group = this.registry.getGroup(); return this.cache.getCacheConfiguration().clustering().cacheMode().isClustered() ? new ClusterAffinity(group.getName()) : new NodeAffinity(this.registry.getEntry(group.getLocalMember()).getKey()); }
byte[] b = new byte[PackedInteger.readPackedInteger(inputStream)]; inputStream.readFully(b); context.setLocator(context.getLocator().withNewAffinity(new ClusterAffinity(new String(b, StandardCharsets.UTF_8))));
response.readFully(b); String clusterName = new String(b, StandardCharsets.UTF_8); affinity = new ClusterAffinity(clusterName);
Object writeReplace() { String s = uri.getScheme(); if (s.equals("node")) { return new NodeAffinity(uri.getSchemeSpecificPart()); } else if (s.equals("cluster")) { return new ClusterAffinity(uri.getSchemeSpecificPart()); } else if (s.equals("local")) { return LOCAL; } else { // keep same object return this; } }
public Affinity getWeakAffinity() { String clusterName = this.clusterName.getOptionalValue(); return (clusterName != null) ? new ClusterAffinity(clusterName) : Affinity.NONE; }
Object writeReplace() { String s = uri.getScheme(); if (s.equals("node")) { return new NodeAffinity(uri.getSchemeSpecificPart()); } else if (s.equals("cluster")) { return new ClusterAffinity(uri.getSchemeSpecificPart()); } else if (s.equals("local")) { return LOCAL; } else { // keep same object return this; } }
/** * Get the affinity specification corresponding to the given URI. * * @param uri the URI * @return the affinity specification (not {@code null}) */ public static Affinity forUri(URI uri) { if (uri == null || ! uri.isAbsolute()) return NONE; final String scheme = uri.getScheme(); assert scheme != null; // due to isAbsolute() check switch (scheme) { case "node": return new NodeAffinity(uri.getSchemeSpecificPart()); case "cluster": return new ClusterAffinity(uri.getSchemeSpecificPart()); case "local": return LOCAL; default: return new URIAffinity(uri); } }
/** * Get the affinity specification corresponding to the given URI. * * @param uri the URI * @return the affinity specification (not {@code null}) */ public static Affinity forUri(URI uri) { if (uri == null || ! uri.isAbsolute()) return NONE; final String scheme = uri.getScheme(); assert scheme != null; // due to isAbsolute() check switch (scheme) { case "node": return new NodeAffinity(uri.getSchemeSpecificPart()); case "cluster": return new ClusterAffinity(uri.getSchemeSpecificPart()); case "local": return LOCAL; default: return new URIAffinity(uri); } }
EJBRootContext(final NamingProvider namingProvider, final FastHashtable<String, Object> env, final ProviderEnvironment providerEnvironment) { super(env); this.namingProvider = namingProvider; this.providerEnvironment = providerEnvironment; // TODO, Switch to providerEnvironment using WildFLy Naming, when attachments are added Object learned = env.get(LEARNED_AFFINITY_KEY); if (learned == null || ! (learned instanceof LearnedAffinity)) { // check if strong affinity for this context has been set in the environment String clusterName = getClusterAffinityValueFromEnvironment(); if (clusterName != null) { learned = new LearnedAffinity(new ClusterAffinity(clusterName)); } else { learned = new LearnedAffinity(shouldLearnAffinity() ? null : Affinity.NONE); } env.put(LEARNED_AFFINITY_KEY, learned); } this.baseAffinity = (LearnedAffinity) learned; }
EJBRootContext(final NamingProvider namingProvider, final FastHashtable<String, Object> env, final ProviderEnvironment providerEnvironment) { super(env); this.namingProvider = namingProvider; this.providerEnvironment = providerEnvironment; // TODO, Switch to providerEnvironment using WildFLy Naming, when attachments are added Object learned = env.get(LEARNED_AFFINITY_KEY); if (learned == null || ! (learned instanceof LearnedAffinity)) { // check if strong affinity for this context has been set in the environment String clusterName = getClusterAffinityValueFromEnvironment(); if (clusterName != null) { learned = new LearnedAffinity(new ClusterAffinity(clusterName)); } else { learned = new LearnedAffinity(shouldLearnAffinity() ? null : Affinity.NONE); } env.put(LEARNED_AFFINITY_KEY, learned); } this.baseAffinity = (LearnedAffinity) learned; }
@Override public Affinity getStrictAffinity() { Group group = this.registry.getGroup(); return this.cache.getCacheConfiguration().clustering().cacheMode().isClustered() ? new ClusterAffinity(group.getName()) : new NodeAffinity(this.registry.getEntry(group.getLocalMember()).getKey()); }
byte[] b = new byte[PackedInteger.readPackedInteger(inputStream)]; inputStream.readFully(b); context.setLocator(context.getLocator().withNewAffinity(new ClusterAffinity(new String(b, StandardCharsets.UTF_8))));
byte[] b = new byte[PackedInteger.readPackedInteger(inputStream)]; inputStream.readFully(b); context.setLocator(context.getLocator().withNewAffinity(new ClusterAffinity(new String(b, StandardCharsets.UTF_8))));
response.readFully(b); String clusterName = new String(b, StandardCharsets.UTF_8); affinity = new ClusterAffinity(clusterName);
response.readFully(b); String clusterName = new String(b, StandardCharsets.UTF_8); affinity = new ClusterAffinity(clusterName);