Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] Use archiveId for looking up the RecordingPos counters. #1571

Merged
merged 4 commits into from
Mar 4, 2024

Conversation

vyazelenko
Copy link
Contributor

@vyazelenko vyazelenko commented Mar 1, 2024

  • Add a command to expose archiveId to the Archive control protocol.
  • Add AeronArchive.archiveId().
  • Use archiveId when searching for RecordingPos by recordingId and sessionId.

*
* @return the id of the Archive.
*/
public long archiveId()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be cached in AeronArchive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is cached. See below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Missed that. A style note, I personally like the early return approach for this sort of thing, e.g:

    if (Aeron.NULL_VALUE != archiveId)
    {
        return achiveId;
    }
        
    ensureOpen();
    ensureNotReentrant();

    lastCorrelationId = aeron.nextCorrelationId();

    if (!archiveProxy.archiveId(lastCorrelationId, controlSessionId))
    {
        throw new ArchiveException("failed to send get recorded length request");
    }

    archiveId = pollForResponse(lastCorrelationId);
    return archiveId;

Not required change for merging though.

@mikeb01
Copy link
Contributor

mikeb01 commented Mar 4, 2024

Looks good to me.

@vyazelenko vyazelenko merged commit 298e15f into aeron-io:master Mar 4, 2024
32 checks passed
@vyazelenko vyazelenko deleted the expose-archive-id branch March 4, 2024 19:52
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