-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pivotal ID #186675047: FTP connection pool #792
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Really nice improvement!
Please consider my comments before merging
|
||
/** | ||
* Pooled FTP client. Allows to re use FTPClient instances so socket connections and ftp logging does not need to be | ||
* perform on each FTP operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: ... does not need to be performed on each ...
return try { | ||
ftpClient.sendNoOp() | ||
} catch (e: Exception) { | ||
logger.error(e) { "Error checking ftp connection" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should log the exception message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.error(e)
will garantee is logged
): GenericObjectPool<FTPClient> { | ||
val factory = FTPClientFactory(ftpUser, ftpPassword, ftpUrl, ftpPort) | ||
var connections = GenericObjectPool(factory) | ||
connections.minIdle = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this throw magic number warning?
} | ||
|
||
/** | ||
* As Ftp clients are re used we need to garantee that if working directory is changed it is restored after |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edit suggestion: ... to guarantee that, if the working directory is changed, it is restored after the operation is completed.
private val testInstance = FtpClient.create(FTP_USER, FTP_PASSWORD, ftpServer.getUrl(), ftpServer.ftpPort) | ||
|
||
@Test | ||
fun `upload a file, list and download it`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest: upload a file, list it and download it
because for a moment I thought the comma was not intentional and it was referring to a file list
https://www.pivotaltracker.com/story/show/186675047