1

I'm using Chronicle V4 proxy API to convert a message into a function call.

When myMethod(Thing a) is invoked after a readOne() call, the 'a' object instance ID is the same each time but the content has the latest state.

Imagine:

readOne();
readOne();

Methods fired:

myMethod(Thing a)
myMethod(Thing a)

The second call with param 'a' now with different state overrides any previous caches version of 'a' in say a hashmap in memory, because the java object instance ID is the same one when myMethod was invoked initially.

I'm hoping this is some odd in my setup - be good to know if this is by design or just an issue my end.

4

1 回答 1

1

This is by design to provide implicit recycling of the object.

If you want a new object you can use Marshallable.deepCopy() or use Marshallable.copyTo() an existing one. Unless you retain the object, there shouldn't be an issue. If you write it out to another queue, for example, it is written immediately rather than in the background.

It is implemented this way so you can process millions of events and create very few objects. i.e. less than 1 byte of garbage per message.

I highly recommend using the latest version of Queue https://search.maven.org/search?q=g:net.openhft%20AND%20a:chronicle-queue currently v5.17.4

于 2019-01-24T22:56:39.093 回答