use of com.emc.storageos.recoverpoint.utils.RecoverPointConnection in project coprhd-controller by CoprHD.
the class RecoverPointClient method reconnect.
/**
* Method to refresh the connection of this RPClient to the Recover Point System
* via FAPI. Used just in case the connection has become stale.
*/
public void reconnect() {
logger.info(String.format("Attempt to refresh connection to RecoverPoint at %s", this.getEndpoint()));
try {
// Remove existing FAPI reference
this.setFunctionalAPI(null);
// Create the connection
FunctionalAPIImpl impl = new RecoverPointConnection().connect(this.getEndpoint(), this.getUsername(), this.getPassword());
// Add the new FAPI instance to the RecoverPointClient
this.setFunctionalAPI(impl);
// We just connected but to be safe, lets do a quick ping to confirm that
// we can reach the new RecoverPoint client
this.ping();
logger.info("Connection refreshed.");
} catch (Exception e) {
logger.error("Received " + e.toString() + ". Failed to refresh RP connection: " + this.getEndpoint().toString() + ", Cause: " + RecoverPointClient.getCause(e));
throw RecoverPointException.exceptions.failedToPingMgmtIP(this.getEndpoint().toString(), RecoverPointClient.getCause(e));
}
}
Aggregations