use of com.sun.nio.sctp.AbstractNotificationHandler in project jdk8u_jdk by JetBrains.
the class SctpMultiChannelImpl method invokeNotificationHandler.
private <T> HandlerResult invokeNotificationHandler(ResultContainer resultContainer, NotificationHandler<T> handler, T attachment) {
HandlerResult result;
SctpNotification notification = resultContainer.notification();
notification.setAssociation(lookupAssociation(notification.assocId()));
if (!(handler instanceof AbstractNotificationHandler)) {
result = handler.handleNotification(notification, attachment);
} else {
/* AbstractNotificationHandler */
AbstractNotificationHandler<T> absHandler = (AbstractNotificationHandler<T>) handler;
switch(resultContainer.type()) {
case ASSOCIATION_CHANGED:
result = absHandler.handleNotification(resultContainer.getAssociationChanged(), attachment);
break;
case PEER_ADDRESS_CHANGED:
result = absHandler.handleNotification(resultContainer.getPeerAddressChanged(), attachment);
break;
case SEND_FAILED:
result = absHandler.handleNotification(resultContainer.getSendFailed(), attachment);
break;
case SHUTDOWN:
result = absHandler.handleNotification(resultContainer.getShutdown(), attachment);
break;
default:
/* implementation specific handlers */
result = absHandler.handleNotification(resultContainer.notification(), attachment);
}
}
if (!(handler instanceof InternalNotificationHandler)) {
/* Only remove associations after user handler
* has finished with them */
Association assoc = associationToRemove.get();
if (assoc != null) {
removeAssociation(assoc);
associationToRemove.set(null);
}
}
return result;
}
Aggregations