Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29917

Re: java unix domain sockets ... or substitute

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!weretis.net!feeder1.news.weretis.net!newsfeed.CARNet.hr!garrison.bnet.hr!gregory.BNet.hr!not-for-mail
From Josip Almasi <joe@vrspace.org>
Newsgroups comp.lang.java.programmer
Subject Re: java unix domain sockets ... or substitute
Date Fri, 05 Sep 2014 10:20:58 +0200
Organization B.net Hrvatska d.o.o.
Lines 41
Message-ID <lubrpa$d1j$1@gregory.bnet.hr> (permalink)
References <slrnm0ejqn.fp3.avl@login.logic.tuwien.ac.at> <lu95bh$8r9$1@gregory.bnet.hr> <slrnm0gbbq.fp3.avl@login.logic.tuwien.ac.at>
NNTP-Posting-Host 109.60.125.237
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace gregory.bnet.hr 1409905258 13363 109.60.125.237 (5 Sep 2014 08:20:58 GMT)
X-Complaints-To abuse@globalnet.hr
NNTP-Posting-Date Fri, 5 Sep 2014 08:20:58 +0000 (UTC)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0
In-Reply-To <slrnm0gbbq.fp3.avl@login.logic.tuwien.ac.at>
Xref csiph.com comp.lang.java.programmer:29917

Show key headers only | View raw


On 09/04/2014 11:14 AM, Andreas Leitgeb wrote:
> Josip Almasi <joe@vrspace.org> wrote:
>> IMHO domain sockets are not in java for good reason - they add little
>> value over pipes when used locally, but add complexity, as it's easier
>> to work with files/pipes than sockets.
>
> Exactly that added complexity is what I now have to mimic with pipes and
> where it ends up even more complicated than what I'd think domain sockets
> would have been.
> As a bonus, I'd be able to detect stale sockets, in case the server crashed,
> but I cannot reliably detect a stale named pipe. Accessing it will merely
> block until someone else restarts the server.

I think you can detect stale pipes, with fuser and/or lsof - they will 
not be opened by any processes.
Something like
for FILE in `find /tmp -type p`
do
   PROCCNT=`fuser $FILE | wc -w`
   if (( $PROCCNT == 1 ))
     fuser -k $FILE
   elif (( $PROCCNT == 0 ))
   then
     rm -f $FILE
   fi
done
every (couple of) minute(s).

>> With domain sockets you'd also get filesystem nodes, just not two for
>> each client, with less bookkeeping of stale nodes.
>> Then again, you also can create pipes in /tmp, and leave cleanup to system.
>
> The mean-time between reboots is rather long (think of years), so I couldn't
> just idly fill /tmp. The rate of client-connects is expected to be high
> enough that this would cause problems.

Cleaning /tmp is usually night-time cron job.
Think you only need one or two cron jobs to keep your pipes under control.
I haven't seen AIX, Solaris nor ksh in years though.

Regards...

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-03 17:26 +0000
  Re: java unix domain sockets ... or substitute Wayne <nospam@all.invalid> - 2014-09-03 13:36 -0400
    Re: java unix domain sockets ... or substitute Fredrik Jonson <fredrik@jonson.org> - 2014-09-04 07:42 +0000
    Re: java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-04 07:52 +0000
  Re: java unix domain sockets ... or substitute Josip Almasi <joe@vrspace.org> - 2014-09-04 09:45 +0200
    Re: java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-04 09:14 +0000
      Re: java unix domain sockets ... or substitute Josip Almasi <joe@vrspace.org> - 2014-09-05 10:20 +0200
  Re: java unix domain sockets ... or substitute Fredrik Jonson <fredrik@jonson.org> - 2014-09-04 08:34 +0000
    Re: java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-05 01:06 +0000
  Re: java unix domain sockets ... or substitute Nigel Wade <nmw@ion.le.ac.uk> - 2014-09-04 11:35 +0100
  Re: java unix domain sockets ... or substitute "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-09-04 15:11 +0100
    Re: java unix domain sockets ... or substitute Nigel Wade <nmw@ion.le.ac.uk> - 2014-09-04 15:57 +0100
      Re: java unix domain sockets ... or substitute "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-09-04 16:21 +0100
        Re: java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-05 10:55 +0000
  Re: java unix domain sockets ... or substitute (SOLVED) Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-05 00:53 +0000
    Re: java unix domain sockets ... or substitute (SOLVED) Josip Almasi <joe@vrspace.org> - 2014-09-05 10:23 +0200

csiph-web