java


what does shutdown() really do


From javadoc
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down.
That is, calling execute() after shutdown() is an error. Sometimes I consider calling shutdown() a rule. Is it just used to forbid new tasks? Without calling shutdown(), what happens?
Mostly it is used to shutdown the ExecutorService i.e. stop it running when you don't need it.
ExecutorServices contain a pool of threads. Threads are never cleaned up by the GC so you can't just discard them and assume the threads will clean themselves up. Once the threads have been told to stop they will do so after they complete the current task or almost immediately if otherwise idle. After they have stopped they can be cleaned up by the GC
NOTE: Any ThreadLocal values will be retained until the Thread is cleaned up.
The shutdown() method prevents clients to send more work to the executor service i.e no new tasks will be accepted and all the existing tasks will still run to completion unless other actions are taken.Invocation has no additional effect if already shut down
The shutdown method (in short)
starts all tasks, that may be submitted, but not yet started (which could be of type Future<E> for example)
forbids submitting new tasks
makes it possible to gracefully shut down

Related Links

Can't get users from roster (Smack)
Infinispan size eviction + diskStore overflow
DecimalFormat - keep all decimal numbers
Migrating existing jersey postgres app to spring boot
From BNF-like grammer to Java or C++
Can someone help me for convert this c# recursive function to java [closed]
Azure Table Store etag
how to extract private key from .p12 file using java sun security
GestureListener is not recognized
Run remote java code locally
How do i display different fxml files on a stage for scene builder? Switching scene?
Reading data from a txt file in Java, using a specific character to be the end point of each iteration
java.lang.IllegalStateException: Cannot set modality once stage has been set visible
java.lang.reflect.field getText when field is JTextfield
How to display toolbar transparent in parallax android
Get the current version number of `tzdata`

Categories

HOME
maven
ms-access
java
twitter
variables
hive
cookies
image-processing
mediawiki
heroku
hp-exstream
read-eval-print-loop
android-4.4-kitkat
routes
kalman-filter
spring-jdbc
jsrender
enterprise-library-5
indesign
ios-charts
gorm
metatrader4
nano-server
timeout
size
serilog
karma-jasmine
css-animations
mmap
wijmo
blazemeter
angular2-aot
smb
qhull
pepper
xacml
wtx
newline
gsmcomm
srcset
madlib
openoffice.org
stacked
lto
az-application-insights
optix
http-live-streaming
outlook-api
modelmapper
skeleton-css-boilerplate
youcompleteme
filepicker
revapi
promela
pnotify
python-webbrowser
sage-one
gcsfuse
sqldf
spring-cache
or-tools
mediaelement
topbeat
migradoc
google-cdn
slicknav
fuzzy-search
disque
prettytensor
actionbardrawertoggle
superstack
bluegiga
ipconfig
freedesktop.org
iis-arr
computer-algebra-systems
browser-bugs
generic-programming
graph-api-explorer
nsmutabledictionary
clicktag
php-5.4
terminfo
castle
didselectrowatindexpath
terminal-services
uv-mapping
spring-validator
wsdl-2.0
itmstransporter
first-responder
ocx
semantic-diff
gwt-ext
external-accessory
f#-powerpack
horizontal-accordion
celltable
preference
rescale
perfect-hash
data-driven
ctp4
sustainable-pace
pascal-fc

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App