I'm just starting to study EJB, by reading the Enterprise JavaBeans 3.0 book.
Actually, I'm doing this because in the near future I plan to use this technology in my company.
Today, we have an application that accesses N FTP servers and downloads files for the N corresponding local directories. It does uploads as well. Each of the FTP servers belongs to one specific client of our company. Therefore, the app must be multithreaded. And it is. It manages multiple threads, one for each of the ftp servers it has to access. We are using the Apache FTP API for the FTP operations.
So here's my question:
- If I were to develop this application using EJB, one of the benefits it would provide me with is the multithreaded management?
Say, the code from the run methods from the threads of my application today would be passed to the EJB, which would run and manage one thread for each of the FTP configurations that I pass on to it?
- I'd like it to be a transactional system. All of the downloads and uploads are registered in a database. And right after it has abeen registered, the downloaded file is deleted from the FTP server from which it was downloaded. I'd like the file to only be deleted if it had really been downloaded and registered in the database. I believe it is a transactional behavior, right?
Today, if some exception occurs, it might happen that the file was downloaded and registered in the database, but never deleted from the FTP server. Would EJB grant me this too?
And another thing:
In a few weeks I'll need to develop a system that is specialized in sending and downloading emails. Like this FTP service I mentioned above, it will have to be a multhreaded system as well. Would it be recommendable to develop such a system by using EJB technology?