@@ -78,19 +78,19 @@ private void start() {
78
78
@ Override
79
79
public Object visitPutKeyValueCommand (InvocationContext ctx , PutKeyValueCommand command ) throws Throwable {
80
80
if (!isPutForExternalRead (command )) {
81
- return handleInvalidate (ctx , command , command .getKey ());
81
+ return handleInvalidate (ctx , command , new Object [] { command .getKey () } );
82
82
}
83
83
return invokeNextInterceptor (ctx , command );
84
84
}
85
85
86
86
@ Override
87
87
public Object visitReplaceCommand (InvocationContext ctx , ReplaceCommand command ) throws Throwable {
88
- return handleInvalidate (ctx , command , command .getKey ());
88
+ return handleInvalidate (ctx , command , new Object [] { command .getKey () } );
89
89
}
90
90
91
91
@ Override
92
92
public Object visitRemoveCommand (InvocationContext ctx , RemoveCommand command ) throws Throwable {
93
- return handleInvalidate (ctx , command , command .getKey ());
93
+ return handleInvalidate (ctx , command , new Object [] { command .getKey () } );
94
94
}
95
95
96
96
@ Override
@@ -107,39 +107,39 @@ public Object visitClearCommand(InvocationContext ctx, ClearCommand command) thr
107
107
108
108
@ Override
109
109
public Object visitPutMapCommand (InvocationContext ctx , PutMapCommand command ) throws Throwable {
110
- Object [] keys = command .getMap () == null ? null : command .getMap ().keySet ().toArray ();
111
- return handleInvalidate (ctx , command , keys );
110
+ if (!isPutForExternalRead (command )) {
111
+ return handleInvalidate (ctx , command , command .getMap ().keySet ().toArray ());
112
+ }
113
+ return invokeNextInterceptor (ctx , command );
112
114
}
113
115
114
- private Object handleInvalidate (InvocationContext ctx , WriteCommand command , Object ... keys ) throws Throwable {
116
+ private Object handleInvalidate (InvocationContext ctx , WriteCommand command , Object [] keys ) throws Throwable {
115
117
Object retval = invokeNextInterceptor (ctx , command );
116
- if (command .isSuccessful () && !ctx .isInTxScope ()) {
117
- if (keys != null && keys .length != 0 ) {
118
- if (!isLocalModeForced (command )) {
119
- invalidateAcrossCluster (isSynchronous (command ), keys , ctx );
120
- }
121
- }
118
+ if (command .isSuccessful () && keys != null && keys .length != 0 ) {
119
+ invalidateAcrossCluster (command , keys );
122
120
}
123
121
return retval ;
124
122
}
125
123
126
- private void invalidateAcrossCluster (boolean synchronous , Object [] keys , InvocationContext ctx ) throws Throwable {
124
+ private void invalidateAcrossCluster (FlagAffectedCommand command , Object [] keys ) throws Throwable {
127
125
// increment invalidations counter if statistics maintained
128
126
incrementInvalidations ();
129
127
InvalidateCommand invalidateCommand ;
130
128
Object lockOwner = putFromLoadValidator .registerRemoteInvalidations (keys );
131
- if (lockOwner == null ) {
132
- invalidateCommand = commandsFactory .buildInvalidateCommand (InfinispanCollections .<Flag >emptySet (), keys );
133
- }
134
- else {
135
- invalidateCommand = commandInitializer .buildBeginInvalidationCommand (
136
- InfinispanCollections .<Flag >emptySet (), keys , lockOwner );
137
- }
138
- if (log .isDebugEnabled ()) {
139
- log .debug ("Cache [" + rpcManager .getAddress () + "] replicating " + invalidateCommand );
140
- }
129
+ if (!isLocalModeForced (command )) {
130
+ if (lockOwner == null ) {
131
+ invalidateCommand = commandsFactory .buildInvalidateCommand (InfinispanCollections .<Flag >emptySet (), keys );
132
+ }
133
+ else {
134
+ invalidateCommand = commandInitializer .buildBeginInvalidationCommand (
135
+ InfinispanCollections .<Flag >emptySet (), keys , lockOwner );
136
+ }
137
+ if (log .isDebugEnabled ()) {
138
+ log .debug ("Cache [" + rpcManager .getAddress () + "] replicating " + invalidateCommand );
139
+ }
141
140
142
- rpcManager .invokeRemotely (null , invalidateCommand , rpcManager .getDefaultRpcOptions (synchronous ));
141
+ rpcManager .invokeRemotely (null , invalidateCommand , rpcManager .getDefaultRpcOptions (isSynchronous (command )));
142
+ }
143
143
}
144
144
145
145
private void incrementInvalidations () {
0 commit comments