private String getStartRevision(int retry) { try { // control we are not exceeding number of requests/second bandwidthController.newRequest(); logger.debug("Getting drive status..."); return drive.changes().getStartPageToken().execute().getStartPageToken(); } catch (IOException e) { if (retry > 0) { try { Thread.sleep(1000); } catch (InterruptedException e1) { throw new RuntimeException(e1); } logger.warn("Error getting latest changes. Retrying..."); return getStartRevision(--retry); } throw new RuntimeException("Error getting latest changes", e); } }
/** * Gets the starting pageToken for listing future changes. * * Create a request for the method "changes.getStartPageToken". * * This request holds the parameters needed by the drive server. After setting any optional * parameters, call the {@link GetStartPageToken#execute()} method to invoke the remote operation. * * @return the request */ public GetStartPageToken getStartPageToken() throws java.io.IOException { GetStartPageToken result = new GetStartPageToken(); initialize(result); return result; }