Commit 5c5a94bb authored by neo's avatar neo

[DEV] add log for ftp client factory

parent 95ae2245
...@@ -49,6 +49,8 @@ public class FtpClientFactory implements PooledObjectFactory<FTPClient> { ...@@ -49,6 +49,8 @@ public class FtpClientFactory implements PooledObjectFactory<FTPClient> {
// if (StringUtils.equals(config.getPassiveMode(), "true")) { // if (StringUtils.equals(config.getPassiveMode(), "true")) {
// ftpClient.enterLocalPassiveMode(); // ftpClient.enterLocalPassiveMode();
// } // }
logger.debug("mk objec ftp client {}", ftpClient.toString());
return new DefaultPooledObject<>(ftpClient); return new DefaultPooledObject<>(ftpClient);
} }
...@@ -58,6 +60,7 @@ public class FtpClientFactory implements PooledObjectFactory<FTPClient> { ...@@ -58,6 +60,7 @@ public class FtpClientFactory implements PooledObjectFactory<FTPClient> {
FTPClient ftpClient = pooledObject.getObject(); FTPClient ftpClient = pooledObject.getObject();
try { try {
if (ftpClient != null && ftpClient.isConnected()) { if (ftpClient != null && ftpClient.isConnected()) {
logger.debug("destroy ftp client {}", ftpClient.toString());
ftpClient.logout(); ftpClient.logout();
} }
} finally { } finally {
...@@ -73,6 +76,7 @@ public class FtpClientFactory implements PooledObjectFactory<FTPClient> { ...@@ -73,6 +76,7 @@ public class FtpClientFactory implements PooledObjectFactory<FTPClient> {
@Override @Override
public boolean validateObject(PooledObject<FTPClient> pooledObject) { public boolean validateObject(PooledObject<FTPClient> pooledObject) {
try { try {
logger.debug("validate object ftp client {} ", pooledObject.getObject().toString());
return pooledObject.getObject().sendNoOp(); return pooledObject.getObject().sendNoOp();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("Failed to validate client: " + e, e); throw new RuntimeException("Failed to validate client: " + e, e);
...@@ -81,12 +85,12 @@ public class FtpClientFactory implements PooledObjectFactory<FTPClient> { ...@@ -81,12 +85,12 @@ public class FtpClientFactory implements PooledObjectFactory<FTPClient> {
@Override @Override
public void activateObject(PooledObject<FTPClient> pooledObject) throws Exception { public void activateObject(PooledObject<FTPClient> pooledObject) throws Exception {
logger.debug("activateObject {}", pooledObject.getObject().toString());
} }
@Override @Override
public void passivateObject(PooledObject<FTPClient> pooledObject) throws Exception { public void passivateObject(PooledObject<FTPClient> pooledObject) throws Exception {
logger.debug("passivateObject {}", pooledObject.getObject().toString());
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment