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


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

shutdown executor service

Newsgroups comp.lang.java.programmer
Date 2014-12-04 06:42 -0800
Message-ID <2db503bb-a8ea-478a-a623-d1ac65e6dbb7@googlegroups.com> (permalink)
Subject shutdown executor service
From mike <mikaelpetterson@hotmail.com>

Show all headers | View raw


Hi,

I found the following code in our code base in the same class.


private final ExecutorService executor = Executors.newCachedThreadPool();

List<Future<T>> startExcuting() {
        try {
            return executor.invokeAll(Lists.newArrayList(tasks));
        } catch (InterruptedException e) {
            throw new AppException("startExcuting interrupted", e);
        } finally {
            tasks.clear();
           

        }
    }


My question is: Should we not have  executor.shutdown(); or threads might live longer. Is that correct?

//mike

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


Thread

shutdown executor service mike <mikaelpetterson@hotmail.com> - 2014-12-04 06:42 -0800
  Re: shutdown executor service Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-12-04 10:00 -0500

csiph-web