Java: Time Synchronization Trick in Programming
By admin on Oct 14, 2009 in Java, Programming
In previous article, I have written about Java Time Sync Problem. JVM time follows the CPU ticks once it is started even though the application servers are time synced with NTP.
With this in mind, if developer does not use a centralized server to retrieve the time, it would pose a problem.
Image the following scenario,
- You have 10 Java applications accessing a database server
- Each application servers have been running for some time, and the Java applications time are now few minutes apart
- 1 application inserts a record using the current time as the record effective date
- Another application retrieves the record and compare the effective date with its current time
In the above scenario, even though your application logic may sound correct, and when it is running in production environment, thing will go wrong.
Sorry, comments for this entry are closed at this time.