[infinispan-issues] [JBoss JIRA] (ISPN-8281) Overload collect() to take Supplier and SerializableSupplier

Galder Zamarreño (JIRA) issues at jboss.org
Tue Sep 12 05:12:00 EDT 2017


Galder Zamarreño created ISPN-8281:
--------------------------------------

             Summary: Overload collect() to take Supplier and SerializableSupplier
                 Key: ISPN-8281
                 URL: https://issues.jboss.org/browse/ISPN-8281
             Project: Infinispan
          Issue Type: Enhancement
            Reporter: Galder Zamarreño
            Assignee: Galder Zamarreño


Whenever a collect() is called in a distributed environment, you have to wrap up in a serializable supplier method call to make it serializable, e.g.

{code}
Map<Integer, Long> totalPerHour = cache.values().stream()
   .collect(
       CacheCollectors.serializableCollector(() -> Collectors.groupingBy(
           e -> getHourOfDay(e.departureTs),
           Collectors.counting()
       )));
{code}

This is a bit clunky. We should overload collect to take a SerializableSupplier in CacheStream.

It would also be nice to have an overloaded version that takes Supplier in case you want to provide your own serialization for it.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)



More information about the infinispan-issues mailing list