static class CustomRemovalListener implements RemovalListener<String, String> {
@Override
public void onRemoval(RemovalNotification<String, String> notification) {
String removedSessionId = notification.getKey();
String removedUserName = notification.getValue();
// Perform logging or any other action
System.out.println("Expired session: " + removedSessionId + " - " + removedUserName);
}
} But still when the entry expires , the values are not printing. I have few doubts. 1) will the removelistener will be called automatically whenever an entry expires in the map? 2) If not what are the ways to get the removelistener to be triggered automatically when an entry gets expired from the map. Thanks !
--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/9be81402-7430-48d7-abc7-68dcdddc951cn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/c224196b-8ad3-4bc4-ad86-c116bbe87ec2n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/66673221-41d1-40d4-9ce3-0a2e9dba1a0en%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/b998bdf1-ac12-49d7-8686-337b14188159n%40googlegroups.com.