Description
I want to be able to specify the workingDirectory when constructing a GMSLocator which will then be used for the location of the locator view files (locator<pid>view.dat). Tests would use the TemporaryFolder JUnit Rule to specify a workingDirectory for the location of the locator view files. This will eliminate the potential for file system pollution of locator view files and guarantee better cleanup especially when running tests from an IDE.
Default value for workingDirectory is System.getProperty("user.dir").
At first, I intend to use this from tests that use LocatorLauncher. The full path from LocatorLauncher to GMSLocator is:
LocatorLauncher.start()
-> InternalLocator.startLocator(int, File, InternalLogWriter, InternalLogWriter, InetAddress, boolean, Properties, String)
-> InternalLocator.startPeerLocation()
-> MemberFactory.newLocatorHandler(InetAddress, String, boolean, boolean, LocatorStats, String)
-> GMSMemberFactory.newLocatorHandler(InetAddress, String, boolean, boolean, LocatorStats, String)
-> GMSLocator.GMSLocator(InetAddress, String, boolean, boolean, LocatorStats, String)
Proposed implementation is to add a String field and constructor parameter for the absolute workingDirectory path to these classes:
- InternalLocator
- GMSLocator
And, finally the following methods would have a new String parameter for workingDirectory added to them:
- InternalLocator.startLocator(int, File, InternalLogWriter, InternalLogWriter, InetAddress, boolean, Properties, String, String)
- MemberFactory.newLocatorHandler(InetAddress, String, boolean, boolean, LocatorStats, String, String)
- GMSMemberFactory.newLocatorHandler(InetAddress, String, boolean, boolean, LocatorStats, String, String)