litesoft
Diff Revisions
947
vs
948
for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/nonpublic/EscalatingProcess.java
|
@@ -5,49 +5,39 @@ |
5 |
5 |
|
import org.litesoft.commonfoundation.typeutils.*; |
6 |
6 |
|
import org.litesoft.core.delayed.*; |
7 |
7 |
|
|
8 |
|
- |
public class EscalatingProcess implements TimedRunnable |
9 |
|
- |
{ |
|
8 |
+ |
public class EscalatingProcess implements TimedRunnable { |
10 |
9 |
|
private long mDelay = 0; |
11 |
10 |
|
private DelayedProcess mProcess; |
12 |
11 |
|
|
13 |
|
- |
public EscalatingProcess( DelayedProcess pProcess ) |
14 |
|
- |
{ |
|
12 |
+ |
public EscalatingProcess( DelayedProcess pProcess ) { |
15 |
13 |
|
Objects.assertNotNull( "Process", mProcess = pProcess ); |
16 |
14 |
|
} |
17 |
15 |
|
|
18 |
|
- |
private synchronized long initDelay() |
19 |
|
- |
{ |
|
16 |
+ |
private synchronized long initDelay() { |
20 |
17 |
|
return mDelay = 125; |
21 |
18 |
|
} |
22 |
19 |
|
|
23 |
|
- |
private synchronized long escalateDelay() |
24 |
|
- |
{ |
|
20 |
+ |
private synchronized long escalateDelay() { |
25 |
21 |
|
return (1000 <= (mDelay += mDelay)) ? mDelay : (mDelay = 1000); |
26 |
22 |
|
} |
27 |
23 |
|
|
28 |
|
- |
public synchronized void cancel() |
29 |
|
- |
{ |
|
24 |
+ |
public synchronized void cancel() { |
30 |
25 |
|
mDelay = 0; |
31 |
26 |
|
} |
32 |
27 |
|
|
33 |
|
- |
public synchronized boolean isLive() |
34 |
|
- |
{ |
|
28 |
+ |
public synchronized boolean isLive() { |
35 |
29 |
|
return (mDelay != 0); |
36 |
30 |
|
} |
37 |
31 |
|
|
38 |
|
- |
public void schedule() |
39 |
|
- |
{ |
|
32 |
+ |
public void schedule() { |
40 |
33 |
|
TimedRunnableManager.INSTANCE.cancel( this ); |
41 |
34 |
|
TimedRunnableManager.INSTANCE.runIn( this, initDelay() ); |
42 |
35 |
|
} |
43 |
36 |
|
|
44 |
37 |
|
@Override |
45 |
|
- |
public Again runOnce() |
46 |
|
- |
{ |
47 |
|
- |
if ( isLive() ) |
48 |
|
- |
{ |
49 |
|
- |
if ( !mProcess.process() ) |
50 |
|
- |
{ |
|
38 |
+ |
public Again runOnce() { |
|
39 |
+ |
if ( isLive() ) { |
|
40 |
+ |
if ( !mProcess.process() ) { |
51 |
41 |
|
return new RunAgainIn( escalateDelay() ); |
52 |
42 |
|
} |
53 |
43 |
|
cancel(); |