[infinispan-issues] [JBoss JIRA] (ISPN-7596) org.infinispan.commons.marshall.NotSerializableException: java.util.stream.Collectors$CollectorImpl

Gustavo Fernandes (JIRA) issues at jboss.org
Mon Jan 29 05:06:01 EST 2018


    [ https://issues.jboss.org/browse/ISPN-7596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13525084#comment-13525084 ] 

Gustavo Fernandes commented on ISPN-7596:
-----------------------------------------

Hi, this is because the collector needs to be serializable, so to fix (in Infinispan 9.1) you should wrap the collector:
{code:java}
Set<byte[]> allKeys = cache.keySet();
Set<byte[]> copy = allKeys.stream().collect(CacheCollectors.serializableCollector(() -> Collectors.toSet()));
{code}

In Infinispan 9.2 this will improved, more details on http://blog.infinispan.org/2018/01/improving-collect-for-distributed-java.html

> org.infinispan.commons.marshall.NotSerializableException: java.util.stream.Collectors$CollectorImpl
> ---------------------------------------------------------------------------------------------------
>
>                 Key: ISPN-7596
>                 URL: https://issues.jboss.org/browse/ISPN-7596
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Core
>            Reporter: Gustavo Fernandes
>
> Triggered by this snipped present in {{HotRodSourceMigrator}}:
> {code:java}
> Set<byte[]> allKeys = cache.keySet();
> Set<byte[]> copy = allKeys.stream().collect(Collectors.toSet());
> {code}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the infinispan-issues mailing list