FinalizableReferenceQueue.java
6.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
package com.google.common.base;
import com.google.common.annotations.VisibleForTesting;
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.ref.PhantomReference;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
public class FinalizableReferenceQueue
implements Closeable
{
private static final Logger d;
private static final Method e;
final ReferenceQueue<Object> a = new ReferenceQueue();
final PhantomReference<Object> b = new PhantomReference(this, this.a);
final boolean c;
static
{
int i = 0;
d = Logger.getLogger(FinalizableReferenceQueue.class.getName());
d locald = new d();
a locala = new a();
b localb = new b();
while (i < 3)
{
Class localClass = new c[] { locald, locala, localb }[i].a();
if (localClass != null)
{
e = a(localClass);
return;
}
i += 1;
}
throw new AssertionError();
}
public FinalizableReferenceQueue()
{
try
{
e.invoke(null, new Object[] { FinalizableReference.class, this.a, this.b });
this.c = bool;
return;
}
catch (IllegalAccessException localIllegalAccessException)
{
throw new AssertionError(localIllegalAccessException);
}
catch (Throwable localThrowable)
{
for (;;)
{
d.log(Level.INFO, "Failed to start reference finalizer thread. Reference cleanup will only occur when new references are created.", localThrowable);
bool = false;
}
}
}
private static Method a(Class<?> paramClass)
{
try
{
paramClass = paramClass.getMethod("startFinalizer", new Class[] { Class.class, ReferenceQueue.class, PhantomReference.class });
return paramClass;
}
catch (NoSuchMethodException paramClass)
{
throw new AssertionError(paramClass);
}
}
final void a()
{
if (this.c) {
return;
}
for (;;)
{
Reference localReference = this.a.poll();
if (localReference == null) {
break;
}
localReference.clear();
try
{
((FinalizableReference)localReference).finalizeReferent();
}
catch (Throwable localThrowable)
{
d.log(Level.SEVERE, "Error cleaning up after reference.", localThrowable);
}
}
}
public void close()
{
this.b.enqueue();
a();
}
static final class a
implements FinalizableReferenceQueue.c
{
public final Class<?> a()
{
URL localURL;
try
{
String str1 = String.valueOf("com.google.common.base.internal.Finalizer".replace('.', '/')).concat(".class");
localURL = getClass().getClassLoader().getResource(str1);
if (localURL == null) {
throw new FileNotFoundException(str1);
}
}
catch (Exception localException)
{
FinalizableReferenceQueue.b().log(Level.WARNING, "Could not load Finalizer in its own class loader.Loading Finalizer in the current class loader instead. As a result, you will not be ableto garbage collect this class loader. To support reclaiming this class loader, eitherresolve the underlying issue, or move Google Collections to your system class path.", localException);
return null;
}
String str2 = localURL.toString();
if (!str2.endsWith(localException))
{
localObject = String.valueOf(str2);
if (((String)localObject).length() != 0) {}
for (localObject = "Unsupported path style: ".concat((String)localObject);; localObject = new String("Unsupported path style: ")) {
throw new IOException((String)localObject);
}
}
Object localObject = new URLClassLoader(new URL[] { new URL(localURL, str2.substring(0, str2.length() - ((String)localObject).length())) }, null).loadClass("com.google.common.base.internal.Finalizer");
return (Class<?>)localObject;
}
}
static final class b
implements FinalizableReferenceQueue.c
{
public final Class<?> a()
{
try
{
Class localClass = Class.forName("com.google.common.base.internal.Finalizer");
return localClass;
}
catch (ClassNotFoundException localClassNotFoundException)
{
throw new AssertionError(localClassNotFoundException);
}
}
}
static abstract interface c
{
@Nullable
public abstract Class<?> a();
}
static final class d
implements FinalizableReferenceQueue.c
{
@VisibleForTesting
static boolean a;
/* Error */
public final Class<?> a()
{
// Byte code:
// 0: getstatic 24 com/google/common/base/FinalizableReferenceQueue$d:a Z
// 3: ifeq +5 -> 8
// 6: aconst_null
// 7: areturn
// 8: invokestatic 30 java/lang/ClassLoader:getSystemClassLoader ()Ljava/lang/ClassLoader;
// 11: astore_1
// 12: aload_1
// 13: ifnull -7 -> 6
// 16: aload_1
// 17: ldc 32
// 19: invokevirtual 36 java/lang/ClassLoader:loadClass (Ljava/lang/String;)Ljava/lang/Class;
// 22: astore_1
// 23: aload_1
// 24: areturn
// 25: astore_1
// 26: invokestatic 40 com/google/common/base/FinalizableReferenceQueue:b ()Ljava/util/logging/Logger;
// 29: ldc 42
// 31: invokevirtual 48 java/util/logging/Logger:info (Ljava/lang/String;)V
// 34: aconst_null
// 35: areturn
// 36: astore_1
// 37: aconst_null
// 38: areturn
// Local variable table:
// start length slot name signature
// 0 39 0 this d
// 11 13 1 localObject Object
// 25 1 1 localSecurityException SecurityException
// 36 1 1 localClassNotFoundException ClassNotFoundException
// Exception table:
// from to target type
// 8 12 25 java/lang/SecurityException
// 16 23 36 java/lang/ClassNotFoundException
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/base/FinalizableReferenceQueue.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/