public static String getLinkName(final Session session) { // returned linkName lookslike: ea9cac_8b_G27_1479943074829 final String linkNamePrefix = StringUtil.getRandomString(); final String linkNameWithServiceRoleTracker = session.getConnection() != null && !StringUtil.isNullOrEmpty(session.getConnection().getRemoteContainer()) ? linkNamePrefix.concat(TrackingUtil.TRACKING_ID_TOKEN_SEPARATOR).concat(session.getConnection().getRemoteContainer() .substring(Math.max(session.getConnection().getRemoteContainer().length() - 7, 0), session.getConnection().getRemoteContainer().length())) : linkNamePrefix; return linkNameWithServiceRoleTracker.concat(TrackingUtil.TRACKING_ID_TOKEN_SEPARATOR).concat(String.valueOf(Instant.now().toEpochMilli())); } }
public ProtonConnectionImpl getConnectionImpl() { return (ProtonConnectionImpl) this.session.getConnection().getContext(); }
@Override public Transport getTransport() { if (context instanceof Transport) { return (Transport) context; } else if (context instanceof Connection) { return ((Connection)context).getTransport(); } else { Session session = getSession(); if (session == null) { return null; } Connection connection = session.getConnection(); if (connection == null) { return null; } return connection.getTransport(); } }
@Override public Transport getTransport() { if (context instanceof Transport) { return (Transport) context; } else if (context instanceof Connection) { return ((Connection)context).getTransport(); } else { Session session = getSession(); if (session == null) { return null; } Connection connection = session.getConnection(); if (connection == null) { return null; } return connection.getTransport(); } }
ProtonReceiverImpl(Receiver receiver) { super(receiver); session = receiver.getSession(); sessionIncomingCapacity = session.getIncomingCapacity(); maxFrameSize = session.getConnection().getTransport().getMaxFrameSize(); windowFullThreshhold = sessionIncomingCapacity - maxFrameSize; }
@Override public Connection getConnection() { if (context instanceof Connection) { return (Connection) context; } else if (context instanceof Transport) { Transport transport = getTransport(); if (transport == null) { return null; } return ((TransportImpl) transport).getConnectionImpl(); } else { Session ssn = getSession(); if (ssn == null) { return null; } return ssn.getConnection(); } }
@Override public Connection getConnection() { if (context instanceof Connection) { return (Connection) context; } else if (context instanceof Transport) { Transport transport = getTransport(); if (transport == null) { return null; } return ((TransportImpl) transport).getConnectionImpl(); } else { Session ssn = getSession(); if (ssn == null) { return null; } return ssn.getConnection(); } }
@Override public void onEvent() { final RequestResponseChannel channel = innerChannel.unsafeGetIfOpened(); final String errorMessage; if (channel != null && channel.getState() == IOObject.IOObjectState.OPENED) { final String remoteContainerId = channel.getSendLink().getSession().getConnection().getRemoteContainer(); errorMessage = String.format("Management request timed out (%sms), after not receiving response from service. TrackingId: %s", timeoutInMillis, StringUtil.isNullOrEmpty(remoteContainerId) ? "n/a" : remoteContainerId); } else { errorMessage = "Management request timed out on the client - enable info level tracing to diagnose."; } resultFuture.completeExceptionally(new TimeoutException(errorMessage)); } });
@Override public Reactor getReactor() { if (context instanceof Reactor) { return (Reactor) context; } else if (context instanceof Task) { return ((Task)context).getReactor(); } else if (context instanceof Transport) { return ((TransportImpl)context).getReactor(); } else if (context instanceof Delivery) { return ((Delivery)context).getLink().getSession().getConnection().getReactor(); } else if (context instanceof Link) { return ((Link)context).getSession().getConnection().getReactor(); } else if (context instanceof Session) { return ((Session)context).getConnection().getReactor(); } else if (context instanceof Connection) { return ((Connection)context).getReactor(); } else if (context instanceof Selectable) { return ((Selectable)context).getReactor(); } return null; }
@Override public Reactor getReactor() { if (context instanceof Reactor) { return (Reactor) context; } else if (context instanceof Task) { return ((Task)context).getReactor(); } else if (context instanceof Transport) { return ((TransportImpl)context).getReactor(); } else if (context instanceof Delivery) { return ((Delivery)context).getLink().getSession().getConnection().getReactor(); } else if (context instanceof Link) { return ((Link)context).getSession().getConnection().getReactor(); } else if (context instanceof Session) { return ((Session)context).getConnection().getReactor(); } else if (context instanceof Connection) { return ((Connection)context).getReactor(); } else if (context instanceof Selectable) { return ((Selectable)context).getReactor(); } return null; }
boolean checkSettled(Iterator<Delivery> unsettled) { if (unsettled != null) { while (unsettled.hasNext()) { Delivery d = unsettled.next(); if (d == null) { break; } if (d.getRemoteState() != null || d.remotelySettled()) { d.settle(); } else if (d.getLink().getSession().getConnection().getRemoteState() == EndpointState.CLOSED) { continue; } else { return false; } } } return true; } }
ConnectionContext ctx = (ConnectionContext) link.getSession().getConnection().getContext(); try _draining++; ConnectionContext ctx = (ConnectionContext) link.getSession().getConnection().getContext(); try
ConnectionContext ctx = (ConnectionContext) link.getSession().getConnection().getContext(); try _draining++; ConnectionContext ctx = (ConnectionContext) link.getSession().getConnection().getContext(); try
@Override public void onDelivery(Event event) { //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_023: [ The event handler shall get the Delivery from the event only if the event type is DELIVERY **]** if(event.getType() == Event.Type.DELIVERY) { // Codes_SRS_AMQPSIOTHUBCONNECTION_15_038: [If this link is the Sender link and the event type is DELIVERY, the event handler shall get the Delivery (Proton) object from the event.] Delivery d = event.getDelivery(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_024: [ The event handler shall get the Delivery remote state from the delivery **]** DeliveryState remoteState = d.getRemoteState(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_025: [ The event handler shall verify the Amqp response and add the response to a queue. **]** sendStatusQueue.add(new AmqpResponseVerification(remoteState)); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_026: [ The event handler shall settle the delivery. **]** d.settle(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_027: [ The event handler shall get the Sender (Proton) object from the event **]** Sender snd = event.getSender(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_028: [ The event handler shall close the Sender, Session and Connection **]** snd.close(); snd.getSession().close(); snd.getSession().getConnection().close(); isConnected = false; } }
final Receiver receiver, final RoutingContext routingContext) throws Exception { message.setConnectionID(receiver.getSession().getConnection().getRemoteContainer()); invokeIncoming((AMQPMessage) message, (ActiveMQProtonRemotingConnection) transportConnection.getProtocolConnection()); serverSession.send(transaction, message, directDeliver, false, routingContext);
final Delivery delivery, final Receiver receiver) throws Exception { message.setConnectionID(receiver.getSession().getConnection().getRemoteContainer()); invokeIncoming((AMQPMessage) message, (ActiveMQProtonRemotingConnection) transportConnection.getProtocolConnection()); serverSession.send(transaction, message, false, false);
recv.getSession().getConnection().close();
boolean noLocal = false; String remoteContainerId = sender.getSession().getConnection().getRemoteContainer(); String noLocalFilter = MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString() + "<>'" + remoteContainerId + "'"; Map.Entry<Symbol, DescribedType> filter = AmqpSupport.findFilter(source.getFilter(), AmqpSupport.NO_LOCAL_FILTER_IDS); if (filter != null) { String remoteContainerId = sender.getSession().getConnection().getRemoteContainer(); String noLocalFilter = MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString() + "<>'" + remoteContainerId + "'"; if (selector != null) {
boolean noLocal = false; String remoteContainerId = sender.getSession().getConnection().getRemoteContainer(); String noLocalFilter = MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString() + "<>'" + remoteContainerId + "'"; Map.Entry<Symbol, DescribedType> filter = AmqpSupport.findFilter(source.getFilter(), AmqpSupport.NO_LOCAL_FILTER_IDS); if (filter != null) { String remoteContainerId = sender.getSession().getConnection().getRemoteContainer(); String noLocalFilter = MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString() + "<>'" + remoteContainerId + "'"; if (selector != null) {
recv.getSession().getConnection().close();