You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
as well as being generic, which makes it non-obvious how to solve this. A few options:
just make Attempt<> implement Serializable, ignoring potential problem with T not also being Serializable. Then it's up to users - if they're using Retryer with serializable return types, things will work; if not, no worse off than now.
make resulttransient. should work, with caveat that if the instance has undergone serialization and deserialization, result will be lost, so in some sense hasResult()/getResult() won't respect contracts, as will be false/throw IllegalStateException, even though original call did have a result. But again, this only happens after Attempt has undergone a serialization+deserialization cycle, which currently throws an error, so I would argue that everyone's still better off.
require T to implement Serializable. Probably not great solution, as would constrain users too much and breaks Retryer's interface.
I'd personally vote for (1) as the simplest, lowest impact change; but quick version of (2) might be just as good, if later followed by bigger change to make hasResult()/getResult() behave sensibly.
The text was updated successfully, but these errors were encountered:
@eschultink I am experiencing this serialization issue as well - Did you ever get resolution or a workaround? Or perhaps recommend a different retry library?
RetryException
implementsSerialzable
, but does not fulfill the contract, because it has a fieldAttempt<>
:re-retrying/src/main/java/com/github/rholder/retry/RetryException.java
Lines 32 to 34 in 5c75a68
which does not implement
Serializable
:re-retrying/src/main/java/com/github/rholder/retry/Attempt.java
Lines 30 to 38 in 5c75a68
as well as being generic, which makes it non-obvious how to solve this. A few options:
just make
Attempt<>
implementSerializable
, ignoring potential problem withT
not also beingSerializable
. Then it's up to users - if they're usingRetryer
with serializable return types, things will work; if not, no worse off than now.make
result
transient
. should work, with caveat that if the instance has undergone serialization and deserialization,result
will be lost, so in some sensehasResult()
/getResult()
won't respect contracts, as will befalse
/throw IllegalStateException
, even though original call did have a result. But again, this only happens afterAttempt
has undergone a serialization+deserialization cycle, which currently throws an error, so I would argue that everyone's still better off.require
T
to implementSerializable
. Probably not great solution, as would constrain users too much and breaks Retryer's interface.I'd personally vote for (1) as the simplest, lowest impact change; but quick version of (2) might be just as good, if later followed by bigger change to make
hasResult()
/getResult()
behave sensibly.The text was updated successfully, but these errors were encountered: