Hi Eddy,
Check out the Sun
Java Concurrency Tutorial here:
http://java.sun.com/docs/books/tutorial/essential/concurrency/ It should answer your questions.
R & Herman,
Thanks again. Let me extend that example a bit in a multi-user environment. The below is based on what you suggested R.
Customer Service Agent (CSA) 1 is on the phone with Mr. Vliet
-------------------------------------------------------------
Time 0: Vliet asks CSA 1 to see what records are available for 12/31/07. Request is sent to server.
Time 2: 25 records match this date
Time 4: 25 records are read by the DB
Time 6: 25 records are sent over the wire to the Swing Client
Time 8: 25 records are populated in a JTable
Time 10: CSA 1 asks Vliet which one he wants.
Time 12: Vilet selects record X.
Time 14: CSA 1 updates the "owner" field of record X with "Vliet"
Time 16: CSA 1 sends the updated record over the wire to the server
Time 18: The server locks, verifies no other edits, and updates the record
Time 20: CSA 1 confirms that Vliet has the record.
Customer Service Agent (CSA) 2 is on the phone with Mr. Scheltinga
------------------------------------------------------------------
Time 1: Scheltinga asks CSA 2 to see what records are available for 12/31/07. Request is sent to server.
Time 3: 25 records match this date
Time 5: 25 records are read by the DB
Time 7: 25 records are sent over the wire to the Swing Client
Time 9: 25 records are populated in a JTable
Time 11: CSA 2 asks Scheltinga which one he wants.
Time 13: Scheltinga selects record X.
Time 15: CSA 2 updates the "owner" field of record X with "Scheltinga"
Time 17: CSA 2 sends the updated record over the wire to the server
Time 19: The server locks, verifies no other edits (EXCEPTION THROWN)
Time 21: CSA 2 tells Scheltinga that he needs to select a new record.
So for Mr. Scheltinga and for CSA 2 their time was wasted from Time 13 through Time 21. It would be nice if there was away to prevent this from occurring. I dunno, maybe this is too difficult to implement in this system because of the fixed interface. Or maybe this issue is unresolvable regardless of the interface due to the nature of the scarcity of the resources and the time required for human contact.
Tom
[ November 18, 2007: Message edited by: Thomas Hubschman ]
[ November 18, 2007: Message edited by: Thomas Hubschman ]