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

How to add admob dependencies on gradle Libgdx?
Selenium-Unable to locate element using xpath for div class
java.util.regex.PatternSyntaxException: Unclosed character class near index 57
android studio - login register with php mysql (server connection failed)
how to use scrollview inside a fragment in tab activity?
Arraylist element index before and after Collections.shuffle in java
Mysterious JavaFx fillPolygon rendering bug
The Quartz API version is not recognized in Java project
Java UncaughtExceptionHandler haven't got any exception using JNI
Pdf content is not rendering correctly after redaction applied using itext5
ERROR: User lacks privilege or object not found HSQLDB
Get current Date without time on CN1
sending multiple row data (table) from HTML to Spring controller using thymeleaf
How to use Firebase with Spring boot REST Application?
Retrieving a Json String using the correct library
Class Load trace has Multiple entries of [Loaded GregorSamsa from __JVM_DefineClass__] causing Perm gen Out Of memory

Categories

HOME
google-chrome-extension
cloud
openmp
netsuite
reserved
iot
bpmn
cplex
mean-stack
q
filtering
spring-jdbc
ckeditor
angular-ui-bootstrap
contact
kibana-4
pugjs
connection-string
visjs
php-openssl
bootstrap-duallistbox
assistant
windowbuilder
kendo-datasource
procdump
binary-data
data-manipulation
scorm2004
typed.js
android-nestedscrollview
fusionpbx
space-complexity
starteam
hilbert-curve
user-controls
eclipse-scout
jvm-languages
android-mediaprojection
nxlog
import-from-excel
thin
sas-jmp
hendrix
gabor-filter
colorama
snmptrapd
python-cryptography
imanage
jspdf-autotable
spring-mongodb
spring-cache
account-kit
eventkit
pintos
angular-cache
underscore.js-templating
blackberry-10
qgraphicsview
sdf
apachebench
wyam
rgeo
pick
google-style-guide
rdtsc
client-side-templating
fluentautomation
viadeo
xsockets.net
apc
rabl
seed
robotics-studio
funscript
online-compilation
wse3.0
fireworks
window-management
vdsp
subgurim-maps
android-sdk-2.1
dmx512
brewmp
libs
eqatec
phonon
mediarss
genealogy
windows-live-messenger

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