Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISPN-5797 NullPointerException in ClientListenerRegistry under load #3743

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.infinispan.client.hotrod.event;

import org.infinispan.Cache;
import org.infinispan.client.hotrod.RemoteCache;
import org.infinispan.client.hotrod.event.CustomEventLogListener.CustomEvent;
import org.infinispan.client.hotrod.event.CustomEventLogListener.FilterConverterFactory;
Expand All @@ -14,6 +15,7 @@
import org.infinispan.configuration.cache.CacheMode;
import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.notifications.cachelistener.CacheNotifier;
import org.infinispan.server.hotrod.HotRodServer;
import org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder;
import org.infinispan.test.TestingUtil;
Expand Down Expand Up @@ -161,4 +163,20 @@ public void call() {
}
});
}

public void testNullValueMetadataExpiration() {
final Integer key = HotRodClientTestingUtil.getIntKeyForServer(server(0));
final EventLogListener<Integer> eventListener = new EventLogListener<>();
withClientListener(eventListener, new RemoteCacheManagerCallable(client(0)) {
@Override
public void call() {
Cache<Integer, String> cache0 = cache(0);
CacheNotifier notifier = cache0.getAdvancedCache().getComponentRegistry().getComponent(CacheNotifier.class);
byte[] keyBytes = HotRodClientTestingUtil.toBytes(key);
// Note we are manually forcing an expiration event with a null value and metadata
notifier.notifyCacheEntryExpired(keyBytes, null, null, null);
eventListener.expectOnlyExpiredEvent(key, cache(0));
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ class ClientListenerRegistry(configuration: HotRodServerConfiguration) extends L
@CacheEntryExpired
def onCacheEvent(event: CacheEntryEvent[Bytes, Bytes]) {
if (isSendEvent(event)) {
val dataVersion = event.getMetadata.version().asInstanceOf[NumericVersion].getVersion
sendEvent(event.getKey, event.getValue, dataVersion, event)
sendEvent(event.getKey, event.getValue, Option(event.getMetadata)
.map(_.version().asInstanceOf[NumericVersion].getVersion)
.getOrElse(null.asInstanceOf[Long]), event)

}
}

Expand Down