Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.programmer Subject: Re: single instance Date: Wed, 16 Jan 2013 08:45:53 -0800 Organization: A noiseless patient Spider Lines: 28 Message-ID: References: <50e8eb1f$0$284$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 16 Jan 2013 16:45:53 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="9b3fcb0d22708969e4dc99e7aa0ef1f9"; logging-data="536"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18RDzBXZ9xehy+ln+KNITJx" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: Cancel-Lock: sha1:FjHHDBV8pX/VWyqs32JfmzIi95M= Xref: csiph.com comp.lang.java.programmer:21438 On 1/15/2013 10:51 PM, Roedy Green wrote: > On Sat, 05 Jan 2013 19:49:08 -0800, Knute Johnson > wrote, quoted or indirectly quoted someone > who said : > >> >> The risk is, that in Windows anyway, where the system clock granularity >> is 17ms it is possible to start two copies of a program with a batch > > I have been studying Knute's code and Peter's commentary hoping to > come up with a canned package for ensuring single Instance. > > Using system.nanotime aught to help avoid granularity trouble. The problem with nanotime is that it is not guaranteed to use the same starting point on different invocations of the VM. The granularity of currentTimeMillis in Windows is large but not on Linux. > I am puzzled about "227.228.229.230" the IP used. Where did that > value come from? Can this be made to work with IPV6? Arbitrary choice by me of a valid Multicast IP. I don't know any reason why it would not work with IPV6 but I've never seen any discussion of it. -- Knute Johnson