Skip to content

Commit

Permalink
GEODE-1828 Added some more logging to debug further
Browse files Browse the repository at this point in the history
  • Loading branch information
hiteshk25 committed Sep 2, 2016
1 parent d2d62d6 commit fac42cb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ public boolean cancel() {
boolean superCancel = super.cancel();
if (superCancel) {
this.re = null;
if (expiryTaskListener != null) {
expiryTaskListener.afterCancel(this);
}
}
return superCancel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,5 +535,10 @@ public interface ExpiryTaskListener {
*/
public void afterExpire(ExpiryTask et);

/**
* Called when task has been canceled
*/
public void afterCancel(ExpiryTask et);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ public ExpirationDetector(ExpiryTask et) {
this.et = et;
}
@Override
public void afterCancel(ExpiryTask et) {
}
@Override
public void afterSchedule(ExpiryTask et) {
}
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3544,7 +3544,10 @@ public void afterInvalidate2(EntryEvent e) { }
}

class ExpiryCallbacks implements ExpiryTaskListener {

@Override
public void afterCancel(ExpiryTask et) {
getCache().getLogger().info("ExpiryCallbacks.afterCancel", new RuntimeException("TaskCanceled"));
}
@Override
public void afterSchedule(ExpiryTask et) {
printState(et, "ExpiryCallbacks.afterSchedule " );
Expand All @@ -3571,7 +3574,6 @@ void printState(ExpiryTask et, String callback) {
Date ttlTime = new Date(et.getTTLExpirationTime());
Date getNow = new Date(et.getNow());
Date scheduleETime = new Date(et.scheduledExecutionTime());
//et.getKey();
getCache().getLogger().info(callback + " now: " + getCurrentTimeStamp(now) + " ttl:" + getCurrentTimeStamp(ttl) + " idleExpTime:" + getCurrentTimeStamp(idleExpTime) +
" ttlTime:" + getCurrentTimeStamp(ttlTime) + " getNow:" + getCurrentTimeStamp(getNow) + " scheduleETime:" + getCurrentTimeStamp(scheduleETime) +
" getKey:" + et.getKey() + " isPending:" + et.isPending() +
Expand Down Expand Up @@ -3602,11 +3604,12 @@ public void afterExpire(ExpiryTask et) {
@Test
public void testEntryIdleDestroy() throws Exception {

EntryExpiryTask.expiryTaskListener = new ExpiryCallbacks();
final String name = this.getUniqueName();
final int timeout = 20; // ms
final String key = "KEY";
final String value = "VALUE";
EntryExpiryTask.expiryTaskListener = new ExpiryCallbacks();

AttributesFactory factory = new AttributesFactory(getRegionAttributes());
ExpirationAttributes expire =
new ExpirationAttributes(timeout, ExpirationAction.DESTROY);
Expand Down

0 comments on commit fac42cb

Please sign in to comment.