PL-8338 Client-tier bean for working with FileStorage using streams

This commit is contained in:
Yuriy Artamonov 2017-04-04 13:14:15 +04:00
parent 4f2b912c4e
commit 82e1cb33a3
2 changed files with 3 additions and 4 deletions

View File

@ -25,7 +25,6 @@ import org.springframework.stereotype.Component;
import javax.annotation.Nullable;
import javax.inject.Inject;
import java.io.InputStream;
import java.util.function.Consumer;
import java.util.function.Supplier;
@Component(FileLoader.NAME)
@ -40,7 +39,7 @@ public class FileLoaderImpl implements FileLoader {
@Override
public void saveStream(FileDescriptor fd, Supplier<InputStream> inputStreamSupplier,
@Nullable Consumer<StreamingProgressEvent> streamingListener)
@Nullable StreamingProgressListener streamingListener)
throws FileStorageException, InterruptedException {
fileStorageAPI.saveStream(fd, inputStreamSupplier.get());
}

View File

@ -261,9 +261,9 @@ public class FileUploading implements FileUploadingAPI, FileUploadingMBean {
};
if (listener != null) {
fileLoader.saveStream(fileDescr, inputStreamSupplier, e -> {
fileLoader.saveStream(fileDescr, inputStreamSupplier, transferredBytes -> {
try {
listener.progressChanged(fileId, e.getTransferredBytes(), fileSize);
listener.progressChanged(fileId, transferredBytes, fileSize);
} catch (InterruptedException ie) {
// if thread is already interrupted we will restore interrupted flag
Thread.currentThread().interrupt();