Skip to content

Commit

Permalink
Remove the synchronized block
Browse files Browse the repository at this point in the history
As the new start() method is only called once during wiremock
initialisation we no longer need the initialised flag or the
synchronised block.
  • Loading branch information
leeturner committed May 27, 2024
1 parent 8882276 commit bac2d8a
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
public class JwtHelpersExtension implements TemplateHelperProviderExtension {

private final JwtSigningKeySettings jwtSigningKeySettings;
private boolean initialised = false;

public JwtHelpersExtension(JwtSigningKeySettings jwtSigningKeySettings) {
this.jwtSigningKeySettings = jwtSigningKeySettings;
Expand All @@ -26,20 +25,9 @@ public Map<String, Helper<?>> provideTemplateHelpers() {

@Override
public void start() {
initialise();
jwtSigningKeySettings.initialise();
}

private void initialise() {
if (!initialised) {
synchronized (this) {
if (!initialised) {
jwtSigningKeySettings.initialise();
initialised = true;
}
}
}
}

@Override
public String getName() {
return "jwt-template-helpers";
Expand Down

0 comments on commit bac2d8a

Please sign in to comment.