DelayQueue is not Serializable?
aleksey.shipilev at gmail.com
Wed Sep 21 09:12:44 UTC 2011
On Tue, Sep 20, 2011 at 10:34 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> On 09/20/11 12:29, Aleksey Shipilev wrote:
>> I've been stumbled upon this for a bit.
>> Is there any specific reason DelayQueue is not serializable? Or is it
>> an API bug? The backing PriorityQueue *is* serializable.
> It was a deliberate decision.
> DelayQueues use relative times, so the delays don't make sense
> when deserialized at an arbitrary time. And there's no way to
> guarantee a correct clock resync to re-normalize.
Yes, I understand the concern. However, I don't think it should be
enforced by contract. I would argue that is a developer job to
tolerate these scenarios. I had met the example when you store Delayed
elements with delays in hours, but really try to serialize-deserialize
DelayQueue to migrate the data from one server instance to the other,
which takes seconds to do. In this scenario, non-serializable
DelayQueue is more of hassle.
> Plus, no one has ever complained about this, so we
> haven't ever revisited it.
Can we revisit it some day in the future? From the code perspective,
it appears to be point change. Is it the scope for JEP?
More information about the core-libs-dev