BackgroundInitializer.java
6.26 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
package org.apache.commons.lang3.concurrent;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
public abstract class BackgroundInitializer<T>
implements ConcurrentInitializer<T>
{
private ExecutorService a;
private ExecutorService b;
private Future<T> c;
protected BackgroundInitializer()
{
this(null);
}
protected BackgroundInitializer(ExecutorService paramExecutorService)
{
setExternalExecutor(paramExecutorService);
}
public T get()
throws ConcurrentException
{
try
{
Object localObject = getFuture().get();
return (T)localObject;
}
catch (ExecutionException localExecutionException)
{
ConcurrentUtils.handleCause(localExecutionException);
return null;
}
catch (InterruptedException localInterruptedException)
{
Thread.currentThread().interrupt();
throw new ConcurrentException(localInterruptedException);
}
}
protected final ExecutorService getActiveExecutor()
{
try
{
ExecutorService localExecutorService = this.b;
return localExecutorService;
}
finally
{
localObject = finally;
throw ((Throwable)localObject);
}
}
public final ExecutorService getExternalExecutor()
{
try
{
ExecutorService localExecutorService = this.a;
return localExecutorService;
}
finally
{
localObject = finally;
throw ((Throwable)localObject);
}
}
public Future<T> getFuture()
{
try
{
if (this.c == null) {
throw new IllegalStateException("start() must be called first!");
}
}
finally {}
Future localFuture = this.c;
return localFuture;
}
protected int getTaskCount()
{
return 1;
}
protected abstract T initialize()
throws Exception;
/* Error */
public boolean isStarted()
{
// Byte code:
// 0: aload_0
// 1: monitorenter
// 2: aload_0
// 3: getfield 72 org/apache/commons/lang3/concurrent/BackgroundInitializer:c Ljava/util/concurrent/Future;
// 6: astore_2
// 7: aload_2
// 8: ifnull +9 -> 17
// 11: iconst_1
// 12: istore_1
// 13: aload_0
// 14: monitorexit
// 15: iload_1
// 16: ireturn
// 17: iconst_0
// 18: istore_1
// 19: goto -6 -> 13
// 22: astore_2
// 23: aload_0
// 24: monitorexit
// 25: aload_2
// 26: athrow
// Local variable table:
// start length slot name signature
// 0 27 0 this BackgroundInitializer
// 12 7 1 bool boolean
// 6 2 2 localFuture Future
// 22 4 2 localObject Object
// Exception table:
// from to target type
// 2 7 22 finally
}
public final void setExternalExecutor(ExecutorService paramExecutorService)
{
try
{
if (isStarted()) {
throw new IllegalStateException("Cannot set ExecutorService after start()!");
}
}
finally {}
this.a = paramExecutorService;
}
/* Error */
public boolean start()
{
// Byte code:
// 0: aload_0
// 1: monitorenter
// 2: aload_0
// 3: invokevirtual 89 org/apache/commons/lang3/concurrent/BackgroundInitializer:isStarted ()Z
// 6: ifne +64 -> 70
// 9: aload_0
// 10: aload_0
// 11: invokevirtual 94 org/apache/commons/lang3/concurrent/BackgroundInitializer:getExternalExecutor ()Ljava/util/concurrent/ExecutorService;
// 14: putfield 67 org/apache/commons/lang3/concurrent/BackgroundInitializer:b Ljava/util/concurrent/ExecutorService;
// 17: aload_0
// 18: getfield 67 org/apache/commons/lang3/concurrent/BackgroundInitializer:b Ljava/util/concurrent/ExecutorService;
// 21: ifnonnull +44 -> 65
// 24: aload_0
// 25: invokevirtual 96 org/apache/commons/lang3/concurrent/BackgroundInitializer:getTaskCount ()I
// 28: invokestatic 102 java/util/concurrent/Executors:newFixedThreadPool (I)Ljava/util/concurrent/ExecutorService;
// 31: astore_2
// 32: aload_0
// 33: aload_2
// 34: putfield 67 org/apache/commons/lang3/concurrent/BackgroundInitializer:b Ljava/util/concurrent/ExecutorService;
// 37: aload_0
// 38: aload_0
// 39: getfield 67 org/apache/commons/lang3/concurrent/BackgroundInitializer:b Ljava/util/concurrent/ExecutorService;
// 42: new 9 org/apache/commons/lang3/concurrent/BackgroundInitializer$a
// 45: dup
// 46: aload_0
// 47: aload_2
// 48: invokespecial 105 org/apache/commons/lang3/concurrent/BackgroundInitializer$a:<init> (Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;Ljava/util/concurrent/ExecutorService;)V
// 51: invokeinterface 111 2 0
// 56: putfield 72 org/apache/commons/lang3/concurrent/BackgroundInitializer:c Ljava/util/concurrent/Future;
// 59: iconst_1
// 60: istore_1
// 61: aload_0
// 62: monitorexit
// 63: iload_1
// 64: ireturn
// 65: aconst_null
// 66: astore_2
// 67: goto -30 -> 37
// 70: iconst_0
// 71: istore_1
// 72: goto -11 -> 61
// 75: astore_2
// 76: aload_0
// 77: monitorexit
// 78: aload_2
// 79: athrow
// Local variable table:
// start length slot name signature
// 0 80 0 this BackgroundInitializer
// 60 12 1 bool boolean
// 31 36 2 localExecutorService ExecutorService
// 75 4 2 localObject Object
// Exception table:
// from to target type
// 2 37 75 finally
// 37 59 75 finally
}
final class a
implements Callable<T>
{
private final ExecutorService b;
public a(ExecutorService paramExecutorService)
{
this.b = paramExecutorService;
}
public final T call()
throws Exception
{
try
{
Object localObject1 = BackgroundInitializer.this.initialize();
return (T)localObject1;
}
finally
{
if (this.b != null) {
this.b.shutdown();
}
}
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/org/apache/commons/lang3/concurrent/BackgroundInitializer.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/