commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas De Loof <nicolas.del...@capgemini.com>
Subject [collection] can I avoid synchronized using a ReferenceMap ?
Date Fri, 10 Jun 2005 08:10:08 GMT

Hello,

I'm building an UDP based integration service. Each 'client' sends a 
query on UDP socket and waits for the response. A thread receives all 
responses and dispatch to clients.

My current implementation uses an object that is used as message 
CorrelationId.
When sending a message, the client adds its messageId object into a 
shared map. After sending it's message, it does an 'messageId.wait()'.
The receive thread lookup the map for received id and calls notifyAll() 
on the associated messageId Object. The client is unlocked and can 
process response.

I'd like to avoid using a synchronized map, and I've read in 
commons-collection javadoc about the ReferenceMap. Could it be used for 
this ?
If I've understood how it works, I'm not required to remove my MessageId 
objects from the map, and they will be removed when garbage collector 
finalize my MessageId (after the UDP response has been processed).

Any suggestion is welcome.

Nico.




This message contains information that may be privileged or confidential and is the property
of the Capgemini Group. It is intended only for the person to whom it is addressed. If you
are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,
 distribute, or use this message or any part thereof. If you receive this  message in error,
please notify the sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message