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 onRemoveCounter.
void onRemoveCounter(final long registrationId, final long correlationId) {
CounterLink counterLink = null;
final ArrayList<CounterLink> counterLinks = this.counterLinks;
for (int i = 0, size = counterLinks.size(); i < size; i++) {
final CounterLink link = counterLinks.get(i);
if (registrationId == link.registrationId()) {
counterLink = link;
fastUnorderedRemove(counterLinks, i);
break;
}
}
if (null == counterLink) {
throw new ControlProtocolException(UNKNOWN_COUNTER, "unknown counter: " + registrationId);
}
clientProxy.operationSucceeded(correlationId);
clientProxy.onUnavailableCounter(registrationId, counterLink.counterId());
counterLink.close();
}
use of io.aeron.exceptions.ControlProtocolException in project aeron by real-logic.
the class DriverConductor method onAddSendDestination.
void onAddSendDestination(final long registrationId, final String destinationChannel, final long correlationId) {
final ChannelUri channelUri = ChannelUri.parse(destinationChannel);
validateDestinationUri(channelUri, destinationChannel);
validateSendDestinationUri(channelUri, destinationChannel);
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 InetSocketAddress dstAddress = UdpChannel.destinationAddress(channelUri, nameResolver);
senderProxy.addDestination(sendChannelEndpoint, channelUri, dstAddress);
clientProxy.operationSucceeded(correlationId);
}
use of io.aeron.exceptions.ControlProtocolException in project aeron by real-logic.
the class DriverConductor method onRemoveSendDestination.
void onRemoveSendDestination(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 ChannelUri channelUri = ChannelUri.parse(destinationChannel);
final InetSocketAddress dstAddress = UdpChannel.destinationAddress(channelUri, nameResolver);
senderProxy.removeDestination(sendChannelEndpoint, channelUri, dstAddress);
clientProxy.operationSucceeded(correlationId);
}
use of io.aeron.exceptions.ControlProtocolException in project aeron by real-logic.
the class DriverConductor method onRemoveSubscription.
void onRemoveSubscription(final long registrationId, final long correlationId) {
boolean isAnySubscriptionFound = false;
for (int lastIndex = subscriptionLinks.size() - 1, i = lastIndex; i >= 0; i--) {
final SubscriptionLink subscription = subscriptionLinks.get(i);
if (subscription.registrationId() == registrationId) {
fastUnorderedRemove(subscriptionLinks, i, lastIndex--);
subscription.close();
cleanupSubscriptionLink(subscription);
isAnySubscriptionFound = true;
}
}
if (!isAnySubscriptionFound) {
throw new ControlProtocolException(UNKNOWN_SUBSCRIPTION, "unknown subscription: " + registrationId);
}
clientProxy.operationSucceeded(correlationId);
}
Aggregations