|
@@ -6,26 +6,22 @@ |
6 |
6 |
|
import org.litesoft.logger.*; |
7 |
7 |
|
|
8 |
8 |
|
public abstract class AbstractPeerSupportingEventBus extends EventBus implements PeerSupportingEventBus, |
9 |
|
- |
EventConstrictor |
10 |
|
- |
{ |
|
9 |
+ |
EventConstrictor { |
11 |
10 |
|
private IStatePeerSupportingEventBus mStatePeerSupportingEventBus = |
12 |
11 |
|
NullStatePeerSupportingEventBus.INSTANCE; |
13 |
12 |
|
|
14 |
13 |
|
protected AbstractPeerSupportingEventBus( String pForm, int pClientIdNumber, // |
15 |
14 |
|
TimedRunner pTimedRunner, |
16 |
|
- |
UnexpectedEventPackageHandler pUnexpectedHandler ) |
17 |
|
- |
{ |
|
15 |
+ |
UnexpectedEventPackageHandler pUnexpectedHandler ) { |
18 |
16 |
|
super( pForm, pClientIdNumber, pTimedRunner, pUnexpectedHandler ); |
19 |
17 |
|
} |
20 |
18 |
|
|
21 |
|
- |
protected void LLdisposing( String pWhy ) |
22 |
|
- |
{ |
|
19 |
+ |
protected void LLdisposing( String pWhy ) { |
23 |
20 |
|
getStatePeerSupportingEventBus().disposing(); |
24 |
21 |
|
super.LLdisposing( pWhy ); |
25 |
22 |
|
} |
26 |
23 |
|
|
27 |
|
- |
protected void LLdispose( String pWhy ) |
28 |
|
- |
{ |
|
24 |
+ |
protected void LLdispose( String pWhy ) { |
29 |
25 |
|
IStatePeerSupportingEventBus peer = getStatePeerSupportingEventBus(); |
30 |
26 |
|
mStatePeerSupportingEventBus = NullStatePeerSupportingEventBus.INSTANCE; |
31 |
27 |
|
peer.dispose(); |
|
@@ -36,25 +32,20 @@ |
36 |
32 |
|
* @noinspection NonJREEmulationClassesInClientCode |
37 |
33 |
|
*/ |
38 |
34 |
|
protected synchronized void initialize( Logger pLogger, |
39 |
|
- |
IStatePeerSupportingEventBus pStatePeerSupportingEventBus ) |
40 |
|
- |
{ |
41 |
|
- |
if ( pLogger != null ) |
42 |
|
- |
{ |
|
35 |
+ |
IStatePeerSupportingEventBus pStatePeerSupportingEventBus ) { |
|
36 |
+ |
if ( pLogger != null ) { |
43 |
37 |
|
mLogger = pLogger; |
44 |
38 |
|
} |
45 |
39 |
|
mStatePeerSupportingEventBus = pStatePeerSupportingEventBus; |
46 |
40 |
|
} |
47 |
41 |
|
|
48 |
|
- |
protected synchronized IStatePeerSupportingEventBus getStatePeerSupportingEventBus() |
49 |
|
- |
{ |
|
42 |
+ |
protected synchronized IStatePeerSupportingEventBus getStatePeerSupportingEventBus() { |
50 |
43 |
|
return mStatePeerSupportingEventBus; |
51 |
44 |
|
} |
52 |
45 |
|
|
53 |
|
- |
protected IStatePeerSupportingEventBus switchFromSuspendedToRegular() |
54 |
|
- |
{ |
|
46 |
+ |
protected IStatePeerSupportingEventBus switchFromSuspendedToRegular() { |
55 |
47 |
|
IStatePeerSupportingEventBus suspended; |
56 |
|
- |
synchronized ( this ) |
57 |
|
- |
{ |
|
48 |
+ |
synchronized ( this ) { |
58 |
49 |
|
suspended = mStatePeerSupportingEventBus; |
59 |
50 |
|
mStatePeerSupportingEventBus = suspended.suspendedToRegular( this, this ); |
60 |
51 |
|
} |
|
@@ -65,56 +56,45 @@ |
65 |
56 |
|
/** |
66 |
57 |
|
* @noinspection NonJREEmulationClassesInClientCode |
67 |
58 |
|
*/ |
68 |
|
- |
protected Logger createLogger() |
69 |
|
- |
{ |
|
59 |
+ |
protected Logger createLogger() { |
70 |
60 |
|
Logger logger = LoggerFactory.getLogger( getForm() + "EB" ); |
71 |
61 |
|
return PrefixingLogger.decorate( "(" + getClientIdNumber() + ")", logger ); |
72 |
62 |
|
} |
73 |
63 |
|
|
74 |
|
- |
public String isLocalDistributionFromPeerOK( EventPackage pPackage ) |
75 |
|
- |
{ |
|
64 |
+ |
public String isLocalDistributionFromPeerOK( EventPackage pPackage ) { |
76 |
65 |
|
return null; |
77 |
66 |
|
} |
78 |
67 |
|
|
79 |
|
- |
protected void LLpublishNonNullNotDisposedExpectingResponse( EventPackage pPackage ) |
80 |
|
- |
{ |
|
68 |
+ |
protected void LLpublishNonNullNotDisposedExpectingResponse( EventPackage pPackage ) { |
81 |
69 |
|
getStatePeerSupportingEventBus().publishExpectingResponse( pPackage ); |
82 |
70 |
|
} |
83 |
71 |
|
|
84 |
72 |
|
protected void LLsubscribeAndPublish( EventSubscriptionStructure[] pSubscriptions, |
85 |
|
- |
EventPackage[] pPackages ) |
86 |
|
- |
{ |
87 |
|
- |
if ( (pSubscriptions.length != 0) || (pPackages.length != 0) ) |
88 |
|
- |
{ |
|
73 |
+ |
EventPackage[] pPackages ) { |
|
74 |
+ |
if ( (pSubscriptions.length != 0) || (pPackages.length != 0) ) { |
89 |
75 |
|
getStatePeerSupportingEventBus().subscribeAndPublish( pSubscriptions, pPackages ); |
90 |
76 |
|
} |
91 |
77 |
|
} |
92 |
78 |
|
|
93 |
|
- |
protected void LLunsubscribe( EventSubscriptionStructure[] pSubscriptions ) |
94 |
|
- |
{ |
95 |
|
- |
if ( pSubscriptions.length != 0 ) |
96 |
|
- |
{ |
|
79 |
+ |
protected void LLunsubscribe( EventSubscriptionStructure[] pSubscriptions ) { |
|
80 |
+ |
if ( pSubscriptions.length != 0 ) { |
97 |
81 |
|
getStatePeerSupportingEventBus().unsubscribe( pSubscriptions ); |
98 |
82 |
|
} |
99 |
83 |
|
} |
100 |
84 |
|
|
101 |
|
- |
public void problemFromRemotePeerService( EventPackage pProblem ) |
102 |
|
- |
{ |
|
85 |
+ |
public void problemFromRemotePeerService( EventPackage pProblem ) { |
103 |
86 |
|
getStatePeerSupportingEventBus().problemFromRemotePeerService( pProblem ); |
104 |
87 |
|
} |
105 |
88 |
|
|
106 |
|
- |
public boolean propagateFromRemotePeerService( ChannelServicePackage pFromPeer ) |
107 |
|
- |
{ |
|
89 |
+ |
public boolean propagateFromRemotePeerService( ChannelServicePackage pFromPeer ) { |
108 |
90 |
|
return getStatePeerSupportingEventBus().propagateFromRemotePeerService( pFromPeer ); |
109 |
91 |
|
} |
110 |
92 |
|
|
111 |
|
- |
public boolean ping() |
112 |
|
- |
{ |
|
93 |
+ |
public boolean ping() { |
113 |
94 |
|
return getStatePeerSupportingEventBus().ping(); |
114 |
95 |
|
} |
115 |
96 |
|
|
116 |
|
- |
public String toString() |
117 |
|
- |
{ |
|
97 |
+ |
public String toString() { |
118 |
98 |
|
return getForm() + "EventBus(" + getClientIdNumber() + ")"; |
119 |
99 |
|
} |
120 |
100 |
|
} |