ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Николай Ижиков <nizhikov....@gmail.com>
Subject Default CacheConfiguration instance can't be serialized
Date Tue, 26 Sep 2017 16:01:55 GMT
Hello, Guys.

I found that CacheConfiguration which implements Serializable contains not
serializable fields by default.

CacheConfiguration -> affMapper -> CacheDefaultBinaryAffinityKeyMapper ->
proc -> CacheObjectBinaryProcessorImpl.

Is this a bug or I miss something?

Simple reproducer:

```
public class SimpleSerializableTet extends GridCommonAbstractTest {
    public void testRemoteFilterFactoryClient() throws Exception {
        Ignite g = startGrid(0);

        IgniteCache<Object, Object> cache =
g.getOrCreateCache("TEST_CACHE");
        CacheConfiguration ccfg =
cache.getConfiguration(CacheConfiguration.class);

        assertTrue(ccfg instanceof Serializable);
        assertTrue(ccfg.getAffinityMapper() instanceof Serializable);

        try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
            ObjectOutput out = new ObjectOutputStream(bos);
            out.writeObject(ccfg);
            out.flush();
        }
    }
}

```
Exception is:

```
java.io.NotSerializableException:
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
```



-- 
Nikolay Izhikov
NIzhikov.dev@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message