com.sun.nio.sctp.HandlerResult Java Examples

The following examples show how to use com.sun.nio.sctp.HandlerResult. 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: Send.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Void attachment) {
    AssocChangeEvent event = notification.event();
    Association association = notification.association();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    this.maxInStreams = association.maxInboundStreams();
    this.maxOutStreams = association.maxOutboundStreams();

    return HandlerResult.RETURN;
}
 
Example #2
Source File: SctpMultiChannelImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification not, Object unused) {
    AssociationChange sac = (AssociationChange) not;

    /* Update map to reflect change in association */
    switch (not.event()) {
        case COMM_UP :
            Association newAssociation = new AssociationImpl
               (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
            addAssociation(newAssociation);
            break;
        case SHUTDOWN :
        case COMM_LOST :
        //case RESTART: ???
            /* mark association for removal after user handler invoked*/
            associationToRemove.set(lookupAssociation(sac.assocId()));
    }
    return HandlerResult.CONTINUE;
}
 
Example #3
Source File: SctpMultiChannelImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification not, Object unused) {
    AssociationChange sac = (AssociationChange) not;

    /* Update map to reflect change in association */
    switch (not.event()) {
        case COMM_UP :
            Association newAssociation = new AssociationImpl
               (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
            addAssociation(newAssociation);
            break;
        case SHUTDOWN :
        case COMM_LOST :
        //case RESTART: ???
            /* mark association for removal after user handler invoked*/
            associationToRemove.set(lookupAssociation(sac.assocId()));
    }
    return HandlerResult.CONTINUE;
}
 
Example #4
Source File: SctpMultiChannelImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification not, Object unused) {
    AssociationChange sac = (AssociationChange) not;

    /* Update map to reflect change in association */
    switch (not.event()) {
        case COMM_UP :
            Association newAssociation = new AssociationImpl
               (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
            addAssociation(newAssociation);
            break;
        case SHUTDOWN :
        case COMM_LOST :
        //case RESTART: ???
            /* mark association for removal after user handler invoked*/
            associationToRemove.set(lookupAssociation(sac.assocId()));
    }
    return HandlerResult.CONTINUE;
}
 
Example #5
Source File: SocketOptionTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    return HandlerResult.RETURN;
}
 
Example #6
Source File: Bind.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification sn, Object unused)
{
    debug("ShutdownNotification: " +  sn);
    return HandlerResult.CONTINUE;
}
 
Example #7
Source File: Receive.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification notification, Object attachment) {
    debug("ShutdownNotification");
    debug("  Association: " + notification.association());
    return HandlerResult.CONTINUE;
}
 
Example #8
Source File: Bind.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification acn, Object unused)
{
    debug("AssociationChangeNotification: " +  acn);
    return HandlerResult.CONTINUE;
}
 
Example #9
Source File: Receive.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    if (channel == null)
        return HandlerResult.RETURN;

    /* TEST 4: IllegalReceiveException - If the given handler invokes
     * the receive method of this channel*/
    ByteBuffer buffer = ByteBuffer.allocate(10);
    try {
        channel.receive(buffer, null, this);
        fail("IllegalReceiveException expected");
    } catch (IllegalReceiveException unused) {
        pass();
    } catch (IOException ioe) {
        unexpected(ioe);
    }

    return HandlerResult.CONTINUE;
}
 
Example #10
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 #11
Source File: Bind.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification sn, Object unused)
{
    debug("ShutdownNotification: " +  sn);
    return HandlerResult.CONTINUE;
}
 
Example #12
Source File: ReceiveIntoDirect.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    return HandlerResult.CONTINUE;
}
 
Example #13
Source File: Branch.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification notification, Object attachment) {
    debug("ShutdownNotification");
    debug("  Association: " + notification.association());

    fail("Shutdown should not be received");

    return HandlerResult.RETURN;
}
 
Example #14
Source File: Branch.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    return HandlerResult.RETURN;
}
 
Example #15
Source File: ReceiveIntoDirect.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    return HandlerResult.CONTINUE;
}
 
Example #16
Source File: CommUp.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification notification, Object attachment) {
    debug("ShutdownNotification");
    debug("  Association: " + notification.association());
    return HandlerResult.RETURN;
}
 
Example #17
Source File: ReceiveIntoDirect.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        PeerAddressChangeNotification pacn, Object unused)
{
    debug("PeerAddressChangeNotification: " +  pacn);
    return HandlerResult.CONTINUE;
}
 
Example #18
Source File: Bind.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        PeerAddressChangeNotification pacn, Object unused)
{
    debug("PeerAddressChangeNotification: " +  pacn);
    return HandlerResult.CONTINUE;
}
 
Example #19
Source File: Shutdown.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification sn, BooleanWrapper bool)
{
    bool.booleanValue(true);
    debug(sn.toString());
    return HandlerResult.RETURN;
}
 
Example #20
Source File: SocketOptionTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    return HandlerResult.RETURN;
}
 
Example #21
Source File: SctpChannelImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification not, Object unused) {
    if (not.event().equals(
            AssociationChangeNotification.AssocChangeEvent.COMM_UP) &&
            association == null) {
        AssociationChange sac = (AssociationChange) not;
        association = new AssociationImpl
               (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
    }
    return HandlerResult.CONTINUE;
}
 
Example #22
Source File: SocketOptionTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    return HandlerResult.RETURN;
}
 
Example #23
Source File: Branch.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    return HandlerResult.RETURN;
}
 
Example #24
Source File: Shutdown.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification sn, BooleanWrapper bool)
{
    bool.booleanValue(true);
    debug(sn.toString());
    return HandlerResult.RETURN;
}
 
Example #25
Source File: Receive.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification notification, Object attachment) {
    debug("ShutdownNotification");
    debug("  Association: " + notification.association());
    return HandlerResult.CONTINUE;
}
 
Example #26
Source File: Receive.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP))
        receivedCommUp = true;

    if (channel == null)
        return HandlerResult.RETURN;

    /* TEST 4: IllegalReceiveException - If the given handler invokes
     * the receive method of this channel*/
    ByteBuffer buffer = ByteBuffer.allocate(10);
    try {
        channel.receive(buffer, null, this);
        fail("IllegalReceiveException expected");
    } catch (IllegalReceiveException unused) {
        pass();
    } catch (IOException ioe) {
        unexpected(ioe);
    }

    return HandlerResult.CONTINUE;
}
 
Example #27
Source File: ReceiveIntoDirect.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification notification, Object attachment) {
    debug("ShutdownNotification");
    debug("  Association: " + notification.association());
    return HandlerResult.CONTINUE;
}
 
Example #28
Source File: ReceiveIntoDirect.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        PeerAddressChangeNotification pacn, Object unused)
{
    debug("PeerAddressChangeNotification: " +  pacn);
    return HandlerResult.CONTINUE;
}
 
Example #29
Source File: CommUp.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HandlerResult handleNotification(
        ShutdownNotification notification, Object attachment) {
    debug("ShutdownNotification");
    debug("  Association: " + notification.association());
    return HandlerResult.RETURN;
}
 
Example #30
Source File: CommUp.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public synchronized HandlerResult handleNotification(
        AssociationChangeNotification notification, Object attachment) {
    AssocChangeEvent event = notification.event();
    debug("AssociationChangeNotification");
    debug("  Association: " + notification.association());
    debug("  Event: " + event);

    if (event.equals(AssocChangeEvent.COMM_UP)) {
        receivedCommUp = true;
        notifyAll();
    }

    return HandlerResult.RETURN;
}