Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MapStateMachine extends StateMachine {
- private Map<Object, Object> map = new HashMap<>();
- public Object putWithTtl(Commit<PutWithTtl> commit) {
- map.put(commit.operation().key, commit);
- executor.schedule(Duration.ofMillis(commit.operation().ttl, () -> {
- map.remove(commit.operation().key);
- commit.release();
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement