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


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

How do I automatically cleanly terminate a thread?

Newsgroups comp.lang.java.programmer
Date 2017-07-17 08:06 -0700
Message-ID <bca988ab-7993-4b11-866a-bc3ab62e8988@googlegroups.com> (permalink)
Subject How do I automatically cleanly terminate a thread?
From Eric Douglas <e.d.programmer@gmail.com>

Show all headers | View raw


I invoke my main test thread.
This test thread creates a new instance of TestClassOne.
TestClassOne creates a new instance of WatchService.
TestClassOne starts a new thread to sit in the background and wait indefinitely.
(https://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchService.html#take())
Main test thread loses reference to it's instance of TestClassOne (variable set to null).  Background thread keeps running.
Instance of TestClassOne should get garbage collected?  Can we automatically interrupt the background thread?

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


Thread

How do I automatically cleanly terminate a thread? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-17 08:06 -0700
  Re: How do I automatically cleanly terminate a thread? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-17 11:27 -0400
    Re: How do I automatically cleanly terminate a thread? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-17 09:03 -0700
      Re: How do I automatically cleanly terminate a thread? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-07-17 11:53 -0500
        Re: How do I automatically cleanly terminate a thread? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-17 10:05 -0700
          Re: How do I automatically cleanly terminate a thread? Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-17 18:16 +0000
            Re: How do I automatically cleanly terminate a thread? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-17 12:18 -0700
              Re: How do I automatically cleanly terminate a thread? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-17 16:05 -0400
          Re: How do I automatically cleanly terminate a thread? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-07-17 13:29 -0500
      Re: How do I automatically cleanly terminate a thread? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-17 13:05 -0400

csiph-web