One point is, that the RemoteGatewayListener is doing a real login within its init phase (see checkMyParms()):
RemoteFileSystem rfs = RemoteFileSystemFactory.getRemoteFileSystem(ftpEpr, true);
Is this really needed? Wouldn't it be better to make the last argument configurable? Or would it lead to unexpected results?
Ok, this seems to be worse than I've thought.
The RemoteGatewayListener is opening a connection on each action.
So if there are n files on the server, it'll need at least
1 (getFileList) + n*2 (getFile + rename/delete) connections.
Isn't it possible to reuse the connection until last file is processed?
Well, of course that's doable, but the design of the interfaces and
classes doesn't look like anybody is eager to change all that...
In such cases, I just copy the class in question over to my source tree,
change the package (mind the license header) and implement my
Holding the connection as a member shouldn't be too hard, but I
guess you must disallow concurrent access somehow...
each schedule uses its own Listener (subsequent schedules may share). So what I did is keep the connection as a member at time of onSchedule() Method and close it afterwards, since with finishing this method, all files are being processed.
I also created a JIRA Issue for this (JBESB-2914) since this behaviour is not enterprise ready. Simple FTP is one thing, but think of secure connections...