Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/nio/sctp/AbstractNotificationHandler.java
38923 views
/*1* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package com.sun.nio.sctp;2526/**27* A skeletal handler that consumes notifications and continues.28*29* <P> This class trivially implements the {@code handleNotification} methods to30* return {@link HandlerResult#CONTINUE CONTINUE} so that all notifications are31* consumed and the channel continues to try and receive a message.32*33* <P> It also provides overloaded versions of the {@code handleNotification}34* methods, one for each of the required supported notification types, {@link35* AssociationChangeNotification}, {@link PeerAddressChangeNotification},36* {@link SendFailedNotification}, and {@link ShutdownNotification}. The37* appropriate method will be invoked when the notification is received.38*39* @since 1.740*/41@jdk.Exported42public class AbstractNotificationHandler<T>43implements NotificationHandler<T>44{45/**46* Initializes a new instance of this class.47*/48protected AbstractNotificationHandler() {}4950/**51* Invoked when an implementation specific notification is received from the52* SCTP stack.53*54* @param notification55* The notification56*57* @param attachment58* The object attached to the {@code receive} operation when it was59* initiated.60*61* @return The handler result62*/63@Override64public HandlerResult handleNotification(Notification notification,65T attachment) {66return HandlerResult.CONTINUE;67}6869/**70* Invoked when an {@link AssociationChangeNotification} is received from71* the SCTP stack.72*73* @param notification74* The notification75*76* @param attachment77* The object attached to the {@code receive} operation when it was78* initiated.79*80* @return The handler result81*/82public HandlerResult handleNotification(AssociationChangeNotification notification,83T attachment) {84return HandlerResult.CONTINUE;85}8687/**88* Invoked when an {@link PeerAddressChangeNotification} is received from89* the SCTP stack.90*91* @param notification92* The notification93*94* @param attachment95* The object attached to the {@code receive} operation when it was96* initiated.97*98* @return The handler result99*/100public HandlerResult handleNotification(PeerAddressChangeNotification notification,101T attachment) {102return HandlerResult.CONTINUE;103}104105/**106* Invoked when an {@link SendFailedNotification} is received from107* the SCTP stack.108*109* @param notification110* The notification111*112* @param attachment113* The object attached to the {@code receive} operation when it was114* initiated.115*116* @return The handler result117*/118public HandlerResult handleNotification(SendFailedNotification notification,119T attachment) {120return HandlerResult.CONTINUE;121}122123/**124* Invoked when an {@link ShutdownNotification} is received from125* the SCTP stack.126*127* @param notification128* The notification129*130* @param attachment131* The object attached to the {@code receive} operation when it was132* initiated.133*134* @return The handler result135*/136public HandlerResult handleNotification(ShutdownNotification notification,137T attachment) {138return HandlerResult.CONTINUE;139}140}141142143