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


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

Re: Does this make sense?

Newsgroups comp.lang.java.programmer
Date 2019-04-05 11:13 -0700
References (5 earlier) <q867p2$gv3$1@gioia.aioe.org> <636ed842-3212-4955-8c81-0a48f162b6b9@googlegroups.com> <d3b02831-ee3f-4b78-a446-ecccb3d0115f@googlegroups.com> <4ce08746-597b-4aab-a53d-13aa3723b083@googlegroups.com> <4ffe145e-d766-46ad-9c6e-e794450a195c@googlegroups.com>
Message-ID <2308a448-c264-421f-bea5-557c84ae9be0@googlegroups.com> (permalink)
Subject Re: Does this make sense?
From bursejan@gmail.com

Show all headers | View raw


BTW: A close() would be also a needed option for 
java.net.Socket access that is in progress, since 
they don't react on interrupt(). Only some java.nio
 
can do it. But they just hook into the interrupt()
and install a closer... Simple check out where
this package private method of Thread is used:

    void blockedOn(Interruptible b)

I don't know whether a WatchService also installs such 
a closer while in progress. blockOn is accessed indirectly
via SharedSecrets.getJavaLangAccess in the class

AbstractInterruptibleChannel. But since the interface
of WatcherService says, WatchKey take() throws 
InterruptedException, I guess interrupt() is nevertheless

supported by a WatcherService...

On Friday, April 5, 2019 at 8:03:05 PM UTC+2, burs...@gmail.com wrote:
> Actually I don't know exactly what IDEs do,
> like for example IntelliJ. They could also follow
> other strategies, like react on active/deactive
> 
> of window, or react on terminate of a ant job
> or build job, etc.. Sometimes, if there are
> too many changes, I already notices that
> 
> some of them might not be recognized. I also
> don't know whether a watcher can report content 
> change. Ok I see OVERFLOW, events may have been 
> 
> lost, and ENTRY_MODIFY(*), entry in the directory has 
> been modified. Oki Doki, everything is there, 
> but because of OVERLOW(*) I guess a tool needs 
> 
> a fallback strategy.
> 
> Thanks, interesting!
> 
> (*)
> https://docs.oracle.com/javase/7/docs/api/java/nio/file/StandardWatchEventKinds.html
> 
> On Friday, April 5, 2019 at 7:57:13 PM UTC+2, burs...@gmail.com wrote:
> > Instead of interrupt(), you might also 
> > simply close the WatchService. It should cancel
> > WatchKeys that are in progress.
> > 
> > https://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchKey.html
> > 
> > Disclaimer: I have never used watchers. I
> > guess some IDEs use it also, to get notified
> > about changed stuff. So its quite useful...
> > 
> > On Friday, April 5, 2019 at 7:53:44 PM UTC+2, burs...@gmail.com wrote:
> > > I think you don't need an extra thread. Since
> > > Swing runs anyway in its own thread. 
> > > If you display a non-modal window, the current
> > > thread will not block. And you can perform
> > > 
> > > the for(;;) loop in the main thread itself, without
> > > starting a thread. The problem is only, how does
> > > the main thread get events from the watcher and
> > > from the window? Well the same way, via interrupt().
> > > 
> > > So the main thread can detect whether it go a
> > > watcher.take() or whether it got interrupted.
> > > And it can gracefully terminate and close also
> > > whatever resources it has opened. If some tooling
> > > 
> > > shows an error somewhere, submit a bug report.
> > > Lets see what they say...
> > > 
> > > On Friday, April 5, 2019 at 5:39:25 PM UTC+2, Eric Douglas wrote:
> > > > On Thursday, April 4, 2019 at 8:33:50 PM UTC-4, Arne Vajhøj wrote:

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


Thread

Does this make sense? Eric Douglas <e.d.programmer@gmail.com> - 2019-04-04 05:22 -0700
  Re: Does this make sense? Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-04 09:03 -0400
    Re: Does this make sense? Eric Douglas <e.d.programmer@gmail.com> - 2019-04-04 07:02 -0700
      Re: Does this make sense? Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-04 11:01 -0400
        Re: Does this make sense? Eric Douglas <e.d.programmer@gmail.com> - 2019-04-04 08:21 -0700
        Re: Does this make sense? Eric Douglas <e.d.programmer@gmail.com> - 2019-04-04 11:45 -0700
          Re: Does this make sense? Arne Vajhøj <arne@vajhoej.dk> - 2019-04-04 20:33 -0400
            Re: Does this make sense? Eric Douglas <e.d.programmer@gmail.com> - 2019-04-05 08:39 -0700
              Re: Does this make sense? Arne Vajhøj <arne@vajhoej.dk> - 2019-04-05 12:31 -0400
              Re: Does this make sense? bursejan@gmail.com - 2019-04-05 10:53 -0700
                Re: Does this make sense? bursejan@gmail.com - 2019-04-05 10:57 -0700
                Re: Does this make sense? bursejan@gmail.com - 2019-04-05 11:02 -0700
                Re: Does this make sense? bursejan@gmail.com - 2019-04-05 11:13 -0700
          Re: Does this make sense? Patrick Roemer <sangamon@netcologne.de> - 2019-04-05 17:43 +0200
            Re: Does this make sense? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-04-07 22:14 +0200
      Re: Does this make sense? Andreas Leitgeb <avl@logic.at> - 2019-04-04 15:15 +0000

csiph-web