Class FileUpload


  • public class FileUpload
    extends java.lang.Object
    • Field Detail

      • LOGGER

        private static final org.apache.logging.log4j.Logger LOGGER
      • file

        private final java.io.File file
      • worldId

        private final long worldId
      • slotId

        private final int slotId
      • sessionId

        private final java.lang.String sessionId
      • username

        private final java.lang.String username
      • clientVersion

        private final java.lang.String clientVersion
      • cancelled

        private final java.util.concurrent.atomic.AtomicBoolean cancelled
      • uploadTask

        private java.util.concurrent.CompletableFuture<UploadResult> uploadTask
      • requestConfig

        private final org.apache.http.client.config.RequestConfig requestConfig
    • Constructor Detail

      • FileUpload

        public FileUpload​(java.io.File p_i232194_1_,
                          long p_i232194_2_,
                          int p_i232194_4_,
                          UploadInfo p_i232194_5_,
                          Session p_i232194_6_,
                          java.lang.String p_i232194_7_,
                          UploadStatus p_i232194_8_)
    • Method Detail

      • upload

        public void upload​(java.util.function.Consumer<UploadResult> p_224874_1_)
      • cancel

        public void cancel()
      • requestUpload

        private UploadResult requestUpload​(int p_224879_1_)
      • cleanup

        private void cleanup​(org.apache.http.client.methods.HttpPost p_224877_1_,
                             org.apache.http.impl.client.CloseableHttpClient p_224877_2_)
      • setupRequest

        private void setupRequest​(org.apache.http.client.methods.HttpPost p_224872_1_)
                           throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • handleResponse

        private void handleResponse​(org.apache.http.HttpResponse p_224875_1_,
                                    UploadResult.Builder p_224875_2_)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • shouldRetry

        private boolean shouldRetry​(long p_224882_1_,
                                    int p_224882_3_)
      • retryUploadAfter

        private UploadResult retryUploadAfter​(long p_224876_1_,
                                              int p_224876_3_)
                                       throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • getRetryDelaySeconds

        private long getRetryDelaySeconds​(org.apache.http.HttpResponse p_224880_1_)
      • isFinished

        public boolean isFinished()