Vladislav,

Are you suggesting to stream directly from cache. or from a binary object
that is already copied from cache?

-Val

On Wed, Jun 28, 2017 at 2:52 AM, Vladislav Pyatkov <vpyat...@gridgain.com>
wrote:

> Hi,
>
> Recently, from one of Ignite user, I listened interest idea.
> What if I want to pass some date to java stream from cache.
>
> With binary I do it like this:
>
> BinaryObject get = (BinaryObject) cache.get(key);
> byte[] dataFromCache = get.<byte[]>field("data");
> System.out.write(dataFromCache, 0, dataFromCache.length);
>
> But in this case we got garbage a lot, due to each time new bytes array is
> creating.
>
> This will lead to many GC events in case we load a some of million entries.
> Could we offer additional API for working with java stream:
>
> BinaryObject.writeBytesToBuf("data", ByteBuffer.allocate(1024));
>
> or with buffer
>
> BinaryObject.writeBytesToBuf("data", new byte[1000], 100);
>
> I already created a Jira ticket.
> https://issues.apache.org/jira/browse/IGNITE-5602
>
> --
> Vladislav Pyatkov
> Architect-Consultant "GridGain Rus" Llc.
> +7 963 716 68 99
>

Reply via email to