commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: [POOL + Net] Has anyone done an implementation for Pool + FTP
Date Sun, 09 Jan 2005 20:54:04 GMT
Some guidance I can give you...
You have to implement the PoolableObjectFactory interface.

   Object makeObject() throws Exception;
=> connect /login

   void destroyObject(Object obj) throws Exception;
=> logout / disconnect

   boolean validateObject(Object obj);
=> ftp.sendNoOp

   void activateObject(Object obj) throws Exception;
=> ftp.setFileType
=> ftp.setFileTransferMode
=> ...

   void passivateObject(Object obj) throws Exception;
=> if transfer not complete then ftp.abort();

Just implements the ftp transfer as a standalone program and then move 
the code into the factory, then you can use this factory for 
constructing the pool.

In this case you pool the FTPClients, this is assuming you have a pool 
of clients all connecting to the same host with the same user/password.

If you have different host/user combinations then you have to 
implement a KeyedPoolableObjectFactory with as key a host/user object.

-- Dirk

Jonathan Easterling wrote:

> Hello,
> Has anyone out there done an implementation of the Connection Pool stuff for FTP? Any
guidance / examples would be greatly appreciated.
> Thanks
> Jon

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message