Skip to content

Commit

Permalink
CUSTCOM-135 Code moved from constructor to postConstruct method
Browse files Browse the repository at this point in the history
- safer, all fields should be set here.
  • Loading branch information
David Matejcek authored and dmatej committed Feb 11, 2020
1 parent bc522f8 commit 7ecfc39
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import fish.payara.nucleus.microprofile.config.converters.CharacterConverter;
Expand Down Expand Up @@ -139,10 +140,17 @@ public class ConfigProviderResolverImpl extends ConfigProviderResolver {
private Config serverLevelConfig;

/**
* Sets the global {@link ConfigProviderResolver#instance()} to this instance.
* Logs constructor as finest - may be useful to watch sequence of operations.
*/
public ConfigProviderResolverImpl() {
LOG.finest("ConfigProviderResolverImpl()");
}

/**
* Sets the global {@link ConfigProviderResolver#instance()} to this instance.
*/
@PostConstruct
public void postConstruct() {
// the setInstance is not synchronized, but instance() method body is.
// this will block possible concurrent access.
synchronized (ConfigProviderResolver.class) {
Expand Down

0 comments on commit 7ecfc39

Please sign in to comment.