Skip to content

Conversation

fernomac
Copy link

@fernomac fernomac commented Nov 6, 2017

As discussed in #1; I finally had time to put together a pull request. Contributed under the terms of the Amazon Software License.

// If we're tracking sequence IDs, initialize or increment the current value.
Optional<Long> sequenceId = Optional.empty();
if (trackSequenceIds) {
sequenceId = existingLock.flatMap(value -> value.getSequenceId());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

sequenceId = Optional.of(existingLock.flatMap(value -> value.getSequenceId()).orElse(0L) + 1)

Motivation:

  1. make it clear that you fallback to 0L when there was no lock / seq. id
  2. the step (+1) is also clearly defined

final boolean deleteLockOnRelease = options.getDeleteLockOnRelease();
final boolean deleteLockOnRelease;
if (this.trackSequenceIds) {
if (options.getDeleteLockOnRelease().isPresent() && options.getDeleteLockOnRelease().get()) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functional police is here 👮 😄

if (options.getDeleteLockOnRelease().orElse(false)) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants