本文整理汇总了Java中com.sun.nio.sctp.NotificationHandler.handleNotification方法的典型用法代码示例。如果您正苦于以下问题:Java NotificationHandler.handleNotification方法的具体用法?Java NotificationHandler.handleNotification怎么用?Java NotificationHandler.handleNotification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.nio.sctp.NotificationHandler
的用法示例。
在下文中一共展示了NotificationHandler.handleNotification方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: synchronized
import com.sun.nio.sctp.NotificationHandler; //导入方法依赖的package包/类
private <T> HandlerResult invokeNotificationHandler
(ResultContainer resultContainer,
NotificationHandler<T> handler,
T attachment) {
SctpNotification notification = resultContainer.notification();
synchronized (stateLock) {
notification.setAssociation(association);
}
if (!(handler instanceof AbstractNotificationHandler)) {
return handler.handleNotification(notification, attachment);
}
/* AbstractNotificationHandler */
AbstractNotificationHandler<T> absHandler =
(AbstractNotificationHandler<T>)handler;
switch(resultContainer.type()) {
case ASSOCIATION_CHANGED :
return absHandler.handleNotification(
resultContainer.getAssociationChanged(), attachment);
case PEER_ADDRESS_CHANGED :
return absHandler.handleNotification(
resultContainer.getPeerAddressChanged(), attachment);
case SEND_FAILED :
return absHandler.handleNotification(
resultContainer.getSendFailed(), attachment);
case SHUTDOWN :
return absHandler.handleNotification(
resultContainer.getShutdown(), attachment);
default :
/* implementation specific handlers */
return absHandler.handleNotification(
resultContainer.notification(), attachment);
}
}
示例2: synchronized
import com.sun.nio.sctp.NotificationHandler; //导入方法依赖的package包/类
private <T> HandlerResult invokeNotificationHandler
(SctpResultContainer resultContainer,
NotificationHandler<T> handler,
T attachment) {
SctpNotification notification = resultContainer.notification();
synchronized (stateLock) {
notification.setAssociation(association);
}
if (!(handler instanceof AbstractNotificationHandler)) {
return handler.handleNotification(notification, attachment);
}
/* AbstractNotificationHandler */
AbstractNotificationHandler absHandler =
(AbstractNotificationHandler)handler;
switch(resultContainer.type()) {
case ASSOCIATION_CHANGED :
return absHandler.handleNotification(
resultContainer.getAssociationChanged(), attachment);
case PEER_ADDRESS_CHANGED :
return absHandler.handleNotification(
resultContainer.getPeerAddressChanged(), attachment);
case SEND_FAILED :
return absHandler.handleNotification(
resultContainer.getSendFailed(), attachment);
case SHUTDOWN :
return absHandler.handleNotification(
resultContainer.getShutdown(), attachment);
default :
/* implementation specific handlers */
return absHandler.handleNotification(
resultContainer.notification(), attachment);
}
}
示例3: invokeNotificationHandler
import com.sun.nio.sctp.NotificationHandler; //导入方法依赖的package包/类
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;
}
示例4: invokeNotificationHandler
import com.sun.nio.sctp.NotificationHandler; //导入方法依赖的package包/类
private <T> HandlerResult invokeNotificationHandler(
SctpResultContainer 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 absHandler =
(AbstractNotificationHandler)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;
}