- public String getNextHostName(String uri) throws RetryException {
- Integer position = null;
-
- for (int i = 0; i < hostnames.length; i++) {
- if (uri.contains(hostnames[i])) {
- position = i;
- break;
- }
- }
-
- if(position == null){
- throw new RetryException("No match found for the provided uri[" + uri + "] " +
- "so the next host name could not be retreived");
- }
- position++;
-
- if (position > hostnames.length - 1) {
- position = 0;
- }
- return hostnames[position];
+ public String getNextHostName() throws RetryException {
+ retryCount++;
+ position++;
+
+ if (position > hostnames.length - 1) {
+ position = 0;
+ }
+ return hostnames[position];