Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jun 2005 09:25:12 +0300 (EEST)
From:      Achilleus Mantzios <achill@matrix.gatewaynet.com>
To:        Ronald Klop <ronald-freebsd8@klop.yi.org>
Cc:        freebsd-java@freebsd.org
Subject:   Re: Wierd problem in linux 2.4.18-bf2.4, Java Blackdown-1.4.2-rc1 (Solved)
Message-ID:  <Pine.LNX.4.44.0506280924160.13307-100000@matrix.gatewaynet.com>
In-Reply-To: <op.ss1hxmcj8527sy@outgoing.local>

next in thread | previous in thread | raw e-mail | index | archive | help
O Ronald Klop έγραψε στις Jun 27, 2005 :

> On Mon, 27 Jun 2005 11:14:14 +0200, Achilleus Mantzios  
> <achill@matrix.gatewaynet.com> wrote:
> 
> >
> > Forgot my homework....
> > A classic (lack of) consumption of output situation,
> >
> >> From the java docs:
> >
> >  The Runtime.exec methods may not work well for special processes on
> > certain native platforms, such as native windowing processes, daemon
> > processes, Win16/DOS processes on Microsoft Windows, or shell scripts.  
> > The
> > created subprocess does not have its own terminal or console. All its
> > standard io (i.e. stdin, stdout, stderr) operations will be redirected to
> > the parent process through three streams (Process.getOutputStream(),
> > Process.getInputStream(), Process.getErrorStream()). The parent process
> > uses these streams to feed input to and get output from the subprocess.
> > Because some native platforms only provide limited buffer size for
> > standard input and output streams, failure to promptly write the input
> > stream or read the output stream of the subprocess may cause the
> > subprocess to block, and even deadlock.
> >
> >
> > Sorry for the noise, the situation can pretty well
> > occur in FreeBSD too when pipe output buffer reaches its limit,
> > and at the end of the day i think someone maybe will find this
> > useful in the future.
> 
> I always create two threads to copy the output of stdout and stderr to  
> some place. (/dev/null or a file or System.out). In java 5 you can combine  
> stdout and stderr, so you only need 1 thread.
> 

Right, altho doing 
> dev/null 2>&1
in the script itself, saves the extra code.

> 
> 
> 

-- 
-Achilleus




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0506280924160.13307-100000>