Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/classes/sun/nio/ch/sctp/SendFailed.java
32301 views
/*1* Copyright (c) 2009, 2012, 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 sun.nio.ch.sctp;2526import java.nio.ByteBuffer;27import java.net.SocketAddress;28import com.sun.nio.sctp.Association;29import com.sun.nio.sctp.SendFailedNotification;3031/**32* An implementation of SendFailedNotification33*/34public class SendFailed extends SendFailedNotification35implements SctpNotification36{37private Association association;38/* assocId is used to lookup the association before the notification is39* returned to user code */40private int assocId;41private SocketAddress address;42private ByteBuffer buffer;43private int errorCode;44private int streamNumber;4546/* Invoked from native */47private SendFailed(int assocId,48SocketAddress address,49ByteBuffer buffer,50int errorCode,51int streamNumber) {52this.assocId = assocId;53this.errorCode = errorCode;54this.streamNumber = streamNumber;55this.address = address;56this.buffer = buffer;57}5859@Override60public int assocId() {61return assocId;62}6364@Override65public void setAssociation(Association association) {66this.association = association;67}6869@Override70public Association association() {71/* may be null */72return association;73}7475@Override76public SocketAddress address() {77assert address != null;78return address;79}8081@Override82public ByteBuffer buffer() {83assert buffer != null;84return buffer;85}8687@Override88public int errorCode() {89return errorCode;90}9192@Override93public int streamNumber() {94return streamNumber;95}9697@Override98public String toString() {99StringBuilder sb = new StringBuilder();100sb.append(super.toString()).append(" [");101sb.append("Association:").append(association);102sb.append(", Address: ").append(address);103sb.append(", buffer: ").append(buffer);104sb.append(", errorCode: ").append(errorCode);105sb.append(", streamNumber: ").append(streamNumber);106sb.append("]");107return sb.toString();108}109}110111112