/** * Utility method used by the framework and framework extensions to retrieve the integer identifier of * the Actor or ActorObserver interface implemented by this reference. * * <p>This is not exposed as an instance method to avoid clashes with the methods from implemented interfaces</p> * * @param reference the reference being inspected * @return the implemented interface id */ public static int getInterfaceId(final RemoteReference<?> reference) { return reference._interfaceId(); }
@Override public boolean equals(final Object o) { RemoteReference<?> that; return (this == o) || ((o instanceof RemoteReference) && ((_interfaceId() == (that = (RemoteReference<?>) o)._interfaceId()) && ((!(address != null ? !address.equals(that.address) : that.address != null)) && ((!(id != null ? !id.equals(that.id) : that.id != null)))))); }
@Override public int hashCode() { int result = address != null ? address.hashCode() : 0; result = 31 * result + _interfaceId(); result = 31 * result + (id != null ? id.hashCode() : 0); return result; }
@Override public String toString() { final StringBuilder output = new StringBuilder(); output.append("RemoteReference["); if(address != null) { output.append("address="); output.append(address); output.append(", "); } if(id != null) { output.append("id="); output.append(id.toString()); output.append(", "); } output.append("interfaceId="); output.append(_interfaceId()); output.append(", "); if(_interfaceClass() != null) { output.append("interfaceName="); output.append(_interfaceClass().getName()); output.append(", "); } output.deleteCharAt(output.length() - 2); output.append("]"); return output.toString(); }
public Task<?> writeInvocation(final HandlerContext ctx, Invocation invocation) { final Addressable toReference = invocation.getToReference(); final RemoteReference<?> actorReference = (RemoteReference<?>) toReference; final NodeAddress toNode = invocation.getToNode(); Map<String, Object> actualHeaders = null; if (invocation.getHeaders() != null) { actualHeaders = new HashMap<>(); actualHeaders.putAll(invocation.getHeaders()); } final Message message = new Message() .withMessageType(invocation.isOneWay() ? MessageDefinitions.ONE_WAY_MESSAGE : MessageDefinitions.REQUEST_MESSAGE) .withToNode(toNode) .withFromNode(invocation.getFromNode()) .withHeaders(actualHeaders) .withInterfaceId(actorReference._interfaceId()) .withMessageId(invocation.getMessageId()) .withMethodId(invocation.getMethodId()) .withObjectId(RemoteReference.getId(actorReference)) .withPayload(invocation.getParams()) .withReferenceAddress(invocation.getToReference().address); if (logger.isTraceEnabled()) { logger.trace("sending message to " + toReference); } return writeMessage(ctx, message); }
/** * Utility method used by the framework and framework extensions to retrieve the integer identifier of * the Actor or ActorObserver interface implemented by this reference. * * <p>This is not exposed as an instance method to avoid clashes with the methods from implemented interfaces</p> * * @param reference the reference being inspected * @return the implemented interface id */ public static int getInterfaceId(final RemoteReference<?> reference) { return reference._interfaceId(); }
@Override public boolean equals(final Object o) { RemoteReference<?> that; return (this == o) || ((o instanceof RemoteReference) && ((_interfaceId() == (that = (RemoteReference<?>) o)._interfaceId()) && ((!(address != null ? !address.equals(that.address) : that.address != null)) && ((!(id != null ? !id.equals(that.id) : that.id != null)))))); }
@Override public int hashCode() { int result = address != null ? address.hashCode() : 0; result = 31 * result + _interfaceId(); result = 31 * result + (id != null ? id.hashCode() : 0); return result; }
@Override public String toString() { final StringBuilder output = new StringBuilder(); output.append("RemoteReference["); if(address != null) { output.append("address="); output.append(address); output.append(", "); } if(id != null) { output.append("id="); output.append(id.toString()); output.append(", "); } output.append("interfaceId="); output.append(_interfaceId()); output.append(", "); if(_interfaceClass() != null) { output.append("interfaceName="); output.append(_interfaceClass().getName()); output.append(", "); } output.deleteCharAt(output.length() - 2); output.append("]"); return output.toString(); }