Skip to content

Commit

Permalink
[Java]: use a default instance for semantic versioning default valida…
Browse files Browse the repository at this point in the history
…tor.
  • Loading branch information
tmontgomery committed Jul 18, 2022
1 parent 299a300 commit d1e7243
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
*/
public class AppVersionValidator
{
/**
* Singleton instance of {@link org.agrona.SemanticVersion} version which can be used to avoid allocation.
*/
public static final AppVersionValidator SEMANTIC_VERSIONING_VALIDATOR = new AppVersionValidator();

/**
* Check version compatibility between configured context appVersion and appVersion in
* new leadership term or snapshot.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ public void conclude()

if (null == appVersionValidator)
{
appVersionValidator = new AppVersionValidator();
appVersionValidator = AppVersionValidator.SEMANTIC_VERSIONING_VALIDATOR;
}

if (null == clusterTimeConsumerSupplier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ public void conclude()

if (null == appVersionValidator)
{
appVersionValidator = new AppVersionValidator();
appVersionValidator = AppVersionValidator.SEMANTIC_VERSIONING_VALIDATOR;
}

if (null == epochClock)
Expand Down

0 comments on commit d1e7243

Please sign in to comment.