AbstractIdleService.java
3.57 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
package com.google.common.util.concurrent;
import com.google.common.annotations.Beta;
import com.google.common.base.Supplier;
import com.google.common.base.Throwables;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@Beta
public abstract class AbstractIdleService
implements Service
{
private final Supplier<String> a = new Supplier() {};
private final Service b = new AbstractService()
{
protected final void doStart()
{
MoreExecutors.a(AbstractIdleService.this.executor(), AbstractIdleService.a(AbstractIdleService.this)).execute(new Runnable()
{
public final void run()
{
try
{
AbstractIdleService.this.startUp();
AbstractIdleService.2.this.notifyStarted();
return;
}
catch (Throwable localThrowable)
{
AbstractIdleService.2.this.notifyFailed(localThrowable);
throw Throwables.propagate(localThrowable);
}
}
});
}
protected final void doStop()
{
MoreExecutors.a(AbstractIdleService.this.executor(), AbstractIdleService.a(AbstractIdleService.this)).execute(new Runnable()
{
public final void run()
{
try
{
AbstractIdleService.this.shutDown();
AbstractIdleService.2.this.notifyStopped();
return;
}
catch (Throwable localThrowable)
{
AbstractIdleService.2.this.notifyFailed(localThrowable);
throw Throwables.propagate(localThrowable);
}
}
});
}
};
public final void addListener(Service.Listener paramListener, Executor paramExecutor)
{
this.b.addListener(paramListener, paramExecutor);
}
public final void awaitRunning()
{
this.b.awaitRunning();
}
public final void awaitRunning(long paramLong, TimeUnit paramTimeUnit)
throws TimeoutException
{
this.b.awaitRunning(paramLong, paramTimeUnit);
}
public final void awaitTerminated()
{
this.b.awaitTerminated();
}
public final void awaitTerminated(long paramLong, TimeUnit paramTimeUnit)
throws TimeoutException
{
this.b.awaitTerminated(paramLong, paramTimeUnit);
}
protected Executor executor()
{
new Executor()
{
public final void execute(Runnable paramAnonymousRunnable)
{
MoreExecutors.a((String)AbstractIdleService.a(AbstractIdleService.this).get(), paramAnonymousRunnable).start();
}
};
}
public final Throwable failureCause()
{
return this.b.failureCause();
}
public final boolean isRunning()
{
return this.b.isRunning();
}
protected String serviceName()
{
return getClass().getSimpleName();
}
protected abstract void shutDown()
throws Exception;
public final Service startAsync()
{
this.b.startAsync();
return this;
}
protected abstract void startUp()
throws Exception;
public final Service.State state()
{
return this.b.state();
}
public final Service stopAsync()
{
this.b.stopAsync();
return this;
}
public String toString()
{
String str1 = String.valueOf(String.valueOf(serviceName()));
String str2 = String.valueOf(String.valueOf(state()));
return str1.length() + 3 + str2.length() + str1 + " [" + str2 + "]";
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/util/concurrent/AbstractIdleService.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/