Solved

How do I organize my routine server software?

Posted on 2008-06-22
11
193 Views
Last Modified: 2010-03-30
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.
0
Comment
Question by:technoparkcorp
  • 5
  • 3
  • 2
11 Comments
 
LVL 7

Expert Comment

by:humanonomics
ID: 21841267
The best I see it, is creating a service for your java app, I presume that your application is for windows only.

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
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 21841269
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!
0
 

Author Comment

by:technoparkcorp
ID: 21841376
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.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 24

Accepted Solution

by:
sciuriware earned 250 total points
ID: 21841416
Let JAVA do the threading.
Just split-off a thread per task.
In 2004 I had some process that was not endless, but ran over days that had to contain
some 50-100 threads that were fed to it on the run and all I had to do
is create the environment and 'spawn' the thread-workers.
The only concern is, with ending processes: what to do to signal a supervising
process that keeps track of the whole task.

In your case you only need to check of no thread crashes.
That means that the 'run' of every thread must catch all Exception types
and report them, in order to prevent termination of the application.

;JOOP!
0
 
LVL 7

Expert Comment

by:humanonomics
ID: 21841428
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).
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 21841467
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!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 21841483
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!

0
 

Author Comment

by:technoparkcorp
ID: 21841502
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?
0
 
LVL 7

Assisted Solution

by:humanonomics
humanonomics earned 250 total points
ID: 21843044
You don't need EJB in here, its for the web based applications, use of EJBs will just complicate things.

Just use Plain Java, that should work fine for you.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 21843497
>>> 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!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
thymeleaf natural templating vs JSP 2 98
javap bin 2 34
Java exception bubble up 2 18
String array comparison 4 33
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question