/** * Determine whether this object is equal to another. Session IDs are equal if their encoded form is * equal and the class is equal. * * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public final boolean equals(Object other) { return this == other || other != null && other.getClass() == getClass() && equals((SessionID) other); }
/** * Determine whether this object is equal to another. * * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public boolean equals(final StatefulEJBLocator<?> other) { return super.equals(other) && sessionId.equals(other.sessionId); }
public void convertToStateful(@NotNull final SessionID sessionId) throws IllegalArgumentException, IllegalStateException { Assert.checkNotNullParam("sessionId", sessionId); final SessionID ourSessionId = this.sessionId; if (ourSessionId != null) { if (! sessionId.equals(ourSessionId)) { throw new IllegalStateException(); } } else { this.sessionId = sessionId; } }
public StatefulEJBLocator<T> withSession(final SessionID sessionId) { Assert.checkNotNullParam("sessionId", sessionId); if (sessionId.equals(this.sessionId)) { return this; } else { return new StatefulEJBLocator<T>(this, sessionId); } }
void setSessionID(final SessionID sessionID) { final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal, newVal; do { oldVal = locatorRef.get(); if (oldVal.isStateful()) { if (oldVal.asStateful().getSessionId().equals(sessionID)) { // harmless/idempotent return; } throw Logs.MAIN.ejbIsAlreadyStateful(); } newVal = oldVal.withSession(sessionID); } while (! locatorRef.compareAndSet(oldVal, newVal)); }
@Override public Object processInvocation(final InterceptorContext context) throws Exception { if (context.getMethod().getName().equals("equals") || context.getMethod().getName().equals("isIdentical")) { final Object other = context.getParameters()[0]; final ComponentView componentView = context.getPrivateData(ComponentView.class); final Class<?> proxyType = componentView.getProxyClass(); final SessionID sessionId = context.getPrivateData(SessionID.class); if( proxyType.isAssignableFrom(other.getClass())) { //now we know that this is an ejb for the correct component view //as digging out the session id from the proxy object is not really //a viable option, we invoke equals() for the other instance with a //SessionIdHolder as the other side return other.equals(new SessionIdHolder(sessionId)); } else if(other instanceof SessionIdHolder) { return sessionId.equals( ((SessionIdHolder)other).sessionId); } else { return false; } } else if (context.getMethod().getName().equals("hashCode")) { final SessionID sessionId = context.getPrivateData(SessionID.class); //use the identity of the component view as a hash code return sessionId.hashCode(); } else { return context.proceed(); } }
public StatefulEJBLocator<T> withSessionAndAffinity(final SessionID sessionId, final Affinity affinity) { Assert.checkNotNullParam("sessionId", sessionId); Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) && getSessionId().equals(sessionId) ? this : new StatefulEJBLocator<T>(this, sessionId, affinity); }
/** * Determine whether this object is equal to another. Session IDs are equal if their encoded form is * equal and the class is equal. * * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public final boolean equals(Object other) { return this == other || other != null && other.getClass() == getClass() && equals((SessionID) other); }
/** * Determine whether this object is equal to another. Session IDs are equal if their encoded form is * equal and the class is equal. * * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public final boolean equals(Object other) { return this == other || other != null && other.getClass() == getClass() && equals((SessionID) other); }
/** * Determine whether this object is equal to another. * * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public boolean equals(final StatefulEJBLocator<?> other) { return super.equals(other) && sessionId.equals(other.sessionId); }
/** * Determine whether this object is equal to another. * * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public boolean equals(final StatefulEJBLocator<?> other) { return super.equals(other) && sessionId.equals(other.sessionId); }
public void convertToStateful(@NotNull final SessionID sessionId) throws IllegalArgumentException, IllegalStateException { Assert.checkNotNullParam("sessionId", sessionId); final SessionID ourSessionId = this.sessionId; if (ourSessionId != null) { if (! sessionId.equals(ourSessionId)) { throw new IllegalStateException(); } } else { this.sessionId = sessionId; } }
public void convertToStateful(@NotNull final SessionID sessionId) throws IllegalArgumentException, IllegalStateException { Assert.checkNotNullParam("sessionId", sessionId); final SessionID ourSessionId = this.sessionId; if (ourSessionId != null) { if (! sessionId.equals(ourSessionId)) { throw new IllegalStateException(); } } else { this.sessionId = sessionId; } }
public StatefulEJBLocator<T> withSession(final SessionID sessionId) { Assert.checkNotNullParam("sessionId", sessionId); if (sessionId.equals(this.sessionId)) { return this; } else { return new StatefulEJBLocator<T>(this, sessionId); } }
public StatefulEJBLocator<T> withSession(final SessionID sessionId) { Assert.checkNotNullParam("sessionId", sessionId); if (sessionId.equals(this.sessionId)) { return this; } else { return new StatefulEJBLocator<T>(this, sessionId); } }
@Override public Object processInvocation(final InterceptorContext context) throws Exception { if (context.getMethod().getName().equals("equals") || context.getMethod().getName().equals("isIdentical")) { final Object other = context.getParameters()[0]; final Class<?> proxyType = componentView.getProxyClass(); if( proxyType.isAssignableFrom(other.getClass())) { //now we know that this is an ejb for the correct component view //as digging out the session id from the proxy object is not really //a viable option, we invoke equals() for the other instance with a //SessionIdHolder as the other side return other.equals(new SessionIdHolder(sessionIdReference.get())); } else if(other instanceof SessionIdHolder) { return sessionIdReference.get().equals( ((SessionIdHolder)other).sessionId); } else { return false; } } else if (context.getMethod().getName().equals("hashCode")) { //use the identity of the component view as a hash code return sessionIdReference.get().hashCode(); } else { return context.proceed(); } }
void setSessionID(final SessionID sessionID) { final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal, newVal; do { oldVal = locatorRef.get(); if (oldVal.isStateful()) { if (oldVal.asStateful().getSessionId().equals(sessionID)) { // harmless/idempotent return; } throw Logs.MAIN.ejbIsAlreadyStateful(); } newVal = oldVal.withSession(sessionID); } while (! locatorRef.compareAndSet(oldVal, newVal)); }
void setSessionID(final SessionID sessionID) { final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal, newVal; do { oldVal = locatorRef.get(); if (oldVal.isStateful()) { if (oldVal.asStateful().getSessionId().equals(sessionID)) { // harmless/idempotent return; } throw Logs.MAIN.ejbIsAlreadyStateful(); } newVal = oldVal.withSession(sessionID); } while (! locatorRef.compareAndSet(oldVal, newVal)); }
public StatefulEJBLocator<T> withSessionAndAffinity(final SessionID sessionId, final Affinity affinity) { Assert.checkNotNullParam("sessionId", sessionId); Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) && getSessionId().equals(sessionId) ? this : new StatefulEJBLocator<T>(this, sessionId, affinity); }
public StatefulEJBLocator<T> withSessionAndAffinity(final SessionID sessionId, final Affinity affinity) { Assert.checkNotNullParam("sessionId", sessionId); Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) && getSessionId().equals(sessionId) ? this : new StatefulEJBLocator<T>(this, sessionId, affinity); }