java - What is considered as good practice to terminate a program, if starting requirements are not met -


i have initializing thread in application, aggregates , sequentially runs several subthreads (check necessary directories, check if xml files available, etc). want program safely terminate, if requierements not met.

what approach should used here?

  • should each subthread terminate program, if finds requirements not met (e.g. in java system.exit(0);) think that's not practice.

  • another idea have each thread sets boolean in global map. map checked after initialzing thread (but problem if subthread 2 depends on subthread 1). benefit application terminate 'softly'

question

so, considered practice terminate program (smaller-medium project 6 kloc), if starting requirements not met. concept should include (at least) possibility of printing detailed error messages.


since question broad. i'm limiting java reduce it's broadness. make more complex i'd happy concepts include parallelism.

it kind of depends per language, suppose way run pre-check program checks if ok. @ end generates answer, , if answer yes main program run. in other words, pre-check calls main program.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -