Skip to content

Commit

Permalink
[Java] LogPublisher should clean up existing publication when a new o…
Browse files Browse the repository at this point in the history
…ne is added if it has not been done when the election initialises.
  • Loading branch information
mjpt777 committed Nov 28, 2020
1 parent d237a94 commit 512cf8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -1253,7 +1253,6 @@ void onLoadClusterMembers(final int memberId, final int highMemberId, final Stri

int addNewLogPublication()
{
logPublisher.disconnect(ctx.countedErrorHandler());
logAdapter.disconnect(ctx.countedErrorHandler());

final ExclusivePublication publication = createLogPublication(recoveryPlan);
Expand Down Expand Up @@ -1330,7 +1329,6 @@ boolean hasReplayDestination()

Subscription createAndRecordLogSubscriptionAsFollower(final String logChannel)
{
logPublisher.disconnect(ctx.countedErrorHandler());
logAdapter.disconnect(ctx.countedErrorHandler());

final Subscription subscription = aeron.addSubscription(logChannel, ctx.logStreamId());
Expand Down
Expand Up @@ -56,6 +56,10 @@ class LogPublisher

void publication(final ExclusivePublication publication)
{
if (null != this.publication)
{
this.publication.close();
}
this.publication = publication;
}

Expand Down

0 comments on commit 512cf8d

Please sign in to comment.