1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.netty.util;
18
19 import java.util.Arrays;
20
21
22
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 }