Apache Commons NET: Should I create a new FTPClient object on each connection or reuse one?
问题 I'm just wondering: in my Java application, each time I need to connect to an FTP server, should I create a new FTPClient object, or should I create one FTPClient() object and re-use that each time I connect to an FTP server? 回答1: Reusing would be better since you wont need a new instance every time you are creating a new connection, even to a new server. Because the connect and disconnect methods can do the job for you. So reuse as many objects as you can. 回答2: Both will work, but apache