private ServiceEndPoint chooseEndPoint(Iterable<ServiceEndPoint> endPoints, PartitionContext partitionContext) { endPoints = _partitionFilter.filter(endPoints, partitionContext); if (endPoints == null || Iterables.isEmpty(endPoints)) { return null; } ServiceEndPoint endPoint = _loadBalanceAlgorithm.choose(endPoints, _servicePoolStatistics); if (endPoint == null) { return null; } return endPoint; }
private boolean isOwner(String name) { // Replicates the calculation performed inside Ostrich to determine which endpoint owns an object. Iterable<ServiceEndPoint> endPoints = _hostDiscovery.getHosts(); if (Iterables.isEmpty(endPoints)) { return false; } ServiceEndPoint owner = Iterables.getOnlyElement( _partitionFilter.filter(endPoints, _factory.getContext(name))); return _selfId.equals(owner.getId()); }
private boolean isOwner(String name) { // Replicates the calculation performed inside Ostrich to determine which endpoint owns an object. Iterable<ServiceEndPoint> endPoints = _hostDiscovery.getHosts(); if (Iterables.isEmpty(endPoints)) { return false; } ServiceEndPoint owner = Iterables.getOnlyElement( _partitionFilter.filter(endPoints, _factory.getContext(name))); return _selfId.equals(owner.getId()); }
private ServiceEndPoint chooseEndPoint(Iterable<ServiceEndPoint> endPoints, PartitionContext partitionContext) { endPoints = _partitionFilter.filter(endPoints, partitionContext); if (endPoints == null || Iterables.isEmpty(endPoints)) { return null; } ServiceEndPoint endPoint = _loadBalanceAlgorithm.choose(endPoints, _servicePoolStatistics); if (endPoint == null) { return null; } return endPoint; }