com.sun.nio.sctp.AbstractNotificationHandler Java Examples

The following examples show how to use com.sun.nio.sctp.AbstractNotificationHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SctpChannelImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #2
Source File: SctpChannelImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #3
Source File: SctpChannelImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #4
Source File: SctpChannelImpl.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #5
Source File: SctpChannelImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #6
Source File: SctpChannelImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #7
Source File: SctpChannelImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #8
Source File: SctpChannelImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #9
Source File: SctpChannelImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #10
Source File: SctpChannelImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #11
Source File: SctpChannelImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #12
Source File: SctpChannelImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #13
Source File: SctpChannelImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example #14
Source File: SctpMultiChannelImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #15
Source File: SctpMultiChannelImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #16
Source File: SctpMultiChannelImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #17
Source File: SctpMultiChannelImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #18
Source File: SctpMultiChannelImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #19
Source File: SctpMultiChannelImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #20
Source File: SctpMultiChannelImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #21
Source File: SctpMultiChannelImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #22
Source File: SctpMultiChannelImpl.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #23
Source File: SctpMultiChannelImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #24
Source File: SctpMultiChannelImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #25
Source File: SctpMultiChannelImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example #26
Source File: SctpMultiChannelImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
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;
}