I am creating a servlet.Filter implementation in which I look up the user ID in the database based on the IP address before sending the request to the servlet.
I want my filter to place incoming requests in a map-like object if there is already a request from the same IP address that is being viewed in the database. Then, when I receive a response from the database, I will apply it to all requests to this IP address and send them along the path to the servlet.
A map-like object must be synchronized, but it also maintains the insertion order, so that as soon as I find the user ID, all the requested "requests will be processed in the order in which they were received."
Within the framework of the API, there is a LinkedHashMap that will keep order in order, but not in sync, the HashTable sync, but does not give any indication that it will maintain the correct order.
Is there any LinkedHashTable object that I can use for this?
I am using Java 6.
source share