Thursday, 23 August 2012

Idemoptent means in Java

idempotent means u can do the same thing again and again
without any side effect
being idempotent is good
now look an example
take a shopping cart example
suppose u want to buy a book from amzon.com
u put that book in shopping cart electronically
and u have given ur bank account info earlier.
on checkout server debits from ur account
and servlet will update the database.
now think suddenly ur computer hang for 1 min
and after 1 min u didnt find any acknowledgment page
than u will click again .to
confirm ur request of book.
and wicked program again debit from ur account,
so this is the side effect.???
u want ur single request of book should
be taken seprately
get is idempotent
and post is not idempotent
hope it helps