wood burning stoves 2.0*
The moose likes Java in General and the fly likes Using J2SSH With MDBs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Using J2SSH With MDBs

chetan agg
Ranch Hand

Joined: Apr 11, 2009
Posts: 31
Hi all,

I have an MDB which receives remote location of file. I need to download that file from remote linux server to local file server. I am planning to use J2SSH library. Following are my options/thoughts:

1. Create SSHClient object at MDB startup. So there is one SSHClient (SSH Connection) per MDB. On every onMessage() method, i will open sftpChannel, download file and quit channel. On MDB shutdown i will disconnect sshclient. Now question is with increased load, number of SSH Connections will increase. Is it a good approach ??

2. Create a singleton class at startup which will create SSHClient. On every onMessage() method, I will get SSHClient from Singleton class and use it to create sftpChannel. Now i have only one ssh connection and using across all MDBs. How will it scale with increased load?

3. Create an Mbean which creates SSHClient on startup. On every onMessage() method, i will call mBean method which open sftpChannel and downloads file. Since mBean is single threaded then i can close / reconnect ssh client after n files download or reconnect in case of connection failure. I do not have to deal with multi threaded program. But i am thinking it may affect performance ?

Please share your thoughts on using j2SSH library?

Thanks and Regards
Chetan

PS Excuse me for posting same question in IO Streams forum as well.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

chetan agg wrote:PS Excuse me for posting same question in IO Streams forum as well.

You know you are doing something wrong or you wouldn't have apologized. And you're right too. So why do you still do it?

Anyway, no need (or possibility) to reply because this thread is now closed.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using J2SSH With MDBs
 
Similar Threads
Can't connect to ssh server using jsch or sshtools -- OpenSSL misconfiguration or coding error?
MDB state
Using J2SSH
J2SSH or SSHTools -- control does not return
ejb Stateless SessionBean send JMS msg's