I like this but it might be even better if ServerLauncher gave access to
the CacheServer it launched and CacheServer gave access to its cache.
The Locator interface, as well, could have a getCache() method and
deprecate the getDistributedSystem() method. These days a Locator
always has a Cache and no-one is interested in its DistributedSystem.
On 10/31/18 2:48 PM, Kirk Lund wrote:
LocatorLauncher provides an API which can be used in-process to create a
Locator. There is no public API on that class to get a reference to the
Locator or its Cache.
Similarly, ServerLauncher provides an API which can be used in-process to
create a Server, but there is no public API in that class to get a
reference to its Cache.
The User of either Launcher would then have to resort to invoking
singletons to get a reference to the Cache.
There are existing package-private getter APIs on both Launchers but
they're only used by tests in that same package.
I propose adding public APIs for getCache to both LocatorLauncher and
ServerLauncher as well as adding getLocator to LocatorLauncher. The
signatures would look like:
/**
* Gets a reference to the Cache that was created by this ServerLauncher.
*
* @return a reference to the Cache
*/
public org.apache.geode.cache.Cache getCache();
/**
* Gets a reference to the Locator that was created by this LocatorLauncher.
*
* @return a reference to the Locator
*/
public org.apache.geode.distributed.Locator getLocator();
Any thoughts? Yay or nay?
Thanks,
Kirk