org.springframework.integration.adapter.ftp
Class QueuedFTPClientPool
java.lang.Object
org.springframework.integration.adapter.ftp.QueuedFTPClientPool
- All Implemented Interfaces:
- FTPClientFactory, FTPClientPool
public class QueuedFTPClientPool
- extends java.lang.Object
- implements FTPClientPool
FTPClientPool implementation based on a Queue. This implementation has a
default pool size of 5, but this is configurable with a constructor argument.
- Author:
- Iwein Fuld
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_POOL_SIZE
private static final int DEFAULT_POOL_SIZE
- See Also:
- Constant Field Values
DEFAULT_REMOTE_WORKING_DIRECTORY
private static final java.lang.String DEFAULT_REMOTE_WORKING_DIRECTORY
- See Also:
- Constant Field Values
pool
private final java.util.Queue<org.apache.commons.net.ftp.FTPClient> pool
config
private volatile org.apache.commons.net.ftp.FTPClientConfig config
host
private volatile java.lang.String host
port
private volatile int port
username
private volatile java.lang.String username
password
private volatile java.lang.String password
factory
private volatile FTPClientFactory factory
log
private final org.apache.commons.logging.Log log
remoteWorkingDirectory
private volatile java.lang.String remoteWorkingDirectory
QueuedFTPClientPool
public QueuedFTPClientPool()
QueuedFTPClientPool
public QueuedFTPClientPool(int maxPoolSize)
- Parameters:
maxPoolSize
- the maximum size of the pool
getClient
public org.apache.commons.net.ftp.FTPClient getClient()
throws java.net.SocketException,
java.io.IOException
- Specified by:
getClient
in interface FTPClientFactory
- Returns:
- Fully configured and connected FTPClient.
- Throws:
java.net.SocketException
java.io.IOException
releaseClient
public void releaseClient(org.apache.commons.net.ftp.FTPClient client)
- Description copied from interface:
FTPClientPool
- Releases the client back to the pool. When calling this method the caller
is no longer responsible for the connection. The pool is free to do with
it as it sees fit, which means either recycling or disconnecting it most
probably.
The caller should NOT disconnect the client before calling this method.
The caller is NOT expected to use the client after calling this method.
Doing so can lead to unexpected behavior.
- Specified by:
releaseClient
in interface FTPClientPool
setConfig
public void setConfig(org.apache.commons.net.ftp.FTPClientConfig config)
setHost
public void setHost(java.lang.String host)
setPort
public void setPort(int port)
setUsername
public void setUsername(java.lang.String user)
setPassword
public void setPassword(java.lang.String pass)
setRemoteWorkingDirectory
public void setRemoteWorkingDirectory(java.lang.String remoteWorkingDirectory)
setFactory
public void setFactory(FTPClientFactory factory)