Java Code Examples for org.restlet.resource.ClientResource#setRetryOnError()

The following examples show how to use org.restlet.resource.ClientResource#setRetryOnError() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MigrateUIDOperation.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    monitor.subTask(Messages.migratingUID);
    PageDesignerURLFactory urlBuilder = pageDesignerURLBuilder == null
            ? new PageDesignerURLFactory(getPreferenceStore()) : pageDesignerURLBuilder;
    URI uri = null;
    try {
        uri = urlBuilder.migrate().toURI();
    } catch (MalformedURLException | URISyntaxException e1) {
        throw new InvocationTargetException(new MigrationException(e1));
    }
    Context currentContext = Context.getCurrent();
    try {
        ClientResource clientResource = new ClientResource(uri);
        clientResource.setRetryOnError(true);
        clientResource.setRetryDelay(500);
        clientResource.setRetryAttempts(10);
        clientResource.post(new EmptyRepresentation());
    } catch (ResourceException e) {
        throw new InvocationTargetException(new MigrationException(e),
                "Failed to post on " + uri);
    }finally {
        Context.setCurrent(currentContext);
    }
}
 
Example 2
Source File: IndexingUIDOperation.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    monitor.subTask(Messages.indexingUIDPages);
    PageDesignerURLFactory urlBuilder = pageDesignerURLBuilder == null
            ? new PageDesignerURLFactory(getPreferenceStore()) : pageDesignerURLBuilder;
    URI uri = null;
    try {
        uri = urlBuilder.indexation().toURI();
    } catch (MalformedURLException | URISyntaxException e1) {
        throw new InvocationTargetException(new MigrationException(e1));
    }
    Context currentContext = Context.getCurrent();
    try {
        ClientResource clientResource = new ClientResource(uri);
        clientResource.setRetryOnError(true);
        clientResource.setRetryDelay(500);
        clientResource.setRetryAttempts(10);
        clientResource.post(new EmptyRepresentation());
    } catch (ResourceException e) {
        throw new InvocationTargetException(new MigrationException(e),
                "Failed to post on " + uri);
    }finally {
        Context.setCurrent(currentContext);
    }
}
 
Example 3
Source File: UIDesignerServerManager.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void connectToURL(final URL url) throws URISyntaxException {
    ClientResource cr = new ClientResource(url.toURI());
    cr.setRetryOnError(true);
    cr.setRetryDelay(500);
    cr.setRetryAttempts(120);
    cr.get();
}