use of io.aeron.driver.exceptions.ControlProtocolException in project Aeron by real-logic.
the class DriverConductor method onRemoveDestination.
void onRemoveDestination(final long registrationId, final String destinationChannel, final long correlationId) {
SendChannelEndpoint sendChannelEndpoint = null;
for (int i = 0, size = networkPublications.size(); i < size; i++) {
final NetworkPublication publication = networkPublications.get(i);
if (registrationId == publication.registrationId()) {
sendChannelEndpoint = publication.channelEndpoint();
break;
}
}
if (null == sendChannelEndpoint) {
throw new ControlProtocolException(UNKNOWN_PUBLICATION, "Unknown publication: " + registrationId);
}
sendChannelEndpoint.validateAllowsManualControl();
final AeronUri aeronUri = AeronUri.parse(destinationChannel);
final InetSocketAddress dstAddress = UdpChannel.destinationAddress(aeronUri);
senderProxy.removeDestination(sendChannelEndpoint, dstAddress);
clientProxy.operationSucceeded(correlationId);
}
use of io.aeron.driver.exceptions.ControlProtocolException in project Aeron by real-logic.
the class DriverConductor method onAddDestination.
void onAddDestination(final long registrationId, final String destinationChannel, final long correlationId) {
SendChannelEndpoint sendChannelEndpoint = null;
for (int i = 0, size = networkPublications.size(); i < size; i++) {
final NetworkPublication publication = networkPublications.get(i);
if (registrationId == publication.registrationId()) {
sendChannelEndpoint = publication.channelEndpoint();
break;
}
}
if (null == sendChannelEndpoint) {
throw new ControlProtocolException(UNKNOWN_PUBLICATION, "Unknown publication: " + registrationId);
}
sendChannelEndpoint.validateAllowsManualControl();
final AeronUri aeronUri = AeronUri.parse(destinationChannel);
final InetSocketAddress dstAddress = UdpChannel.destinationAddress(aeronUri);
senderProxy.addDestination(sendChannelEndpoint, dstAddress);
clientProxy.operationSucceeded(correlationId);
}
use of io.aeron.driver.exceptions.ControlProtocolException in project Aeron by real-logic.
the class DriverConductor method onRemoveSubscription.
void onRemoveSubscription(final long registrationId, final long correlationId) {
final SubscriptionLink subscription = removeSubscriptionLink(subscriptionLinks, registrationId);
if (null == subscription) {
throw new ControlProtocolException(UNKNOWN_SUBSCRIPTION, "Unknown Subscription: " + registrationId);
}
subscription.close();
final ReceiveChannelEndpoint channelEndpoint = subscription.channelEndpoint();
if (null != channelEndpoint) {
final int refCount = channelEndpoint.decRefToStream(subscription.streamId());
if (0 == refCount) {
receiverProxy.removeSubscription(channelEndpoint, subscription.streamId());
}
if (channelEndpoint.shouldBeClosed()) {
channelEndpoint.closeStatusIndicator();
receiveChannelEndpointByChannelMap.remove(channelEndpoint.udpChannel().canonicalForm());
receiverProxy.closeReceiveChannelEndpoint(channelEndpoint);
while (!channelEndpoint.isClosed()) {
Thread.yield();
}
}
}
clientProxy.operationSucceeded(correlationId);
}
use of io.aeron.driver.exceptions.ControlProtocolException in project Aeron by real-logic.
the class DriverConductor method onRemovePublication.
void onRemovePublication(final long registrationId, final long correlationId) {
PublicationLink publicationLink = null;
final ArrayList<PublicationLink> publicationLinks = this.publicationLinks;
for (int i = 0, size = publicationLinks.size(), lastIndex = size - 1; i < size; i++) {
final PublicationLink publication = publicationLinks.get(i);
if (registrationId == publication.registrationId()) {
publicationLink = publication;
ArrayListUtil.fastUnorderedRemove(publicationLinks, i, lastIndex);
break;
}
}
if (null == publicationLink) {
throw new ControlProtocolException(UNKNOWN_PUBLICATION, "Unknown publication: " + registrationId);
}
publicationLink.close();
clientProxy.operationSucceeded(correlationId);
}
Aggregations