- public PropertyLocator(String locList) throws LocatorException {
- this(locList,10000L, 1000*60*20L); // defaults, do not refresh more than once in 10 seconds, Refresh Locator every 20 mins.
- }
- /**
- * comma delimited root url list
- *
- * @param locList
- * @throws LocatorException
- */
- public PropertyLocator(String locList, long minRefreshMillis, long backgroundRefreshMillis) throws LocatorException {
- minRefresh = minRefreshMillis;
- backgroundRefresh = backgroundRefreshMillis;
- lastRefreshed=0L;
- if(locList==null) {
- throw new LocatorException("No Location List given for PropertyLocator");
- }
- String[] locarray = Split.split(',',locList);
- List<URI> uriList = new ArrayList<URI>();
-
- random = new SecureRandom();
-
- for(int i=0;i<locarray.length;++i) {
- try {
- int range = locarray[i].indexOf(":[");
- if(range<0) {
- uriList.add(new URI(locarray[i]));
- } else {
- String mach_colon = locarray[i].substring(0, range+1);
- int dash = locarray[i].indexOf('-',range+2);
- int brac = locarray[i].indexOf(']',dash+1);
- int slash = locarray[i].indexOf('/',brac);
- int start = Integer.parseInt(locarray[i].substring(range+2, dash));
- int end = Integer.parseInt(locarray[i].substring(dash+1, brac));
- for(int port=start;port<=end;++port) {
- uriList.add(new URI(mach_colon+port + (slash>=0?locarray[i].substring(slash):"")));
- }
- }
- } catch (NumberFormatException nf) {
- throw new LocatorException("Invalid URI format: " + locarray[i]);
- } catch (URISyntaxException e) {
- throw new LocatorException(e);
- }
- }
- orig = new URI[uriList.size()];
- uriList.toArray(orig);
+ public PropertyLocator(String locList) throws LocatorException {
+ this(locList,10000L, 1000*60*20L); // defaults, do not refresh more than once in 10 seconds, Refresh Locator every 20 mins.
+ }
+ /**
+ * comma delimited root url list
+ *
+ * @param locList
+ * @throws LocatorException
+ */
+ public PropertyLocator(String locList, long minRefreshMillis, long backgroundRefreshMillis) throws LocatorException {
+ minRefresh = minRefreshMillis;
+ backgroundRefresh = backgroundRefreshMillis;
+ lastRefreshed=0L;
+ if (locList==null) {
+ throw new LocatorException("No Location List given for PropertyLocator");
+ }
+ String[] locarray = Split.split(',',locList);
+ List<URI> uriList = new ArrayList<>();
+
+ random = new SecureRandom();
+
+ for (int i=0;i<locarray.length;++i) {
+ try {
+ int range = locarray[i].indexOf(":[");
+ if (range<0) {
+ uriList.add(new URI(locarray[i]));
+ } else {
+ String mach_colon = locarray[i].substring(0, range+1);
+ int dash = locarray[i].indexOf('-',range+2);
+ int brac = locarray[i].indexOf(']',dash+1);
+ int slash = locarray[i].indexOf('/',brac);
+ int start = Integer.parseInt(locarray[i].substring(range+2, dash));
+ int end = Integer.parseInt(locarray[i].substring(dash+1, brac));
+ for (int port=start;port<=end;++port) {
+ uriList.add(new URI(mach_colon+port + (slash>=0?locarray[i].substring(slash):"")));
+ }
+ }
+ } catch (NumberFormatException nf) {
+ throw new LocatorException("Invalid URI format: " + locarray[i]);
+ } catch (URISyntaxException e) {
+ throw new LocatorException(e);
+ }
+ }
+ orig = new URI[uriList.size()];
+ uriList.toArray(orig);