![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Aug 2006
Posts: 20
Rep Power: 0
![]() |
Threading with Hashtable class
Hi,
I'm trying to use a Hashtable object with my multi-threaded server. Basically, I have a ServerApp object that listens for client connections and when a client connects it spawns a new thread to handle the connection. The thread takes a reference to the socket object and the Hashtable object that is a member of the ServerApp object. When I try to do any operations (specifically containsKey() and put()) on the Hashtable object from the thread the program seems to hang on that line as if it is waiting for the Hashtable to be unlocked. I've tried declaring the method synchronized on the method in the thread that performs operations on the Hashtable but it seems to make no difference. According to the API, the Hashtable is already synchronized and shouldn't need that keyword but I put it in there just in case. Any help is appreciated. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Aug 2006
Posts: 20
Rep Power: 0
![]() |
I've figured out the problem. The hashtable reference was actually null and I had a catch for a general exception that did nothing inside my infinite thread loop.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wierd compile Error. Need help please. | Keiyentai | Java | 7 | Aug 19th, 2006 1:35 AM |
| Question about analyzing 6 million records | Arla | C# | 11 | Jun 22nd, 2006 3:02 PM |
| What is: "Oriented programming (OO)?" | BrinyCode | C++ | 12 | Nov 22nd, 2005 7:40 AM |
| User Input for Number Format | ericelysia1 | Java | 0 | Jul 21st, 2005 3:41 PM |
| MFC/OpenGL: problem with 'Document' class | brenda | C++ | 11 | May 23rd, 2005 8:10 PM |