@Override public CompletableFuture<List<BaseLease>> getAllLeases() { CompletableFuture<List<BaseLease>> future = null; try { ArrayList<BaseLease> infos = new ArrayList<BaseLease>(); EnumSet<BlobListingDetails> details = EnumSet.of(BlobListingDetails.METADATA); Iterable<ListBlobItem> leaseBlobs = this.consumerGroupDirectory.listBlobs("", true, details, this.leaseOperationOptions, null); leaseBlobs.forEach((lbi) -> { CloudBlob blob = (CloudBlob)lbi; BlobProperties bp = blob.getProperties(); HashMap<String, String> metadata = blob.getMetadata(); Path p = Paths.get(lbi.getUri().getPath()); infos.add(new BaseLease(p.getFileName().toString(), metadata.get(AzureStorageCheckpointLeaseManager.METADATA_OWNER_NAME), (bp.getLeaseState() == LeaseState.LEASED))); }); future = CompletableFuture.completedFuture(infos); } catch (URISyntaxException | StorageException e) { TRACE_LOGGER.warn(this.hostContext.withHost("Failure while getting lease state details"), e); future = new CompletableFuture<List<BaseLease>>(); future.completeExceptionally(LoggingUtils.wrapException(e, EventProcessorHostActionStrings.GETTING_LEASE)); } return future; }
@Override String getStateDebug() { String retval = "uninitialized"; try { this.blob.downloadAttributes(); BlobProperties props = this.blob.getProperties(); retval = props.getLeaseState().toString() + " " + props.getLeaseStatus().toString() + " " + props.getLeaseDuration().toString(); } catch (StorageException e) { retval = "downloadAttributes on the blob caught " + e.toString(); } return retval; } }
String newToken = null; leaseBlob.downloadAttributes(); if (leaseBlob.getProperties().getLeaseState() == LeaseState.LEASED) { TRACE_LOGGER.debug(this.hostContext.withHostAndPartition(lease, "changeLease")); if ((lease.getToken() == null) || lease.getToken().isEmpty()) {
if (props1.getLeaseState() != null) { assertEquals(props1.getLeaseState(), props2.getLeaseState());