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

java regex selecting until string but not substring
OSGI Classloading & Object Sharing
Accessing variable from another class
Extending spring security UsernamePasswordAuthenticationFilter
Any Javadoc style documentation tool for MyBatis XML sqlmaps?
how to design query layer in CQRS
How to Achieve AspectJ “withincode” in Spring AOP
How do I make the Input Exception for this method?
Error. when trying to catch values from a arry list. and pass it to afunction to diplay markers on the map. Android
Finding the derivative of a polynomial using arrays in java
Using a dialog preference with custom layout
Oracle Database 12c in VM on Mac OSX
Stack Recursive Implementation Complexity
JPA IllegalArgumentException, but expected and actual type are identical
How to put a dynamic drop-down list in Eclipse Kepler toolbar?
What happens to MySQL connection when internet connection is lost?

Categories

HOME
testing
vim
deployment
angular-material
react-virtualized
iterator
electron
jsp-tags
filtering
twitter-bootstrap-4
ckeditor
wamp
datastax-java-driver
swagger-ui
ios-charts
portia
slick-slider
python-unittest
windows-10-universal
postgres-xl
n-gram
commonmark
tostring
flux
interop
visual-composer
textfield
one-hot-encoding
autoconf
scriptcs
intentfilter
telerik-reporting
shopware
numerical-methods
apache-commons-io
minitab
maquette
wtx
kendo-datasource
c++-amp
directx-10
preg-match-all
twilio-api
code-contracts
framemaker
azure-sql-database
bytecode-manipulation
web-mining
retina-display
swift3.0.2
abstract-class
streamsets
hilbert-curve
trim
g-code
password-encryption
gpx
azure-application-gateway
pnotify
rdfs
snmptrapd
abcpdf9
grails-tomcat-plugin
gridpane
login-control
transmitfile
google-web-starter-kit
firebaseui
gstreamer-0.10
holder.js
react-native-listview
revolution-r
two-factor-authentication
system.management
unity-networking
iad
ora-00900
rgeo
responsive-images
ami
dundas
umbraco6
dd
device-manager
code-access-security
flask-cors
typeof
jquery-layout
hippomocks
hyprlinkr
balanced-payments
algebraic-data-types
ruby-datamapper
ftps
rabl
seed
ember-app-kit
anonymous-methods
manchester-syntax
errai
hosts-file
osql
amazon-appstore
fireworks
nsobject
data-loss
subgurim-maps
celltable
xfbml
createwindow
coda-slider
getresponsestream
preference
mtj
scripting-languages
mdac

Resources

Encrypt Message