<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Java Daemon</title>
	<atom:link href="http://barelyenough.org/blog/2005/03/java-daemon/feed/" rel="self" type="application/rss+xml" />
	<link>http://barelyenough.org/blog/2005/03/java-daemon/</link>
	<description></description>
	<lastBuildDate>Mon, 08 Mar 2010 17:12:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jeremy Brooks</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-79885</link>
		<dc:creator>Jeremy Brooks</dc:creator>
		<pubDate>Tue, 19 Jan 2010 17:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-79885</guid>
		<description>&lt;p&gt;Sorry, forgot to include my solution for capturing stderr/stdout when needed:&lt;/p&gt;

&lt;p&gt;if (System.getProperty(&quot;detach&quot;).equals(&quot;false&quot;)) {
  // Log message about no detach or something
} else {
  System.in.close();
  System.out.close();
  System.err.close();
}&lt;/p&gt;

&lt;p&gt;Now if you are getting weird crashes and expect that you may have an out of memory error or something that is getting printed to stderr, just include the -Ddetach=false system property in your startup command. When you have captured the information you need, remove the system property, or set it to anything other than false, and your program will detach as expected.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Sorry, forgot to include my solution for capturing stderr/stdout when needed:</p>
<p>if (System.getProperty(&#8220;detach&#8221;).equals(&#8220;false&#8221;)) {<br />
  // Log message about no detach or something<br />
} else {<br />
  System.in.close();<br />
  System.out.close();<br />
  System.err.close();<br />
}</p>
<p>Now if you are getting weird crashes and expect that you may have an out of memory error or something that is getting printed to stderr, just include the -Ddetach=false system property in your startup command. When you have captured the information you need, remove the system property, or set it to anything other than false, and your program will detach as expected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Brooks</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-79884</link>
		<dc:creator>Jeremy Brooks</dc:creator>
		<pubDate>Tue, 19 Jan 2010 17:07:14 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-79884</guid>
		<description>&lt;p&gt;Good post. The only downside I can see here is that you might miss errors that are dumped to stdout/stderr, for example out of memory errors.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Good post. The only downside I can see here is that you might miss errors that are dumped to stdout/stderr, for example out of memory errors.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sachin Jain</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-79761</link>
		<dc:creator>Sachin Jain</dc:creator>
		<pubDate>Mon, 11 Jan 2010 14:22:37 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-79761</guid>
		<description>&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;I am using a client server program for my project. The problem that i am having is that i run the server in the background. It runs perfectly but after some time say 10-12 days even though the program is running which I can see by using the Unix command ps- u project, there is no response from the server. Please can any one tel me what the problem is????. The command that I am using to run the server in the background is :&lt;/p&gt;

&lt;p&gt;nohup command 2&gt;/dev/null 1&gt;/dev/null &amp;&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I am using a client server program for my project. The problem that i am having is that i run the server in the background. It runs perfectly but after some time say 10-12 days even though the program is running which I can see by using the Unix command ps- u project, there is no response from the server. Please can any one tel me what the problem is????. The command that I am using to run the server in the background is :</p>
<p>nohup command 2&gt;/dev/null 1&gt;/dev/null &amp;</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: basu008</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-78740</link>
		<dc:creator>basu008</dc:creator>
		<pubDate>Sun, 06 Dec 2009 12:49:18 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-78740</guid>
		<description>&lt;p&gt;Awesome post. Helped me understand all the nuances of daemoning a java class&lt;/p&gt;

&lt;p&gt;thanks&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Awesome post. Helped me understand all the nuances of daemoning a java class</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank O'Gorman</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-76453</link>
		<dc:creator>Frank O'Gorman</dc:creator>
		<pubDate>Wed, 09 Sep 2009 14:00:07 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-76453</guid>
		<description>&lt;p&gt;Hi Peter&lt;/p&gt;

&lt;p&gt;I don&#039;t know what shell or terminal you are using, but with bash and a standard xterm closing System.in, System.out and System.err makes no difference to whether a hangup signal is sent to the java process.&lt;/p&gt;

&lt;p&gt;Closing the xterm by clicking the X button causes a hangup signal to be sent. Closing the xterm by typing &#039;exit&#039; or cntrl-D does NOT cause a hangup to be sent. In neither case does closing the input/output make any difference to the behaviour.&lt;/p&gt;

&lt;p&gt;Do you have something other than the hangup signal in mind when you say that the &quot;shell will not kill the program&quot;?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Peter</p>
<p>I don&#8217;t know what shell or terminal you are using, but with bash and a standard xterm closing System.in, System.out and System.err makes no difference to whether a hangup signal is sent to the java process.</p>
<p>Closing the xterm by clicking the X button causes a hangup signal to be sent. Closing the xterm by typing &#8216;exit&#8217; or cntrl-D does NOT cause a hangup to be sent. In neither case does closing the input/output make any difference to the behaviour.</p>
<p>Do you have something other than the hangup signal in mind when you say that the &#8220;shell will not kill the program&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arun</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-76230</link>
		<dc:creator>Arun</dc:creator>
		<pubDate>Wed, 02 Sep 2009 18:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-76230</guid>
		<description>&lt;p&gt;Peter - Thanks for the tutorial. Very helpful. Here is a missing piece for others.&lt;/p&gt;

&lt;p&gt;static public File getPidFile () 
    { 
        return new File(System.getProperty(&quot;daemon.pidfile&quot;)); 
    }&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Peter &#8211; Thanks for the tutorial. Very helpful. Here is a missing piece for others.</p>
<p>static public File getPidFile ()<br />
    {<br />
        return new File(System.getProperty(&#8220;daemon.pidfile&#8221;));<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raymond Marfurt</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-75248</link>
		<dc:creator>Raymond Marfurt</dc:creator>
		<pubDate>Wed, 05 Aug 2009 12:41:16 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-75248</guid>
		<description>&lt;p&gt;I forgot to mention: while the system is up and running, I can still perfectly start/stop my daemon.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I forgot to mention: while the system is up and running, I can still perfectly start/stop my daemon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raymond Marfurt</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-75247</link>
		<dc:creator>Raymond Marfurt</dc:creator>
		<pubDate>Wed, 05 Aug 2009 12:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-75247</guid>
		<description>&lt;p&gt;Hi Peter,&lt;/p&gt;

&lt;p&gt;I have used your method for years without any problems - thanks so far!!&lt;/p&gt;

&lt;p&gt;Since the latest ubuntu update, the daemon does not start correctly when booting. The daemon starts (I get my log entries, the java app works fine), but then gets terminated after 5 secs.&lt;/p&gt;

&lt;p&gt;I don&#039;t see any information in a log file. Do you have any hint how to analyse this?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Peter,</p>
<p>I have used your method for years without any problems &#8211; thanks so far!!</p>
<p>Since the latest ubuntu update, the daemon does not start correctly when booting. The daemon starts (I get my log entries, the java app works fine), but then gets terminated after 5 secs.</p>
<p>I don&#8217;t see any information in a log file. Do you have any hint how to analyse this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raman</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-73837</link>
		<dc:creator>Raman</dc:creator>
		<pubDate>Thu, 25 Jun 2009 22:06:34 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-73837</guid>
		<description>&lt;p&gt;Hi Peter,
    I&#039;m using ur daemon. But I founf a very big flaw in this code ....Since the loop is forever true, if I restart the database in between, it goes to exception block &amp; then starts logging error to log file. In couple of seconds, the log files goes HUGE &amp; finally 0 disk space!!!&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;while(true) is a BAD idea.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Any suggestion for this problem???&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Peter,<br />
    I&#8217;m using ur daemon. But I founf a very big flaw in this code &#8230;.Since the loop is forever true, if I restart the database in between, it goes to exception block &amp; then starts logging error to log file. In couple of seconds, the log files goes HUGE &amp; finally 0 disk space!!!</p>
<pre><code>while(true) is a BAD idea.
</code></pre>
<p>Any suggestion for this problem???</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daemonize a java process &#187; qwerpo</title>
		<link>http://barelyenough.org/blog/2005/03/java-daemon/comment-page-2/#comment-72883</link>
		<dc:creator>Daemonize a java process &#187; qwerpo</dc:creator>
		<pubDate>Wed, 03 Jun 2009 15:30:26 +0000</pubDate>
		<guid isPermaLink="false">http://pezra.barelyenough.org/wordpress/?p=74#comment-72883</guid>
		<description>&lt;p&gt;[...] Found this nice article about daemonizing a Java process. [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Found this nice article about daemonizing a Java process. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
