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

Overload collect() to take Supplier and SerializableSupplier

    Details

    • Type: Enhancement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 9.2.0.Alpha2, 9.2.0.Final
    • Component/s: None
    • Labels:
      None

      Description

      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.

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

      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: