Github user chandnisingh commented on a diff in the pull request:
https://github.com/apache/incubator-apex-malhar/pull/145#discussion_r56752821
--- Diff:
library/src/main/java/com/datatorrent/lib/state/BucketedState.java ---
@@ -29,11 +31,17 @@
public interface BucketedState
{
/**
+ * An expired value. In some implementations where bucketId is time
related then the event can be old and
+ * the get methods- getSync & getAsync return this special slice
instance.
+ */
+ Slice EXPIRED = new Slice(Ints.toByteArray(-1));
--- End diff --
I can use Slice(null, -1, -1). In the usages, comparisons should be made
using ```==``` and not ```equals```.
For every expired event I didn't want to instantiate a Slice object. So
even if I extend Slice, I will re-use a special instance of slice so thought
why not use just a special instance.
There is a problem with all the approaches I can think of which is that
Slice cannot have an immutable extension because all the members are publicly
exposed without getters and setters.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---