Details

    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      If value information is needed, an existing converter can be used whereby the value created gets shipped back as part of the listener callback, e.g.

      public class RemoteCacheGetFromListenerTest extends SingleHotRodServerTest {
      
         public void test000() throws InterruptedException {
            final RemoteCache<String, Object> remoteCache = remoteCacheManager.getCache();
            remoteCache.addClientListener(new RemoteListener2(remoteCache));
      
            final String key = UUID.randomUUID().toString();
            remoteCache.put(key, 12345);
            Thread.sleep(1000);
      
            remoteCache.put(key, 23456);
         }
      
         @ClientListener(converterFactoryName = "key-value-with-previous-converter-factory")
         private static class RemoteListener2 {
      
            private final RemoteCache<String, Object> remoteCache;
      
            public RemoteListener2(RemoteCache<String, Object> remoteCache) {
               this.remoteCache = remoteCache;
            }
      
            @ClientCacheEntryCreated
            public void handleCreatedEvent(ClientCacheEntryCustomEvent<KeyValueWithPrevious<String, Object>> event) {
               System.out.println("RemoteListener.handleCreatedEvent: " + event);
               System.out.println(event.getEventData().getValue());
            }
      
         }
      
      }
      
      Show
      If value information is needed, an existing converter can be used whereby the value created gets shipped back as part of the listener callback, e.g. public class RemoteCacheGetFromListenerTest extends SingleHotRodServerTest { public void test000() throws InterruptedException { final RemoteCache< String , Object > remoteCache = remoteCacheManager.getCache(); remoteCache.addClientListener( new RemoteListener2(remoteCache)); final String key = UUID.randomUUID().toString(); remoteCache.put(key, 12345); Thread .sleep(1000); remoteCache.put(key, 23456); } @ClientListener(converterFactoryName = "key-value-with-previous-converter-factory" ) private static class RemoteListener2 { private final RemoteCache< String , Object > remoteCache; public RemoteListener2(RemoteCache< String , Object > remoteCache) { this .remoteCache = remoteCache; } @ClientCacheEntryCreated public void handleCreatedEvent(ClientCacheEntryCustomEvent<KeyValueWithPrevious< String , Object >> event) { System .out.println( "RemoteListener.handleCreatedEvent: " + event); System .out.println(event.getEventData().getValue()); } } }

      Description

      Remote cache get() call from within a ClientListener callback gets stuck, e.g.

      @Test(testName = "client.hotrod.MusaTest")
      public class RemoteCacheGetFromListenerTest extends SingleHotRodServerTest {
      
         public void test000() throws InterruptedException {
            final RemoteCache<String, Object> remoteCache = remoteCacheManager.getCache();
            remoteCache.addClientListener(new RemoteListener2(remoteCache));
      
            remoteCache.put(UUID.randomUUID().toString(), 12345);
            Thread.sleep(1000);
         }
      
         @ClientListener()
         private static class RemoteListener2 {
      
            private final RemoteCache<String, Object> remoteCache;
      
            public RemoteListener2(RemoteCache<String, Object> remoteCache) {
               this.remoteCache = remoteCache;
            }
      
            @ClientCacheEntryCreated
            public void handleCreatedEvent(ClientCacheEntryCreatedEvent<String> event) {
               System.out.println("RemoteListener.handleCreatedEvent: " + event);
               System.out.println(remoteCache.get(event.getKey()));
            }
      
         }
      
      }
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  galder.zamarreno Galder ZamarreƱo
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated: