I use a method that tries to get a list of files in a file directory through samba and count the number of them on the disk. The disk is 5 terabytes full. So the error comes out on the line diskShare.list(PATH) "com.hierynomus.smbj.common.SMBRuntimeException: com.hierynomus.protocol.transport.TransportException: java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired"
I use build.gradle implementation 'com.hierynomus:smbj:0.12.2'.
@Slf4j
@Service
public class SambaServiceImpl implements SambaService {
@Value("${samba.servername}")
private String SERVERNAME;
@Value("${samba.username}")
private String USERNAME;
@Value("${samba.password}")
private String PASSWORD;
@Value("${samba.domain}")
private String DOMAIN;
@Value("${samba.share}")
private String SHARE;
@Value("${samba.path}")
private String PATH;
public ResponseEntity<String> getConnectionTest() {
try (SMBClient client = new SMBClient();) {
AuthenticationContext auth = new AuthenticationContext(USERNAME,
PASSWORD.toCharArray(), DOMAIN);
try (Session session = client.connect(SERVERNAME).authenticate(auth)) {
try (DiskShare diskShare = (DiskShare) session.connectShare(SHARE)) {
List<FileIdBothDirectoryInformation> files = diskShare.list(PATH);
return new ResponseEntity<>("Size: " + files.toString(), HttpStatus.OK);
}
}
} catch (IOException e) {
log.error(e.getMessage(), e);
return new ResponseEntity<>(HttpStatus.CONFLICT);
}
}
}
I tried to increase the any timeout:
try (SMBClient client = new SMBClient(SmbConfig.builder().withReadTimeout(1000000000,
TimeUnit.SECONDS).build())) {..}
but the error is the same.
please tell me how to be in such a situation? there are a lot of files on the disk and how to output everything? I can choose one file by name, but that's not enough
FileInformation file =
diskShare.getFileInformation(PATH + "53039.pdf");