@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Endpoint == false) return false; Endpoint other = (Endpoint) obj; if (other.getAddress() == null ^ this.getAddress() == null) return false; if (other.getAddress() != null && other.getAddress().equals(this.getAddress()) == false) return false; if (other.getPort() == null ^ this.getPort() == null) return false; if (other.getPort() != null && other.getPort().equals(this.getPort()) == false) return false; return true; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAddress() != null) sb.append("Address: ").append(getAddress()).append(","); if (getPort() != null) sb.append("Port: ").append(getPort()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Endpoint == false) return false; Endpoint other = (Endpoint) obj; if (other.getAddress() == null ^ this.getAddress() == null) return false; if (other.getAddress() != null && other.getAddress().equals(this.getAddress()) == false) return false; if (other.getPort() == null ^ this.getPort() == null) return false; if (other.getPort() != null && other.getPort().equals(this.getPort()) == false) return false; return true; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAddress() != null) sb.append("Address: ").append(getAddress()).append(","); if (getPort() != null) sb.append("Port: ").append(getPort()); sb.append("}"); return sb.toString(); }
elastiCacheVH.setPrimaryOrConfigEndpoint(cluster.getConfigurationEndpoint().getAddress()+":"+cluster.getConfigurationEndpoint().getPort()); }else{ ReplicationGroup rplGrp = replGrpMap.get(clusterName); endPoint = cluster.getCacheNodes().stream().map(CacheNode::getEndpoint).findAny().get(); elastiCacheVH.setPrimaryOrConfigEndpoint(endPoint.getAddress().replaceAll(cluster.getCacheClusterId(), clusterName)+":"+endPoint.getPort());
@Override protected Cache createInstance() throws Exception { DescribeCacheClustersRequest describeCacheClustersRequest = new DescribeCacheClustersRequest().withCacheClusterId(getCacheClusterName()); describeCacheClustersRequest.setShowCacheNodeInfo(true); DescribeCacheClustersResult describeCacheClustersResult = this.amazonElastiCache.describeCacheClusters(describeCacheClustersRequest); CacheCluster cacheCluster = describeCacheClustersResult.getCacheClusters().get(0); if (!"available".equals(cacheCluster.getCacheClusterStatus())) { LOGGER.warn("Cache cluster is not available now. Connection may fail during cache access. Current status is {}", cacheCluster.getCacheClusterStatus()); } Endpoint configurationEndpoint = getEndpointForCache(cacheCluster); for (CacheFactory cacheFactory : this.cacheFactories) { if (cacheFactory.isSupportingCacheArchitecture(cacheCluster.getEngine())) { return cacheFactory.createCache(this.cacheClusterId, configurationEndpoint.getAddress(), configurationEndpoint.getPort()); } } throw new IllegalArgumentException("No CacheFactory configured for engine: " + cacheCluster.getEngine()); }
@Override protected Cache createInstance() throws Exception { DescribeCacheClustersRequest describeCacheClustersRequest = new DescribeCacheClustersRequest().withCacheClusterId(getCacheClusterName()); describeCacheClustersRequest.setShowCacheNodeInfo(true); DescribeCacheClustersResult describeCacheClustersResult = this.amazonElastiCache.describeCacheClusters(describeCacheClustersRequest); CacheCluster cacheCluster = describeCacheClustersResult.getCacheClusters().get(0); if (!"available".equals(cacheCluster.getCacheClusterStatus())) { LOGGER.warn("Cache cluster is not available now. Connection may fail during cache access. Current status is {}", cacheCluster.getCacheClusterStatus()); } Endpoint configurationEndpoint = getEndpointForCache(cacheCluster); for (CacheFactory cacheFactory : this.cacheFactories) { if (cacheFactory.isSupportingCacheArchitecture(cacheCluster.getEngine())) { return cacheFactory.createCache(this.cacheClusterId, configurationEndpoint.getAddress(), configurationEndpoint.getPort()); } } throw new IllegalArgumentException("No CacheFactory configured for engine: " + cacheCluster.getEngine()); }