How to stop a java program if it is determined it should not run? -
if want check if preconditions nowadays in order run java programme best? do: system.exit(1);
or throw runtimeexception
in main
end main thread? (no other threads running yet)
ideally terminate threads gracefully. system.exit(1)
works too, improve if threads signalled need stop they're doing , terminate finishing they're doing (i.e. executing method till end). depends on design obviously.
throwing runtimeexception
seems ungraceful , lead behaviour don't want.
java
No comments:
Post a Comment