author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 25859 | jdk/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SendFailed.java@3317bb8137f4 |
permissions | -rw-r--r-- |
2542 | 1 |
/* |
14342
8435a30053c1
7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents:
11823
diff
changeset
|
2 |
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
2542 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2542 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2542 | 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 |
* |
|
5506 | 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. |
|
2542 | 24 |
*/ |
11823
ee83ae88512d
7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents:
5506
diff
changeset
|
25 |
package sun.nio.ch.sctp; |
2542 | 26 |
|
27 |
import java.nio.ByteBuffer; |
|
28 |
import java.net.SocketAddress; |
|
29 |
import com.sun.nio.sctp.Association; |
|
30 |
import com.sun.nio.sctp.SendFailedNotification; |
|
31 |
||
32 |
/** |
|
33 |
* An implementation of SendFailedNotification |
|
34 |
*/ |
|
11823
ee83ae88512d
7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents:
5506
diff
changeset
|
35 |
public class SendFailed extends SendFailedNotification |
2542 | 36 |
implements SctpNotification |
37 |
{ |
|
38 |
private Association association; |
|
39 |
/* assocId is used to lookup the association before the notification is |
|
40 |
* returned to user code */ |
|
41 |
private int assocId; |
|
42 |
private SocketAddress address; |
|
43 |
private ByteBuffer buffer; |
|
44 |
private int errorCode; |
|
45 |
private int streamNumber; |
|
46 |
||
47 |
/* Invoked from native */ |
|
11823
ee83ae88512d
7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents:
5506
diff
changeset
|
48 |
private SendFailed(int assocId, |
ee83ae88512d
7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents:
5506
diff
changeset
|
49 |
SocketAddress address, |
ee83ae88512d
7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents:
5506
diff
changeset
|
50 |
ByteBuffer buffer, |
ee83ae88512d
7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents:
5506
diff
changeset
|
51 |
int errorCode, |
ee83ae88512d
7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents:
5506
diff
changeset
|
52 |
int streamNumber) { |
2542 | 53 |
this.assocId = assocId; |
54 |
this.errorCode = errorCode; |
|
55 |
this.streamNumber = streamNumber; |
|
56 |
this.address = address; |
|
57 |
this.buffer = buffer; |
|
58 |
} |
|
59 |
||
60 |
@Override |
|
61 |
public int assocId() { |
|
62 |
return assocId; |
|
63 |
} |
|
64 |
||
65 |
@Override |
|
66 |
public void setAssociation(Association association) { |
|
67 |
this.association = association; |
|
68 |
} |
|
69 |
||
70 |
@Override |
|
71 |
public Association association() { |
|
72 |
/* may be null */ |
|
73 |
return association; |
|
74 |
} |
|
75 |
||
76 |
@Override |
|
77 |
public SocketAddress address() { |
|
78 |
assert address != null; |
|
79 |
return address; |
|
80 |
} |
|
81 |
||
82 |
@Override |
|
83 |
public ByteBuffer buffer() { |
|
84 |
assert buffer != null; |
|
85 |
return buffer; |
|
86 |
} |
|
87 |
||
88 |
@Override |
|
89 |
public int errorCode() { |
|
90 |
return errorCode; |
|
91 |
} |
|
92 |
||
93 |
@Override |
|
94 |
public int streamNumber() { |
|
95 |
return streamNumber; |
|
96 |
} |
|
97 |
||
98 |
@Override |
|
99 |
public String toString() { |
|
100 |
StringBuilder sb = new StringBuilder(); |
|
101 |
sb.append(super.toString()).append(" ["); |
|
102 |
sb.append("Association:").append(association); |
|
103 |
sb.append(", Address: ").append(address); |
|
104 |
sb.append(", buffer: ").append(buffer); |
|
105 |
sb.append(", errorCode: ").append(errorCode); |
|
106 |
sb.append(", streamNumber: ").append(streamNumber); |
|
107 |
sb.append("]"); |
|
108 |
return sb.toString(); |
|
109 |
} |
|
110 |
} |