use of org.apache.qpid.proton.engine.Link in project azure-service-bus-java by Azure.
the class ReceiveLinkHandler method onLinkRemoteOpen.
@Override
public void onLinkRemoteOpen(Event event) {
Link link = event.getLink();
if (link != null && link instanceof Receiver) {
Receiver receiver = (Receiver) link;
if (link.getRemoteSource() != null) {
TRACE_LOGGER.debug("onLinkRemoteOpen: linkName:{}, remoteSource:{}", receiver.getName(), receiver.getRemoteSource());
synchronized (this.firstResponse) {
this.isFirstResponse = false;
this.amqpReceiver.onOpenComplete(null);
}
} else {
TRACE_LOGGER.debug("onLinkRemoteOpen: linkName:{}, remoteTarget:{}, remoteTarget:{}, action:{}", receiver.getName(), null, null, "waitingForError");
}
}
}
use of org.apache.qpid.proton.engine.Link in project azure-service-bus-java by Azure.
the class ReceiveLinkHandler method onLinkLocalOpen.
@Override
public void onLinkLocalOpen(Event evt) {
Link link = evt.getLink();
if (link instanceof Receiver) {
Receiver receiver = (Receiver) link;
TRACE_LOGGER.debug("onLinkLocalOpen: linkName:{}, localSource:{}", receiver.getName(), receiver.getSource());
}
}
use of org.apache.qpid.proton.engine.Link in project azure-service-bus-java by Azure.
the class MessagingFactory method closeConnection.
// One of the parameters must be null
private void closeConnection(ErrorCondition error, Exception cause) {
// Important to copy the reference of the connection as a call to getConnection might create a new connection while we are still in this method
Connection currentConnection = this.connection;
if (currentConnection != null) {
Link[] links = this.registeredLinks.toArray(new Link[0]);
this.registeredLinks.clear();
TRACE_LOGGER.debug("Closing all links on the connection. Number of links '{}'", links.length);
for (Link link : links) {
link.close();
}
TRACE_LOGGER.debug("Closed all links on the connection. Number of links '{}'", links.length);
if (currentConnection.getLocalState() != EndpointState.CLOSED) {
TRACE_LOGGER.info("Closing connection to host");
currentConnection.close();
}
for (Link link : links) {
Handler handler = BaseHandler.getHandler(link);
if (handler != null && handler instanceof BaseLinkHandler) {
BaseLinkHandler linkHandler = (BaseLinkHandler) handler;
if (error != null) {
linkHandler.processOnClose(link, error);
} else {
linkHandler.processOnClose(link, cause);
}
}
}
}
}
Aggregations