+1 for moving DistributionConfig to the public package. I prefer referring to GemFire (System) properties using the DistributionConfig constants rather than the actual String literal in my configuration, especially in code.
On Wed, Jul 1, 2015 at 9:47 AM, Bruce Schuchardt <[email protected]> wrote: > Shouldn't DistributionConfig be moved to the public API? It seems like a > pretty convenient class. Maybe that could be done when the repackaging is > being done. > > > Le 6/30/2015 8:31 PM, Kirk Lund a écrit : > >> Yeah, the LocatorLauncher is intended to be an API for starting a >> Locator in your local JVM or to use as the main when starting a new JVM. >> >> You don't need to have a gemfire.properties file. You can programmatically >> define all of your config options at runtime and either feed them in via >> the LocatorLauncher.Builder. >> >> LocatorLauncher launcher = new Builder() >> .setForce(true) >> .setMemberName(getUniqueName()) >> .setPort(this.locatorPort) >> .set(DistributionConfig.LOG_LEVEL_NAME, "config") >> .set(DistributionConfig.MCAST_PORT_NAME, "0") >> .set(DistributionConfig.LOCATORS_NAME, "hostname:port") >> .build() >> .start(); >> >> *replace "hostname:port" with a real hostname and port for any other >> locators >> >> If you don't want to use the internal (non-user-API) DistributionConfig >> then just specify strings for the property names: >> >> .set("log-level", "config") >> .set("mcast-port", "0") >> .set("locators", "hostname:port") >> >> Another way to set these at runtime is to set System properties with >> the "gemfire." prefix: >> >> System.setProperty("gemfire.log-level", "config"); >> System.setProperty("gemfire.mcast-port", "0"); >> System.setProperty("gemfire.locators", "hostname:port"); >> >> LocatorLauncher.start() is invoking InternalLocator.startLocator(...) >> which is the implementation of a locator and it's passing in a Properties >> instance with all the key:value gemfire.properties you set. Down inside >> InternalLocator, it adds the local locator into the "locators" before >> connecting to the DistributedSystem, so don't add the local locator to >> your "locators" value within this JVM. Just list out hostname:port values >> for other locators. If you did use a gemfire.properties file that's the >> same place in the code that would trigger finding and loading the >> properties file. >> >> -Kirk (@kirk_lund) >> >> >> On Tue, Jun 30, 2015 at 7:07 PM, Vinicius Carvalho < >> [email protected]> wrote: >> >> Hi there, is it possible to use the LocatorLauncher class to bootstrap my >>> locators within my code, and set the hosts of other locators dynamically? >>> >>> I don't have multicast enabled (AWS) and I need to specify the other >>> locators by using an EC2 discovery. >>> >>> I could not find a way with the class to specify other locators in the >>> system. Only via gemfire.properties. >>> >>> Is there a way to do such thing? >>> >>> Thank you >>> >>> > -- -John 503-504-8657 john.blum10101 (skype)
