ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artem Shutak (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-2664) Cache.invokeAll() return a map with BinaryObjects instead of user objects.
Date Tue, 16 Feb 2016 15:16:18 GMT
Artem Shutak created IGNITE-2664:

             Summary: Cache.invokeAll() return a map with BinaryObjects instead of user objects.
                 Key: IGNITE-2664
                 URL: https://issues.apache.org/jira/browse/IGNITE-2664
             Project: Ignite
          Issue Type: Bug
    Affects Versions: 1.5.0.final
            Reporter: Artem Shutak
            Assignee: Artem Shutak
             Fix For: 1.6

{{Cache.invokeAll()}} return a map with {{BinaryObjectImpl}} instead of user objects.

Cache.invoke() works fine.

I see a different behavior for Transactional and Atomic caches. But both of them return {{BinaryObjectImpl}}
instead of user objects at keys/values of a result map.

It can be reproduced with CacheFullApiNewSelfTest.testInvokeAllOptimisticReadCommitted1()
(and others).

Or use the following code example
    public static void main(String[] args) throws Exception {
        CacheConfiguration cc = new CacheConfiguration()
            .setCacheStoreFactory(new CacheAbstractNewSelfTest.TestStoreFactory())


        try(Ignite ignite = Ignition.start(getConfiguration("1"));
            Ignite ignite2 = Ignition.start(getConfiguration("2"));
            Ignite ignite3 = Ignition.start(getConfiguration("3"));
            Ignite ignite4 = Ignition.start(getConfiguration("4"))) {


            IgniteCache cache = ignite.getOrCreateCache(cc);

            // Await partition map exchange.

            CacheFullApiNewSelfTest.DataMode mode = CacheFullApiNewSelfTest.DataMode.SERIALIZABLE;

            final TestObject key = key(1, mode);
            final TestObject val = value(1, mode);

            // InvokeAll
            cache.put(key, val);

            Map<TestObject, EntryProcessorResult<TestObject>> mapRes = cache.invokeAll(F.asSet(key),

            for (Map.Entry<TestObject, EntryProcessorResult<TestObject>> e : mapRes.entrySet())
                TestObject eKey = e.getKey();


                if (!(eKey instanceof TestObject))
                    throw new IllegalStateException("key=" + eKey + ", class=" + eKey.getClass());

                TestObject eVal = e.getValue().get();

                if (!(eVal instanceof TestObject))
                    throw new IllegalStateException("val=" + eVal + ", class=" + eVal.getClass());

    private static IgniteConfiguration getConfiguration(String s) {
        TcpDiscoverySpi spi = new TcpDiscoverySpi();

        TcpDiscoveryMulticastIpFinder finder = new TcpDiscoveryMulticastIpFinder();

        finder.setAddresses(Collections.singleton("" + TcpDiscoverySpi.DFLT_PORT));


        return new IgniteConfiguration()
            .setSwapSpaceSpi(new GridTestSwapSpaceSpi())

I've investigated the issue and found the root cause. Ignite does not unwrap BinaryObject
before get it to user. See {GridCacheReturn.finishUnmarshal()} and org/apache/ignite/internal/processors/cache/GridCacheReturn.java:332.
We need to pass {{keepBinary}} flag at this place according to used cache.

This message was sent by Atlassian JIRA

View raw message