ModernAsyncTask.java
5.09 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
package android.support.v4.content;
import android.os.Binder;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.util.Log;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
abstract class ModernAsyncTask<Params, Progress, Result>
{
private static final ThreadFactory a = new ThreadFactory()
{
private final AtomicInteger a = new AtomicInteger(1);
public final Thread newThread(Runnable paramAnonymousRunnable)
{
return new Thread(paramAnonymousRunnable, "ModernAsyncTask #" + this.a.getAndIncrement());
}
};
private static final BlockingQueue<Runnable> b = new LinkedBlockingQueue(10);
private static b c;
public static final Executor d;
private static volatile Executor i;
final c<Params, Result> e = new c()
{
public final Result call()
throws Exception
{
ModernAsyncTask.a(ModernAsyncTask.this).set(true);
Object localObject5 = null;
Object localObject4 = null;
Object localObject2 = localObject4;
Object localObject1 = localObject5;
try
{
Process.setThreadPriority(10);
localObject2 = localObject4;
localObject1 = localObject5;
localObject4 = ModernAsyncTask.this.a();
localObject2 = localObject4;
localObject1 = localObject4;
Binder.flushPendingCommands();
return (Result)localObject4;
}
catch (Throwable localThrowable)
{
localObject1 = localObject2;
ModernAsyncTask.b(ModernAsyncTask.this).set(true);
localObject1 = localObject2;
throw localThrowable;
}
finally
{
ModernAsyncTask.this.d(localObject1);
}
}
};
final FutureTask<Result> f = new FutureTask(this.e)
{
protected final void done()
{
try
{
Object localObject = get();
ModernAsyncTask.this.c(localObject);
return;
}
catch (InterruptedException localInterruptedException)
{
Log.w("AsyncTask", localInterruptedException);
return;
}
catch (ExecutionException localExecutionException)
{
throw new RuntimeException("An error occurred while executing doInBackground()", localExecutionException.getCause());
}
catch (CancellationException localCancellationException)
{
ModernAsyncTask.this.c(null);
return;
}
catch (Throwable localThrowable)
{
throw new RuntimeException("An error occurred while executing doInBackground()", localThrowable);
}
}
};
volatile Status g = Status.PENDING;
final AtomicBoolean h = new AtomicBoolean();
private final AtomicBoolean j = new AtomicBoolean();
static
{
ThreadPoolExecutor localThreadPoolExecutor = new ThreadPoolExecutor(5, 128, 1L, TimeUnit.SECONDS, b, a);
d = localThreadPoolExecutor;
i = localThreadPoolExecutor;
}
protected static void b() {}
private static Handler c()
{
try
{
if (c == null) {
c = new b();
}
b localb = c;
return localb;
}
finally {}
}
protected abstract Result a();
protected void a(Result paramResult) {}
protected void b(Result paramResult) {}
final void c(Result paramResult)
{
if (!this.j.get()) {
d(paramResult);
}
}
final Result d(Result paramResult)
{
c().obtainMessage(1, new a(this, new Object[] { paramResult })).sendToTarget();
return paramResult;
}
final void e(Result paramResult)
{
if (this.h.get()) {
b(paramResult);
}
for (;;)
{
this.g = Status.FINISHED;
return;
a(paramResult);
}
}
public static enum Status
{
private Status() {}
}
static final class a<Data>
{
final ModernAsyncTask a;
final Data[] b;
a(ModernAsyncTask paramModernAsyncTask, Data... paramVarArgs)
{
this.a = paramModernAsyncTask;
this.b = paramVarArgs;
}
}
static final class b
extends Handler
{
public b()
{
super();
}
public final void handleMessage(Message paramMessage)
{
ModernAsyncTask.a locala = (ModernAsyncTask.a)paramMessage.obj;
switch (paramMessage.what)
{
default:
return;
case 1:
locala.a.e(locala.b[0]);
return;
}
ModernAsyncTask.b();
}
}
static abstract class c<Params, Result>
implements Callable<Result>
{
Params[] b;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/content/ModernAsyncTask.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/