Package org.km3net.clb.remote.msg
Class ResponseCache
- java.lang.Object
-
- org.km3net.clb.remote.msg.ResponseCache
-
public class ResponseCache extends java.lang.Object
ResponseCache tracks response objects created when a command is invoked. When the reply is ready, the Control uses this cache to add the value to the response object.
-
-
Constructor Summary
Constructors Constructor Description ResponseCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Response<?> resp)
Add a response to the cache.Response<?>
byId(int id)
Returns a response by its Id, if available.void
cleanCache()
void
close()
Closes the response cache.void
remove(Response<?> resp)
Removes a response from the cache.int
size()
-
-
-
Method Detail
-
cleanCache
public void cleanCache()
-
add
public void add(Response<?> resp)
Add a response to the cache. If an response with the same ID exist, it will be notified lost.- Parameters:
resp
- the response.
-
remove
public void remove(Response<?> resp)
Removes a response from the cache. Usually this is because the response was completed.- Parameters:
resp
- The response to remove.
-
byId
public Response<?> byId(int id)
Returns a response by its Id, if available.- Parameters:
id
- The response ID.- Returns:
- The response object, if it is still available.
-
size
public int size()
-
close
public void close()
Closes the response cache.
-
-