1 package org
.jetbrains
.idea
.svn
;
3 public class DefendedCopiesRefreshProxy
implements CopiesRefresh
{
4 private final ReentranceDefence myDefence
;
6 private final MyEnsureInit myEnsureInit
;
7 private final MyAsynchRequest myAsynchRequest
;
8 private final MySynchRequest mySynchRequest
;
10 public DefendedCopiesRefreshProxy(final CopiesRefresh refresh
) {
11 myDefence
= new ReentranceDefence();
13 myEnsureInit
= new MyEnsureInit(refresh
);
14 myAsynchRequest
= new MyAsynchRequest(refresh
);
15 mySynchRequest
= new MySynchRequest(refresh
);
18 public void ensureInit() {
19 ReentranceDefence
.executeReentrant(myDefence
, myEnsureInit
);
22 public void asynchRequest() {
23 ReentranceDefence
.executeReentrant(myDefence
, myAsynchRequest
);
26 public void synchRequest() {
27 ReentranceDefence
.executeReentrant(myDefence
, mySynchRequest
);
30 public Runnable
proxyRefresher(final Runnable runnable
) {
31 return new Runnable() {
33 myDefence
.executeOtherDefended(runnable
);
38 private static class MyAsynchRequest
extends MyBase
{
39 private MyAsynchRequest(final CopiesRefresh delegate
) {
43 public Boolean
executeMe() {
44 myDelegate
.asynchRequest();
49 private static class MySynchRequest
extends MyBase
{
50 private MySynchRequest(final CopiesRefresh delegate
) {
54 public Boolean
executeMe() {
55 myDelegate
.synchRequest();
60 private static class MyEnsureInit
extends MyBase
{
61 private MyEnsureInit(final CopiesRefresh delegate
) {
65 public Boolean
executeMe() {
66 myDelegate
.ensureInit();
71 private abstract static class MyBase
implements ReentranceDefence
.MyControlled
<Boolean
> {
72 protected final CopiesRefresh myDelegate
;
74 protected MyBase(final CopiesRefresh delegate
) {
75 myDelegate
= delegate
;
78 public Boolean
executeMeSimple() {