org.springframework.integration.adapter.ftp
Class QueuedFTPClientPool

java.lang.Object
  extended by 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

Nested Class Summary
private  class QueuedFTPClientPool.DefaultFactory
           
 
Field Summary
private  org.apache.commons.net.ftp.FTPClientConfig config
           
private static int DEFAULT_POOL_SIZE
           
private static java.lang.String DEFAULT_REMOTE_WORKING_DIRECTORY
           
private  FTPClientFactory factory
           
private  java.lang.String host
           
private  org.apache.commons.logging.Log log
           
private  java.lang.String password
           
private  java.util.Queue<org.apache.commons.net.ftp.FTPClient> pool
           
private  int port
           
private  java.lang.String remoteWorkingDirectory
           
private  java.lang.String username
           
 
Constructor Summary
QueuedFTPClientPool()
           
QueuedFTPClientPool(int maxPoolSize)
           
 
Method Summary
 org.apache.commons.net.ftp.FTPClient getClient()
           
 void releaseClient(org.apache.commons.net.ftp.FTPClient client)
          Releases the client back to the pool.
 void setConfig(org.apache.commons.net.ftp.FTPClientConfig config)
           
 void setFactory(FTPClientFactory factory)
           
 void setHost(java.lang.String host)
           
 void setPassword(java.lang.String pass)
           
 void setPort(int port)
           
 void setRemoteWorkingDirectory(java.lang.String remoteWorkingDirectory)
           
 void setUsername(java.lang.String user)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

QueuedFTPClientPool

public QueuedFTPClientPool()

QueuedFTPClientPool

public QueuedFTPClientPool(int maxPoolSize)
Parameters:
maxPoolSize - the maximum size of the pool
Method Detail

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)