Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-16810

lifespan does not work for remote counters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 15.0.7.Final
    • Clustered Counter
    • None

      The counter’s lifespan value is neither encoded nor decoded by the methods encodeConfiguration and decodeConfiguration in org.infinispan.counter.util.EncodeUtil. As a result, the created counter has a lifespan of 0 even though the CounterConfiguration is set to a non-zero value.
      I used an existing StrongCounterHitsAwareTest test to demonstrate this behavior.

      private void defineCounter(String counterName) {
            CounterManager counterManager = RemoteCounterManagerFactory.asCounterManager(client(0));
            counterManager.defineCounter(counterName, CounterConfiguration.builder(CounterType.UNBOUNDED_STRONG).lifespan(100).build());
            //the counter is lazily created and stored in the cache. The increment will make sure it is there!
            for (CounterManager cm : clientCounterManagers()) {
               final StrongCounter strongCounter = cm.getStrongCounter(counterName);
               assertEquals(100, strongCounter.getConfiguration().lifespan());
               strongCounter.sync().incrementAndGet();
            }
         }
      

      The output is
      java.lang.AssertionError: expected:<100> but was:<0>
      Expected :100
      Actual :0

              pruivo@redhat.com Pedro Ruivo
              danfaer@gmail.com Dan Faershtein
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: