void setStrongAffinity(final Affinity newAffinity) { final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal, newVal; do { oldVal = locatorRef.get(); if (oldVal.getAffinity().equals(newAffinity)) { return; } newVal = oldVal.withNewAffinity(newAffinity); } while (! locatorRef.compareAndSet(oldVal, newVal)); }
boolean compareAndSetStrongAffinity(final Affinity expectedAffinity, final Affinity newAffinity) { Assert.checkNotNullParam("expectedAffinity", expectedAffinity); Assert.checkNotNullParam("newAffinity", newAffinity); final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal = locatorRef.get(); if (! oldVal.getAffinity().equals(expectedAffinity)) { return false; } EJBLocator<T> newVal = oldVal.withNewAffinity(newAffinity); return locatorRef.compareAndSet(oldVal, newVal); } }
context.setLocator(locator.withNewAffinity(targetAffinity)); } else { final URI destination = context.getDestination(); if (destination != null) { context.setLocator(locator.withNewAffinity(URIAffinity.forUri(destination)));
private void processMissingTarget(final AbstractInvocationContext context) { final URI destination = context.getDestination(); if (destination == null || context.getTargetAffinity() == Affinity.LOCAL) { // some later interceptor cleared it out on us return; } // Oops, we got some wrong information! addBlackListedDestination(context, destination); final EJBLocator<?> locator = context.getLocator(); if (! (locator.getAffinity() instanceof ClusterAffinity)) { // it *was* "none" affinity, but it has been relocated; locate it back again context.setLocator(locator.withNewAffinity(Affinity.NONE)); } // clear the weak affinity so that cluster invocations can be re-targeted. context.setWeakAffinity(Affinity.NONE); context.setTargetAffinity(null); context.setDestination(null); context.requestRetry(); } }
byte[] b = new byte[PackedInteger.readPackedInteger(inputStream)]; inputStream.readFully(b); context.setLocator(context.getLocator().withNewAffinity(new ClusterAffinity(new String(b, StandardCharsets.UTF_8))));
void setStrongAffinity(final Affinity newAffinity) { final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal, newVal; do { oldVal = locatorRef.get(); if (oldVal.getAffinity().equals(newAffinity)) { return; } newVal = oldVal.withNewAffinity(newAffinity); } while (! locatorRef.compareAndSet(oldVal, newVal)); }
void setStrongAffinity(final Affinity newAffinity) { final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal, newVal; do { oldVal = locatorRef.get(); if (oldVal.getAffinity().equals(newAffinity)) { return; } newVal = oldVal.withNewAffinity(newAffinity); } while (! locatorRef.compareAndSet(oldVal, newVal)); }
boolean compareAndSetStrongAffinity(final Affinity expectedAffinity, final Affinity newAffinity) { Assert.checkNotNullParam("expectedAffinity", expectedAffinity); Assert.checkNotNullParam("newAffinity", newAffinity); final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal = locatorRef.get(); if (! oldVal.getAffinity().equals(expectedAffinity)) { return false; } EJBLocator<T> newVal = oldVal.withNewAffinity(newAffinity); return locatorRef.compareAndSet(oldVal, newVal); } }
boolean compareAndSetStrongAffinity(final Affinity expectedAffinity, final Affinity newAffinity) { Assert.checkNotNullParam("expectedAffinity", expectedAffinity); Assert.checkNotNullParam("newAffinity", newAffinity); final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal = locatorRef.get(); if (! oldVal.getAffinity().equals(expectedAffinity)) { return false; } EJBLocator<T> newVal = oldVal.withNewAffinity(newAffinity); return locatorRef.compareAndSet(oldVal, newVal); } }
context.setLocator(locator.withNewAffinity(targetAffinity)); } else { final URI destination = context.getDestination(); if (destination != null) { context.setLocator(locator.withNewAffinity(URIAffinity.forUri(destination)));
context.setLocator(locator.withNewAffinity(targetAffinity)); } else { final URI destination = context.getDestination(); if (destination != null) { context.setLocator(locator.withNewAffinity(URIAffinity.forUri(destination)));
private void processMissingTarget(final AbstractInvocationContext context) { final URI destination = context.getDestination(); if (destination == null || context.getTargetAffinity() == Affinity.LOCAL) { // some later interceptor cleared it out on us return; } // Oops, we got some wrong information! addBlackListedDestination(context, destination); final EJBLocator<?> locator = context.getLocator(); if (! (locator.getAffinity() instanceof ClusterAffinity)) { // it *was* "none" affinity, but it has been relocated; locate it back again context.setLocator(locator.withNewAffinity(Affinity.NONE)); } // clear the weak affinity so that cluster invocations can be re-targeted. context.setWeakAffinity(Affinity.NONE); context.setTargetAffinity(null); context.setDestination(null); context.requestRetry(); } }
private void processMissingTarget(final AbstractInvocationContext context) { final URI destination = context.getDestination(); if (destination == null || context.getTargetAffinity() == Affinity.LOCAL) { // some later interceptor cleared it out on us return; } // Oops, we got some wrong information! addBlackListedDestination(context, destination); final EJBLocator<?> locator = context.getLocator(); if (! (locator.getAffinity() instanceof ClusterAffinity)) { // it *was* "none" affinity, but it has been relocated; locate it back again context.setLocator(locator.withNewAffinity(Affinity.NONE)); } // clear the weak affinity so that cluster invocations can be re-targeted. context.setWeakAffinity(Affinity.NONE); context.setTargetAffinity(null); context.setDestination(null); context.requestRetry(); } }
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))));