Configurations and Monitoring are abstracted out /** * See the API documentation on how to run a transfer once you have a TransferHook * */ public interface TransferRunner {public abstract void runTransfer(Pair<TransferHook,FCClient> clientHookPair);} /** * See the API documentation for details on how to configure our FCClient objects * */ private void configConnectAndLogin(FCClient nextClient) {//fill in your configuration and connection methods here} public Pair<TransferHook,FCClient> initTransfer(File aFile,LinkedBlockingQueue<FCClient> clientPool) {TransferHook hook = null; Pair<TransferHook,FCClient> pair = null; try {FCClient nextClient = clientPool.take(); configConnectAndLogin(nextClient); hook = nextClient.upload(aFile); pair = new Pair<>(hook,nextClient);} catch (Exception e) {} return pair;}
/ ** * សូមមើលឯកសារ API អំពីវិធីដំណើរការការផ្ទេរមួយនៅពេលដែលអ្នកមាន TransferHook * * / interface សាធារណៈ TransferRunner {public abstract void runTransfer (Pair <TransferHook, FCClient> clientHookPair);} / ** * សូមមើលឯកសារ API សម្រាប់ព័ត៌មានលម្អិតអំពីរបៀបកំណត់រចនាសម្ព័ន្ធវត្ថុ FCClient របស់យើង * * / private void configConnectAndLogin (FCClient nextClient) {// បំពេញនៅក្នុងការកំណត់រចនាសម្ព័ន្ធរបស់អ្នកនិងវិធីសាស្ត្រតភ្ជាប់ទីនេះ} សាធារណៈ Pair <TransferHook, FCClient> initTransfer (ឯកសារ aFile, LinkedBlockingQueue <FCClient> clientPool) {TransferHook hook = null; គូ <TransferHook, FCClient> pair = null; សាកល្បង {FCClient nextClient = clientPool.take (); configConnectAndLogin (nextClient); hook = nextClient.upload (aFile); គូ = Pair ថ្មី <> (hook, nextClient);} catch (ករណីលើកលែង e) {} គូត្រឡប់មកវិញ;}