technoparkcorp
asked on
How do I organize my routine server software?
My software in Java 1.6 is a sort of crawler, going through the database and making certain calculations, in an endless loop. The calculations are of different types and organized as a collection of classes.
The question is - how do I deploy this application to the server? As a standalone application executed just once from command line and running endlessly (I don't like this approach), or with some application server? Please, give me a general advise.
The question is - how do I deploy this application to the server? As a standalone application executed just once from command line and running endlessly (I don't like this approach), or with some application server? Please, give me a general advise.
An endless process on the database doesn't have to do anything with a server,
unless the access to the database is server-controlled.
So your process can be stand-alone (background) or client.
On most O.S.'s you can automate the start-up of such a process from
the system start-up, un-related to any login.
If however it needs survey and possible re-start, it's better
to have it run from an operator login-account.
It all depends on the nature of the process.
Is it critical? Do other processes depend on it's results?
;JOOP!
unless the access to the database is server-controlled.
So your process can be stand-alone (background) or client.
On most O.S.'s you can automate the start-up of such a process from
the system start-up, un-related to any login.
If however it needs survey and possible re-start, it's better
to have it run from an operator login-account.
It all depends on the nature of the process.
Is it critical? Do other processes depend on it's results?
;JOOP!
ASKER
My main concern is multi-threading in the software. Classes should be executed concurrently and I need to have like 50-100 concurrent threads/processes. If I do it manually inside the application, I will have a big headache with organizing all this.
It's much better to rely to some application server (Tomcat?), instead of manage this threading inside Java.
This application is NOT client-oriented, just a server side calculation. No GUI. And it's Linux, not Windows.
It's much better to rely to some application server (Tomcat?), instead of manage this threading inside Java.
This application is NOT client-oriented, just a server side calculation. No GUI. And it's Linux, not Windows.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
technically Tomcat is a web server, but can be used as application server, depends on how you use it.
The following links might help.
http://www.javaworld.com/javaworld/jw-01-2008/jw-01-tomcat6.html
http://www.oracle.com/webapps/online-help/jdeveloper/10.1.3?topic=j2ee_ptomcatdeploy_html.
Regarding the job scheduling, I need to do some more research on how to do that in Linux. (Sort of replicating the windows based service in linux).
The following links might help.
http://www.javaworld.com/javaworld/jw-01-2008/jw-01-tomcat6.html
http://www.oracle.com/webapps/online-help/jdeveloper/10.1.3?topic=j2ee_ptomcatdeploy_html.
Regarding the job scheduling, I need to do some more research on how to do that in Linux. (Sort of replicating the windows based service in linux).
The main difference between LINUX and MSWINDOWS with threads is that threads on LINUX show up as if those were individual tasks/programs that only share
some addressing space.
That means that priorities can be fine-tuned and thread behavior can be monitored
on the outside (by ps or top).
;JOOP!
some addressing space.
That means that priorities can be fine-tuned and thread behavior can be monitored
on the outside (by ps or top).
;JOOP!
P.S.: in the past I kept all threads in an
ArrayList<Thread> activeThreads;
and made the 'run()' just before termination move the thread to
ArrayList<Thread> terminatedThreads;
in order to have their status and result sets accessed from a monitor thread.
;JOOP!
ArrayList<Thread> activeThreads;
and made the 'run()' just before termination move the thread to
ArrayList<Thread> terminatedThreads;
in order to have their status and result sets accessed from a monitor thread.
;JOOP!
ASKER
This 'threading' sounds like a very straight-forward solutions, which will lead to big problems later. I will have to think about this threading and about stability of the application in general... I don't like this idea.
I think that some application server may do this work for me. Maybe I need EJB here?
I think that some application server may do this work for me. Maybe I need EJB here?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>> about stability of the application in general... I don't like this idea.
Where does this idea come from?
A multi-threaded application will be more stable than a single-threaded
application that must loop through many tasks.
;JOOP!
Where does this idea come from?
A multi-threaded application will be more stable than a single-threaded
application that must loop through many tasks.
;JOOP!
The following two links have articles/tutorials about how one can make services for Java Apps.
http://www.devx.com/Java/Article/34438
http://www.advancedinstaller.com/user-guide/tutorial-java-service.html