查看本类的 API文档回源码主页即时通讯网 - 即时通讯开发者社区!
1   /*
2    * Copyright 2013 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  
17  package io.netty.util;
18  
19  import java.util.Arrays;
20  
21  /**
22   * @deprecated This class will be removed in the future version.
23   */
24  @Deprecated
25  public class ResourceLeakException extends RuntimeException {
26  
27      private static final long serialVersionUID = 7186453858343358280L;
28  
29      private final StackTraceElement[] cachedStackTrace;
30  
31      public ResourceLeakException() {
32          cachedStackTrace = getStackTrace();
33      }
34  
35      public ResourceLeakException(String message) {
36          super(message);
37          cachedStackTrace = getStackTrace();
38      }
39  
40      public ResourceLeakException(String message, Throwable cause) {
41          super(message, cause);
42          cachedStackTrace = getStackTrace();
43      }
44  
45      public ResourceLeakException(Throwable cause) {
46          super(cause);
47          cachedStackTrace = getStackTrace();
48      }
49  
50      @Override
51      public int hashCode() {
52          int hashCode = 0;
53          for (StackTraceElement e: cachedStackTrace) {
54              hashCode = hashCode * 31 + e.hashCode();
55          }
56          return hashCode;
57      }
58  
59      @Override
60      public boolean equals(Object o) {
61          if (!(o instanceof ResourceLeakException)) {
62              return false;
63          }
64          if (o == this) {
65              return true;
66          }
67  
68          return Arrays.equals(cachedStackTrace, ((ResourceLeakException) o).cachedStackTrace);
69      }
70  }