Skip to content

Instantly share code, notes, and snippets.

@chkal
Created September 28, 2012 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chkal/3800400 to your computer and use it in GitHub Desktop.
Save chkal/3800400 to your computer and use it in GitHub Desktop.
Bootstrapping Togglz in client applications
/**
* Register the provider by creating a file 'META-INF/services/org.togglz.core.spi.FeatureManagerProvider'.
* The file must contains the fully-qualified name of the provider class.
*/
public class SingletonFeatureManagerProvider implements FeatureManagerProvider {
private static FeatureManager featureManager;
@Override
public int priority() {
return 10;
}
@Override
public synchronized FeatureManager getFeatureManager() {
// lazy initialization
if (featureManager == null) {
// custom configuration class
TogglzConfig config = new MyCustomConfiguration();
// build FeatureManager
featureManager = new FeatureManagerBuilder().togglzConfig(config).build();
}
return featureManager;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment