1 2 3 /* 4 * Copyright 2017 The Netty Project 5 * 6 * The Netty Project licenses this file to you under the Apache License, 7 * version 2.0 (the "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at: 9 * 10 * https://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 * License for the specific language governing permissions and limitations 16 * under the License. 17 */ 18 package io.netty5.channel; 19 20 import io.netty5.util.internal.ThrowableUtil; 21 22 import java.io.IOException; 23 24 /** 25 * Used to fail pending writes when a channel's output has been shutdown. 26 */ 27 public class ChannelOutputShutdownException extends IOException { 28 private static final long serialVersionUID = 6712549938359321378L; 29 30 public ChannelOutputShutdownException() { } 31 32 public ChannelOutputShutdownException(String msg) { 33 super(msg); 34 } 35 36 public ChannelOutputShutdownException(String msg, Throwable cause) { 37 super(msg, cause); 38 } 39 40 /** 41 * Creates a new {@link ChannelOutputShutdownException} which has the origin of the given {@link Class} and method. 42 */ 43 static ChannelOutputShutdownException newInstance(Class<?> clazz, String method) { 44 return ThrowableUtil.unknownStackTrace(new ChannelOutputShutdownException() { 45 @Override 46 public Throwable fillInStackTrace() { 47 // Suppress a warning since this method doesn't need synchronization 48 return this; // lgtm [java/non-sync-override] 49 } 50 }, clazz, method); 51 } 52 }