Search in sources :

Example 6 with RetryableCoordinatorException

use of com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException in project coprhd-controller by CoprHD.

the class HostSupplierImpl method internalGet.

public List<Host> internalGet() {
    try {
        _log.debug("getting hosts for " + dbSvcName + "; version = " + _version);
        boolean isGeodb = Constants.GEODBSVC_NAME.equals(dbSvcName);
        List<Service> service = _coordinator.locateAllServices(dbSvcName, _version, (String) null, null);
        List<Host> hostList = new ArrayList<Host>(service.size());
        for (int i = 0; i < service.size(); i++) {
            Service svc = service.get(i);
            if (isGeodb && isDbReinitializing(svc)) {
                _log.debug("Ignore host {} because its geodb is reinitialzing", svc.getId());
                continue;
            }
            URI hostUri = svc.getEndpoint();
            _log.debug("Found " + svc.getName() + "; host = " + hostUri.getHost() + "; port = " + hostUri.getPort());
            hostList.add(new Host(String.format("%1$s:%2$d", hostUri.getHost(), hostUri.getPort()), hostUri.getPort()));
        }
        _log.debug("dbsvc endpoint refreshed");
        return hostList;
    } catch (RetryableCoordinatorException e) {
        _log.warn("no dbsvc instance running. Coordinator exception message: {}", e.getMessage());
    } catch (Exception e) {
        _log.error("dbsvc lookup failure", e);
    }
    return Collections.emptyList();
}
Also used : Service(com.emc.storageos.coordinator.common.Service) RetryableCoordinatorException(com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException) Host(com.netflix.astyanax.connectionpool.Host) URI(java.net.URI) RetryableCoordinatorException(com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)

Aggregations

RetryableCoordinatorException (com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)6 Site (com.emc.storageos.coordinator.client.model.Site)2 Service (com.emc.storageos.coordinator.common.Service)2 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)2 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 IOException (java.io.IOException)2 URI (java.net.URI)2 UnknownHostException (java.net.UnknownHostException)2 InterState (com.emc.storageos.coordinator.client.model.DrOperationStatus.InterState)1 SiteInfo (com.emc.storageos.coordinator.client.model.SiteInfo)1 CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)1 Configuration (com.emc.storageos.coordinator.common.Configuration)1 ZkPath (com.emc.storageos.coordinator.common.impl.ZkPath)1 PropertyInfoMapper.decodeFromString (com.emc.storageos.coordinator.mapper.PropertyInfoMapper.decodeFromString)1 DbService (com.emc.storageos.db.server.DbService)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)1 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)1 InvalidLockOwnerException (com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException)1 Host (com.netflix.astyanax.connectionpool.Host)1