Wikipedia defines Time as:
"Time is a measure in which events can be ordered from the past through the
present into the future, and also the measure of durations of events and the
intervals between them.Time is often referred to as the fourth dimension,
along with the three spatial dimensions."
Since Time is a natural concept, in an ideal world, dealing with it should be
simple, but unfortunately it is not the case and we humans made it more
complex by introducing different time zones and day light saving.
As a programmer, we want that programming languages immune us from these
complexity and being a Java programmer, we have similar expectations from
Java. Java tried to overcome these complexities in its first two editions of
Date and Time API, but failed measurably. A simple google will give you
numerous posts criticizing Java for this. Few years back, I was introduced... (more)
Preface:
Every Java Program can attach a shutdown hook to JVM, i.e. piece of
instructions that JVM should execute before going down.
Problem:
A program may require to execute some pieces of instructions when application
goes down. An application may go down because of several reasons:
Because all of its threads have completed execution Because of call to
System.exit() Because user hit CNTRL-C System level shutdown or User Log-Off
Few scenarios where this requirement fits are:
Saving application state, e.g. when you exits from most of the IDEs, they
remember the last view Closing some... (more)
Singleton Pattern: Am I implementing it Correctly? - Part I
... (more)