Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/nio/sctp/AbstractNotificationHandler.java
38923 views
1
/*
2
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
package com.sun.nio.sctp;
26
27
/**
28
* A skeletal handler that consumes notifications and continues.
29
*
30
* <P> This class trivially implements the {@code handleNotification} methods to
31
* return {@link HandlerResult#CONTINUE CONTINUE} so that all notifications are
32
* consumed and the channel continues to try and receive a message.
33
*
34
* <P> It also provides overloaded versions of the {@code handleNotification}
35
* methods, one for each of the required supported notification types, {@link
36
* AssociationChangeNotification}, {@link PeerAddressChangeNotification},
37
* {@link SendFailedNotification}, and {@link ShutdownNotification}. The
38
* appropriate method will be invoked when the notification is received.
39
*
40
* @since 1.7
41
*/
42
@jdk.Exported
43
public class AbstractNotificationHandler<T>
44
implements NotificationHandler<T>
45
{
46
/**
47
* Initializes a new instance of this class.
48
*/
49
protected AbstractNotificationHandler() {}
50
51
/**
52
* Invoked when an implementation specific notification is received from the
53
* SCTP stack.
54
*
55
* @param notification
56
* The notification
57
*
58
* @param attachment
59
* The object attached to the {@code receive} operation when it was
60
* initiated.
61
*
62
* @return The handler result
63
*/
64
@Override
65
public HandlerResult handleNotification(Notification notification,
66
T attachment) {
67
return HandlerResult.CONTINUE;
68
}
69
70
/**
71
* Invoked when an {@link AssociationChangeNotification} is received from
72
* the SCTP stack.
73
*
74
* @param notification
75
* The notification
76
*
77
* @param attachment
78
* The object attached to the {@code receive} operation when it was
79
* initiated.
80
*
81
* @return The handler result
82
*/
83
public HandlerResult handleNotification(AssociationChangeNotification notification,
84
T attachment) {
85
return HandlerResult.CONTINUE;
86
}
87
88
/**
89
* Invoked when an {@link PeerAddressChangeNotification} is received from
90
* the SCTP stack.
91
*
92
* @param notification
93
* The notification
94
*
95
* @param attachment
96
* The object attached to the {@code receive} operation when it was
97
* initiated.
98
*
99
* @return The handler result
100
*/
101
public HandlerResult handleNotification(PeerAddressChangeNotification notification,
102
T attachment) {
103
return HandlerResult.CONTINUE;
104
}
105
106
/**
107
* Invoked when an {@link SendFailedNotification} is received from
108
* the SCTP stack.
109
*
110
* @param notification
111
* The notification
112
*
113
* @param attachment
114
* The object attached to the {@code receive} operation when it was
115
* initiated.
116
*
117
* @return The handler result
118
*/
119
public HandlerResult handleNotification(SendFailedNotification notification,
120
T attachment) {
121
return HandlerResult.CONTINUE;
122
}
123
124
/**
125
* Invoked when an {@link ShutdownNotification} is received from
126
* the SCTP stack.
127
*
128
* @param notification
129
* The notification
130
*
131
* @param attachment
132
* The object attached to the {@code receive} operation when it was
133
* initiated.
134
*
135
* @return The handler result
136
*/
137
public HandlerResult handleNotification(ShutdownNotification notification,
138
T attachment) {
139
return HandlerResult.CONTINUE;
140
}
141
}
142
143