use of io.aeron.exceptions.ControlProtocolException in project aeron by real-logic.
the class DriverConductor method onRemoveRcvNetworkDestination.
void onRemoveRcvNetworkDestination(final long registrationId, final String destinationChannel, final long correlationId) {
ReceiveChannelEndpoint receiveChannelEndpoint = null;
for (int i = 0, size = subscriptionLinks.size(); i < size; i++) {
final SubscriptionLink subscriptionLink = subscriptionLinks.get(i);
if (registrationId == subscriptionLink.registrationId()) {
receiveChannelEndpoint = subscriptionLink.channelEndpoint();
break;
}
}
if (null == receiveChannelEndpoint) {
throw new ControlProtocolException(UNKNOWN_SUBSCRIPTION, "unknown subscription: " + registrationId);
}
receiveChannelEndpoint.validateAllowsDestinationControl();
receiverProxy.removeDestination(receiveChannelEndpoint, UdpChannel.parse(destinationChannel, nameResolver, true));
clientProxy.operationSucceeded(correlationId);
}
use of io.aeron.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(); i < size; i++) {
final PublicationLink publication = publicationLinks.get(i);
if (registrationId == publication.registrationId()) {
publicationLink = publication;
fastUnorderedRemove(publicationLinks, i);
break;
}
}
if (null == publicationLink) {
throw new ControlProtocolException(UNKNOWN_PUBLICATION, "unknown publication: " + registrationId);
}
publicationLink.close();
clientProxy.operationSucceeded(correlationId);
}
use of io.aeron.exceptions.ControlProtocolException in project aeron by real-logic.
the class DriverConductor method onAddRcvSpyDestination.
void onAddRcvSpyDestination(final long registrationId, final String destinationChannel, final long correlationId) {
final UdpChannel udpChannel = UdpChannel.parse(destinationChannel, nameResolver);
final SubscriptionParams params = SubscriptionParams.getSubscriptionParams(udpChannel.channelUri(), ctx);
final SubscriptionLink mdsSubscriptionLink = findMdsSubscriptionLink(subscriptionLinks, registrationId);
if (null == mdsSubscriptionLink) {
throw new ControlProtocolException(UNKNOWN_SUBSCRIPTION, "unknown MDS subscription: " + registrationId);
}
final SpySubscriptionLink subscriptionLink = new SpySubscriptionLink(registrationId, udpChannel, mdsSubscriptionLink.streamId(), mdsSubscriptionLink.aeronClient(), params);
subscriptionLinks.add(subscriptionLink);
clientProxy.operationSucceeded(correlationId);
for (int i = 0, size = networkPublications.size(); i < size; i++) {
final NetworkPublication publication = networkPublications.get(i);
if (subscriptionLink.matches(publication) && publication.isAcceptingSubscriptions()) {
clientProxy.onAvailableImage(publication.registrationId(), mdsSubscriptionLink.streamId(), publication.sessionId(), registrationId, linkSpy(publication, subscriptionLink).id(), publication.rawLog().fileName(), CommonContext.IPC_CHANNEL);
}
}
}
Aggregations