Package ubic.gemma.core.loader.util.ftp
Class FTPClientFactoryImpl
java.lang.Object
ubic.gemma.core.loader.util.ftp.FTPClientFactoryImpl
- All Implemented Interfaces:
AutoCloseable,FTPClientFactory
This implementation maintains one pool of FTP clients per URL authority (i.e
URL.getAuthority()).
Anonymous authentication is used by default.
- Author:
- poirigui
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabandonClient(URL url, org.apache.commons.net.ftp.FTPClient client) Abandon an FTP client.voidclose()voiddestroyClient(URL url, org.apache.commons.net.ftp.FTPClient client) Destroy an FTP client that is known to be no-longer valid.org.apache.commons.net.ftp.FTPClientgetFtpClient(URL url) Create an FTP client for the given URL.openStream(URL url) Open an input stream for the given FTP URL.voidrecycleClient(URL url, org.apache.commons.net.ftp.FTPClient client) Recycle the FTP client so that it might be reused in the future.voidsetAuthenticator(FTPClientAuthenticator authenticator) Set the authenticator to use to authenticate against FTP servers.voidsetConnectTimeout(Duration connectTimeout) voidsetControlTimeout(Duration controlTimeout) voidsetDataTimeout(Duration dataTimeout) voidsetMaxIdleConnections(int maxIdle) Set the maximum number of idle FTP connections to keep in the pool.voidsetMaxTotalConnections(int maxTotal) Set the maximum number of FTP connections.
-
Constructor Details
-
FTPClientFactoryImpl
public FTPClientFactoryImpl()
-
-
Method Details
-
setConnectTimeout
-
setControlTimeout
-
setDataTimeout
-
setMaxIdleConnections
public void setMaxIdleConnections(int maxIdle) Set the maximum number of idle FTP connections to keep in the pool. -
setMaxTotalConnections
public void setMaxTotalConnections(int maxTotal) Set the maximum number of FTP connections. -
setAuthenticator
Set the authenticator to use to authenticate against FTP servers. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getFtpClient
Description copied from interface:FTPClientFactoryCreate an FTP client for the given URL.Once you're done with the client, you should consider recycling it with
FTPClientFactory.recycleClient(URL, FTPClient). However, if you do so, make sure that all pending commands have completed withFTPClient.completePendingCommand().- Specified by:
getFtpClientin interfaceFTPClientFactory- Throws:
IOException
-
destroyClient
Description copied from interface:FTPClientFactoryDestroy an FTP client that is known to be no-longer valid.- Specified by:
destroyClientin interfaceFTPClientFactory
-
abandonClient
Description copied from interface:FTPClientFactoryAbandon an FTP client.Unlike
FTPClientFactory.destroyClient(URL, FTPClient), no attempt will be made to gracefully logout.- Specified by:
abandonClientin interfaceFTPClientFactory
-
recycleClient
Description copied from interface:FTPClientFactoryRecycle the FTP client so that it might be reused in the future.- Specified by:
recycleClientin interfaceFTPClientFactory
-
openStream
Description copied from interface:FTPClientFactoryOpen an input stream for the given FTP URL.The FTP client will be recycled once the stream is closed.
- Specified by:
openStreamin interfaceFTPClientFactory- Throws:
IOException
-