Esempio n. 1
0
  @Nonnull
  @Override
  public Iterable<OfflineStoreRequest> listRequests(@Nonnull final String bucket)
      throws CloudException, InternalException {
    final String regionId = getContext().getRegionId();

    if (regionId == null) {
      throw new CloudException(
          "No region ID was specified"); // TODO: doesn't look like it's needed though
    }
    getProvider().hold();
    PopulatorThread<OfflineStoreRequest> populator =
        new PopulatorThread<OfflineStoreRequest>(
            new JiteratorPopulator<OfflineStoreRequest>() {
              public void populate(@Nonnull Jiterator<OfflineStoreRequest> iterator)
                  throws CloudException, InternalException {
                try {
                  listRequests(bucket, iterator);
                } finally {
                  getProvider().release();
                }
              }
            });
    populator.populate();
    return populator.getResult();
  }
Esempio n. 2
0
  @Override
  public @Nonnull Collection<Blob> list(final @Nullable String bucket)
      throws CloudException, InternalException {
    PopulatorThread<Blob> populator;

    final String regionId = getContext().getRegionId();

    if (regionId == null) {
      throw new CloudException("No region ID was specified");
    }
    getProvider().hold();
    populator =
        new PopulatorThread<Blob>(
            new JiteratorPopulator<Blob>() {
              public void populate(@Nonnull Jiterator<Blob> iterator)
                  throws CloudException, InternalException {
                try {
                  list(regionId, bucket, iterator);
                } finally {
                  getProvider().release();
                }
              }
            });
    populator.populate();
    return populator.getResult();
  }