Click here to Skip to main content
15,913,854 members

Comments by Abhinav_007 (Top 9 by date)

Abhinav_007 11-Feb-14 14:07pm View    
Deleted
I'm sorry for not providing a full explanation. Here is what I was trying to achieve in my project:
(1) The ChickenFarm uses a pricing model to calculate the chicken price. If the new price is lower than the previous price, it emits an event and calls the event handlers in the retailers that have subscribed to the event.
(2) A Retailer evaluates the price, generates an OrderObject (consisting of multiple values), and sends the order to the Encoder to convert the order object into a plain string.
(3) The Encoder converts the object into a string.
(4) The Encoder sends the encoded string back to the caller.
(5) The Retailer sends the encoded string to one of the free cells in the MultiCellBuffer.
(6) The ChickenFarm receives the encoded string from the MultiCellBuffer and sends the string to the Decoder for decoding.
(7) The Decoder sends the OrderObject to the ChickenFarm. The decoded object must contain the same values generated by the Retailer.
(8) The ChickenFarm creates a new thread to process the order;
(9) The OrderProcessingThread processes the order, e.g., checks the credit card number and calculates the amount.
(10) The OrderProcessingThread sends a confirmation to the retailer and prints the order.

Now, the chickenOnSale(int p) method inside Retailer class is printing the Chicken price and then releasing the no. of retailers or threadcount which is 8 in this case.
But I'm not able to figure out what is causing the semaphore exception.When I run the program, it executes for sometime and then semaphore exception is encountered. Please have a look again and give your inputs SA.
Abhinav_007 9-Feb-14 23:43pm View    
Deleted
I'm really sorry not to mention the line.
This is the line: retailSem1.Release(threadCount);
This line is under Retailer Class inside the following method: public void chickenOnSale(int p)
Semaphore is used to check the threadcount variable which in turn is the allocated buffer space. Please see the main for the initialized value.
Thanks
Abhinav_007 31-Mar-13 3:49am View    
Tried that too. Same result. The page is just getting refreshed again and again. Is the toolkit that I'm using is proper or not??
Abhinav_007 21-Mar-13 8:29am View    
Sir, actually i'll be inputting source, destination and the timezone(asp radio button) and as soon as i click get direction button(asp button), It shoud show me the output.
Abhinav_007 21-Mar-13 8:21am View    
Yes sir. In the first place i'm not able to call this function using a an asp radio button in a switch case. Meaning I simply don't know how to do that.