my dog learned polymorphism*
The moose likes JSP and the fly likes blocking a ticket while booking it thru online in website Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "blocking a ticket while booking it thru online in website " Watch "blocking a ticket while booking it thru online in website " New topic
Author

blocking a ticket while booking it thru online in website

sumi sudha
Greenhorn

Joined: Jan 27, 2010
Posts: 14
Hi Friends,

I had an interview sterday. interviewer asked me a question.
A person "A" books a fligth ticket form 7 steps. while he goes to the first step, he got a message saying one seat is available. he has entered from step 1 till 7 giving his credit card details and all. the question is at the same time if another person "B" with high internet speed conn is trying to book the same ticket. that should be avoided. as soon as the person "A" starts the step 1 till he completes all the steps , none of them shud be able to access the ticket. it should be bocked by the person "A".

my answer was locking the transation from step 1to step7 at the database level. is that correct.

Can any one suggest me with the proper answer.
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
Locking the transaction will only give integrity to the process, but not necessarily the integrity to ticket count remaining. You answered it correctly, but I guess we can add a bit more of information to press the result

What I am thinking is like a temporary buffer - The moment someone passes the step1 (I guess thats where the seat availability check is done), decrement the ticket counter by one, and add one ticket to the in-process buffer (the temporary buffer, I mentioned before) - This ensures that the ticket will be available if the user successfully competes the transaction, no matter what the speed of his connection is. If the transaction fails or is aborted for some reason, you need to do the reverse of the initial process (reduce one ticket from in-process, and add one to the available... and so on)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: blocking a ticket while booking it thru online in website
 
Similar Threads
passed SCJP 1.4 96% get suggestions if u want any
Suffered at the hands of Mis-interpretation : When exactly does a ticket expire
EJBQL Exercise
could be only joke...
moussaoui attempts guilty plea