Package org.kendar.sync.client
Class BaseSyncClientProcess<T extends BaseSyncClientProcess>
java.lang.Object
org.kendar.sync.client.BaseSyncClientProcess<T>
- Direct Known Subclasses:
SyncClientBackup,SyncClientRestore,SyncClientSync
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected TcpConnectiongetTcpConnection(TcpConnection connection, CommandLineArgs args, int i, int maxPacketSize) booleanprotected voidperformSingleFileRestore(CommandLineArgs args, ConcurrentLinkedQueue<TcpConnection> connections, ConcurrentHashMap<String, FileInfo> mapToTransfer, Semaphore semaphore, CountDownLatch completionLatch) protected voidscanDirectory(File directory, String basePath, List<FileInfo> files, boolean ignoreHiddenFiles, boolean ignoreSystemFiles) Recursively scans a directory and adds all files to the list.setCheckRunning(Supplier<Boolean> checkRunning) protected voidtransferFile(FileInfo file, CommandLineArgs args, TcpConnection connection) Transfers a single file using a dedicated connection.
-
Field Details
-
executorService
-
-
Constructor Details
-
BaseSyncClientProcess
public BaseSyncClientProcess()
-
-
Method Details
-
setCheckRunning
-
close
public void close() -
isRunning
public boolean isRunning() -
scanDirectory
protected void scanDirectory(File directory, String basePath, List<FileInfo> files, boolean ignoreHiddenFiles, boolean ignoreSystemFiles) throws IOException Recursively scans a directory and adds all files to the list.- Parameters:
directory- The directory to scanbasePath- The base path for calculating relative pathsfiles- The list to add files toignoreHiddenFiles-ignoreSystemFiles-- Throws:
IOException- If an I/O error occurs
-
transferFile
protected void transferFile(FileInfo file, CommandLineArgs args, TcpConnection connection) throws IOException Transfers a single file using a dedicated connection.- Parameters:
file- The file to transferargs- The command line argumentsconnection- The connection- Throws:
IOException- If an I/O error occurs
-
performSingleFileRestore
protected void performSingleFileRestore(CommandLineArgs args, ConcurrentLinkedQueue<TcpConnection> connections, ConcurrentHashMap<String, FileInfo> mapToTransfer, Semaphore semaphore, CountDownLatch completionLatch) -
getTcpConnection
protected TcpConnection getTcpConnection(TcpConnection connection, CommandLineArgs args, int i, int maxPacketSize) throws IOException - Throws:
IOException
-