Avoid logged warning about objects not present in the cache for tasks (#25324)
Closes #25322 Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
parent
14cb025cf0
commit
a8cff72ed0
2 changed files with 6 additions and 2 deletions
|
@ -39,7 +39,7 @@ public class InfinispanClusterProvider implements ClusterProvider {
|
||||||
protected static final Logger logger = Logger.getLogger(InfinispanClusterProvider.class);
|
protected static final Logger logger = Logger.getLogger(InfinispanClusterProvider.class);
|
||||||
|
|
||||||
public static final String CLUSTER_STARTUP_TIME_KEY = "cluster-start-time";
|
public static final String CLUSTER_STARTUP_TIME_KEY = "cluster-start-time";
|
||||||
private static final String TASK_KEY_PREFIX = "task::";
|
public static final String TASK_KEY_PREFIX = "task::";
|
||||||
|
|
||||||
private final int clusterStartupTime;
|
private final int clusterStartupTime;
|
||||||
private final String myAddress;
|
private final String myAddress;
|
||||||
|
|
|
@ -56,6 +56,8 @@ import org.keycloak.executors.ExecutorsProvider;
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.infinispan.client.hotrod.exceptions.HotRodClientException;
|
import org.infinispan.client.hotrod.exceptions.HotRodClientException;
|
||||||
|
|
||||||
|
import static org.keycloak.cluster.infinispan.InfinispanClusterProvider.TASK_KEY_PREFIX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Impl for sending infinispan messages across cluster and listening to them
|
* Impl for sending infinispan messages across cluster and listening to them
|
||||||
*
|
*
|
||||||
|
@ -265,7 +267,9 @@ public class InfinispanNotificationsManager {
|
||||||
|
|
||||||
private void eventReceived(String key, Serializable obj) {
|
private void eventReceived(String key, Serializable obj) {
|
||||||
if (!(obj instanceof WrapperClusterEvent)) {
|
if (!(obj instanceof WrapperClusterEvent)) {
|
||||||
if (obj == null) {
|
// Items with the TASK_KEY_PREFIX might be gone fast once the locking is complete, therefore, don't log them.
|
||||||
|
// It is still good to have the warning in case of real events return null because they have been, for example, expired
|
||||||
|
if (obj == null && !key.startsWith(TASK_KEY_PREFIX)) {
|
||||||
logger.warnf("Event object wasn't available in remote cache after event was received. Event key: %s", key);
|
logger.warnf("Event object wasn't available in remote cache after event was received. Event key: %s", key);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue