1 21 22 package org.continuent.sequoia.driver.connectpolicy; 23 24 import org.continuent.sequoia.common.exceptions.NoMoreControllerException; 25 import org.continuent.sequoia.driver.ControllerInfo; 26 import org.continuent.sequoia.driver.Driver; 27 28 36 public class SingleConnectPolicy extends AbstractControllerConnectPolicy 37 { 38 39 46 public SingleConnectPolicy(ControllerInfo[] controllerList, int debugLevel) 47 { 48 super(controllerList, Driver.DEFAULT_RETRY_INTERVAL_IN_MS, debugLevel); 49 if (controllerList.length != 1) 50 throw new RuntimeException ("Invalid number of controllers (" 51 + controllerList.length + ") in URL for SingleConnectPolicy"); 52 } 53 54 57 public ControllerInfo getController() throws NoMoreControllerException 58 { 59 synchronized (suspectedControllers) 60 { 61 if (suspectedControllers.size() == 1) 62 throw new NoMoreControllerException(); 63 return controllerList[0]; 64 } 65 } 66 67 } 68 | Popular Tags |