org.apache.hadoop.oncrpc
Class RpcCallCache

java.lang.Object
  extended by org.apache.hadoop.oncrpc.RpcCallCache

public class RpcCallCache
extends Object

This class is used for handling the duplicate non-idempotenty Rpc calls. A non-idempotent request is processed as follows:


A request is identified by the client ID (address of the client) and transaction ID (xid) from the Rpc call.


Nested Class Summary
static class RpcCallCache.CacheEntry
           
static class RpcCallCache.ClientRequest
          Call that is used to track a client in the RpcCallCache
 
Constructor Summary
RpcCallCache(String program, int maxEntries)
           
 
Method Summary
 void callCompleted(InetAddress clientId, int xid, XDR response)
          Mark a request as completed and add corresponding response to the cache
 RpcCallCache.CacheEntry checkOrAddToCache(InetAddress clientId, int xid)
          Check the cache for an entry.
 String getProgram()
          Return the program name
 Iterator<Map.Entry<RpcCallCache.ClientRequest,RpcCallCache.CacheEntry>> iterator()
          Iterator to the cache entries
 int size()
          Return number of cached entries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RpcCallCache

public RpcCallCache(String program,
                    int maxEntries)
Method Detail

getProgram

public String getProgram()
Return the program name


callCompleted

public void callCompleted(InetAddress clientId,
                          int xid,
                          XDR response)
Mark a request as completed and add corresponding response to the cache


checkOrAddToCache

public RpcCallCache.CacheEntry checkOrAddToCache(InetAddress clientId,
                                                 int xid)
Check the cache for an entry. If it does not exist, add the request as in progress.


size

public int size()
Return number of cached entries


iterator

public Iterator<Map.Entry<RpcCallCache.ClientRequest,RpcCallCache.CacheEntry>> iterator()
Iterator to the cache entries

Returns:
iterator


Copyright © 2009 The Apache Software Foundation