Skip to content

Commit

Permalink
[Java] Hide Image.reject.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyazelenko committed Dec 18, 2024
1 parent b066904 commit 69ae944
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1061,22 +1061,8 @@ void abortControlSessionByImage(final Image image)

void removeControlSession(final long controlSessionId)
{
final SessionInfo info = controlSessionByIdMap.remove(controlSessionId);
controlSessionByIdMap.remove(controlSessionId);
conductor.removeReplayTokensForSession(controlSessionId);
if (null != info)
{
if (info.controlSession.isInactive() && info.image.activeTransportCount() > 0)
{
final ExclusivePublication controlPublication = info.controlSession.controlPublication();
final int publicationSessionId = controlPublication.sessionId();
if (info.image.sessionId() == publicationSessionId ||
info.image.correlationId() == Long.parseLong(
ChannelUri.parse(controlPublication.channel()).get(RESPONSE_CORRELATION_ID_PARAM_NAME, "-1")))
{
info.image.reject("stale ControlSession: sessionId=" + info.controlSession.sessionId());
}
}
}
}

private ControlSession setupSessionAndChannelForReplay(
Expand Down
8 changes: 3 additions & 5 deletions aeron-archive/src/test/java/io/aeron/archive/ArchiveTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ void shouldTimeoutInactiveArchiveClients(final String controlRequestChannel, fin
try (MediaDriver driver = MediaDriver.launch(new MediaDriver.Context()
.aeronDirectoryName(CommonContext.generateRandomDirName())
.statusMessageTimeoutNs(TimeUnit.MILLISECONDS.toNanos(80))
.imageLivenessTimeoutNs(TimeUnit.MILLISECONDS.toNanos(2000))
.imageLivenessTimeoutNs(TimeUnit.MILLISECONDS.toNanos(1000))
.timerIntervalNs(TimeUnit.MILLISECONDS.toNanos(100))
.enableExperimentalFeatures(true));
Archive archive = Archive.launch(TestContexts.localhostArchive()
Expand All @@ -881,7 +881,7 @@ void shouldTimeoutInactiveArchiveClients(final String controlRequestChannel, fin
.archiveId(archiveId)
.archiveDir(tmpDir.resolve("archive").toFile())
.aeronDirectoryName(driver.context().aeronDirectoryName())
.connectTimeoutNs(TimeUnit.MILLISECONDS.toNanos(1000))
.connectTimeoutNs(TimeUnit.MILLISECONDS.toNanos(500))
.sessionLivenessCheckIntervalNs(TimeUnit.MILLISECONDS.toNanos(1))))
{
final AeronArchive.Context ctx = new AeronArchive.Context()
Expand Down Expand Up @@ -927,9 +927,7 @@ void shouldTimeoutInactiveArchiveClients(final String controlRequestChannel, fin

assertTrue(client1.archiveProxy().publication().isConnected());
assertTrue(client1.controlResponsePoller().subscription().isConnected());
assertEquals(
controlRequestChannel.startsWith(CommonContext.IPC_CHANNEL),
client2.archiveProxy().publication().isConnected());
assertTrue(client2.archiveProxy().publication().isConnected());
assertFalse(client2.controlResponsePoller().subscription().isConnected());
}
}
Expand Down
8 changes: 1 addition & 7 deletions aeron-client/src/main/java/io/aeron/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -830,13 +830,7 @@ public int rawPoll(final RawBlockHandler handler, final int blockLengthLimit)
return length;
}

/**
* Force the driver to disconnect this image from the remote publication.
*
* @param reason an error message to be forwarded back to the publication.
* @since 1.47.0
*/
public void reject(final String reason)
void reject(final String reason)
{
subscription.rejectImage(correlationId, position(), reason);
}
Expand Down

0 comments on commit 69ae944

Please sign in to comment.