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 StackTraceElement[] trace = cachedStackTrace;
53 int hashCode = 0;
54 for (StackTraceElement e: trace) {
55 hashCode = hashCode * 31 + e.hashCode();
56 }
57 return hashCode;
58 }
59
60 @Override
61 public boolean equals(Object o) {
62 if (!(o instanceof ResourceLeakException)) {
63 return false;
64 }
65 if (o == this) {
66 return true;
67 }
68
69 return Arrays.equals(cachedStackTrace, ((ResourceLeakException) o).cachedStackTrace);
70 }
71 }