Search in sources :

Example 1 with FileCallable

use of com.github.lybgeek.upload.concurrent.FileCallable in project springboot-learning by lyb-geek.

the class FileServiceImpl method sliceUpload.

@Override
public FileUploadDTO sliceUpload(FileUploadRequestDTO fileUploadRequestDTO) {
    try {
        completionService.submit(new FileCallable(UploadModeEnum.RANDOM_ACCESS, fileUploadRequestDTO));
        FileUploadDTO fileUploadDTO = completionService.take().get();
        return fileUploadDTO;
    } catch (InterruptedException e) {
        log.error(e.getMessage(), e);
        throw new BizException(e.getMessage(), 406);
    } catch (ExecutionException e) {
        log.error(e.getMessage(), e);
        throw new BizException(e.getMessage(), 406);
    }
}
Also used : FileUploadDTO(com.github.lybgeek.upload.dto.FileUploadDTO) FileCallable(com.github.lybgeek.upload.concurrent.FileCallable) BizException(com.github.lybgeek.common.exception.BizException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

BizException (com.github.lybgeek.common.exception.BizException)1 FileCallable (com.github.lybgeek.upload.concurrent.FileCallable)1 FileUploadDTO (com.github.lybgeek.upload.dto.FileUploadDTO)1 ExecutionException (java.util.concurrent.ExecutionException)1