Class TusExecutor

java.lang.Object
io.tus.java.client.TusExecutor

public abstract class TusExecutor extends Object
TusExecutor is a wrapper class which you can build around your uploading mechanism and any exception thrown by it will be caught and may result in a retry. This way you can easily add retrying functionality to your application with defined delays between them. This can be achieved by extending TusExecutor and implementing the abstract makeAttempt() method:
 
  TusExecutor executor = new TusExecutor() {
      {@literal @}Override
      protected void makeAttempt() throws ProtocolException, IOException {
          TusUploader uploader = client.resumeOrCreateUpload(upload);
          while(uploader.uploadChunk() > -1) {}
          uploader.finish();
      }
  };
  executor.makeAttempts();
 
 
The retries are basically just calling the makeAttempt() method which should then retrieve an TusUploader using TusClient.resumeOrCreateUpload(TusUpload) and then invoke TusUploader.uploadChunk() as long as possible without catching ProtocolExceptions or IOExceptions as this is taken over by this class. The current attempt can be interrupted using Thread.interrupt() which will cause the makeAttempts() method to return false immediately.