@@ -73,12 +73,20 @@ public EVCacheLatch add(EVCacheKey evcKey, final CachedData cd, Transcoder evcac
73
73
if (fixMissing ) {
74
74
boolean status = f .get ().booleanValue ();
75
75
if (!status ) { // most common case
76
- if (firstStatus == null && !bypassAddOpt ) {
77
- for (int i = 0 ; i < clients .length ; i ++) {
78
- latch .countDown ();
76
+ if (firstStatus == null ) {
77
+ if (log .isDebugEnabled ()) log .debug ("Add failed at first client. key: " + key + ", client : " + client );
78
+ if (!bypassAddOpt ) {
79
+ if (log .isDebugEnabled ()) log .debug ("Short circuiting due to optimization!!" );
80
+ for (int i = 0 ; i < clients .length ; i ++) {
81
+ latch .countDown ();
82
+ }
83
+ return latch ;
84
+ }
85
+ else {
86
+ return fixup (client , clients , evcKey , timeToLive , policy );
79
87
}
80
- return latch ;
81
88
} else {
89
+ if (log .isDebugEnabled ()) log .debug ("Add failed after first client. key: " + key + ", client : " + client );
82
90
return fixup (client , clients , evcKey , timeToLive , policy );
83
91
}
84
92
}
@@ -89,6 +97,7 @@ public EVCacheLatch add(EVCacheKey evcKey, final CachedData cd, Transcoder evcac
89
97
}
90
98
91
99
private EVCacheLatch fixup (EVCacheClient sourceClient , EVCacheClient [] destClients , EVCacheKey evcKey , int timeToLive , Policy policy ) {
100
+ if (log .isDebugEnabled ()) log .debug ("Trying to fix up!! destClient count = " + destClients .length );
92
101
final EVCacheLatchImpl latch = new EVCacheLatchImpl (policy , destClients .length , _appName );
93
102
try {
94
103
final CachedData readData = sourceClient .get (evcKey .getDerivedKey (sourceClient .isDuetClient (), sourceClient .getHashingAlgorithm (), sourceClient .shouldEncodeHashKey (), sourceClient .getMaxDigestBytes (), sourceClient .getMaxHashLength (), sourceClient .getBaseEncoder ()), ct , false , false );
0 commit comments