[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using org.apache.service to create Java Daemons



On Fri, Jan 19, 2001 at 01:08:28AM -0800, Seth Arnold wrote:
> * Aaron Brashears <aaron@lns.com> [010118 22:27]:
> > I'm researching writing a daemon in Java. Surprisingly, there seems to
> > be very little documentation around the net for doing this.
> 
> Aaron, most of what makes daemons special is they automatically detach
> from their controlling terminal, setup init as their parent, and some
> other fun things (as outlined in Stevens' APUE).

I'm very familier with this. I just deployed a new daemon I wrote in
c++ for my work. However, this time I'm writing a more complex network
protocol translator, and since I have to write half of it in java
anyway, it would save a lot of time to write the translator in java
too.

> As I can see it, there are three approaches one could take. First, write
> a small C wrapper to do the setup work as described in Stevens that runs
> the java virtual machine with your code. Small, easy, and locates the
> platform dependent code in one place, though it does require writing
> some C.
> 
> The second approach is to use a POSIX compatibility library -- I saw one
> only two months ago, a quick trip through google should find it in a
> hurry. Then, your java code *may* be able to do most of the things
> Stevens outlines.
> 
> The third approach is to try to get the tomcat code working for your
> code. This might not be so easy, though you at least have some assurance
> that someone else managed to get it to work too, with tomcat. :)

I had mainly considered 1 and 3. However, 'posix java' is turning up
good results on google. 'java daemon programming' mostly turned up
results for the setDaemon method in Thread. I was hoping that the
tomcat code would be a good implementation of 1 that I didn't have to
write all of.



Reply to: