当前位置: 首页>>代码示例>>Java>>正文


Java NotificationHandler类代码示例

本文整理汇总了Java中com.sun.nio.sctp.NotificationHandler的典型用法代码示例。如果您正苦于以下问题:Java NotificationHandler类的具体用法?Java NotificationHandler怎么用?Java NotificationHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NotificationHandler类属于com.sun.nio.sctp包,在下文中一共展示了NotificationHandler类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: receive

import com.sun.nio.sctp.NotificationHandler; //导入依赖的package包/类
@Override
public <T> MessageInfo receive(ByteBuffer buffer,
                               T attachment,
                               NotificationHandler<T> handler)
        throws IOException {
    return receive(buffer, attachment, handler, false);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:SctpChannelImpl.java

示例2: 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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:SctpChannelImpl.java

示例3: 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);
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:36,代码来源:SctpChannelImpl.java

示例4: receive

import com.sun.nio.sctp.NotificationHandler; //导入依赖的package包/类
@Override
public <T> MessageInfo receive(ByteBuffer buffer, T attachment,
        NotificationHandler<T> handler) throws IOException {
    throw new UnsupportedOperationException(message);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:SctpMultiChannelImpl.java

示例5: receive

import com.sun.nio.sctp.NotificationHandler; //导入依赖的package包/类
@Override
public <T> MessageInfo receive(ByteBuffer dst, T attachment,
        NotificationHandler<T> handler) throws IOException {
    throw new UnsupportedOperationException(message);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:SctpChannelImpl.java

示例6: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:SctpMultiChannelImpl.java


注:本文中的com.sun.nio.sctp.NotificationHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。