Package org.apache.hadoop.oncrpc.RpcCallCache

Examples of org.apache.hadoop.oncrpc.RpcCallCache.CacheEntry


    }
   
    // Check for duplicate requests in the cache for non-idempotent requests
    boolean idempotent = rpcCallCache != null && !isIdempotent(rpcCall);
    if (idempotent) {
      CacheEntry entry = rpcCallCache.checkOrAddToCache(client, rpcCall.getXid());
      if (entry != null) { // in ache
        if (entry.isCompleted()) {
          LOG.info("Sending the cached reply to retransmitted request "
              + rpcCall.getXid());
          return entry.getResponse();
        } else { // else request is in progress
          LOG.info("Retransmitted request, transaction still in progress "
              + rpcCall.getXid());
          // TODO: ignore the request?
        }
View Full Code Here


    InetAddress clientIp = InetAddress.getByName("1.1.1.1");
    int xid = 100;
   
    // Ensure null is returned when there is no entry in the cache
    // An entry is added to indicate the request is in progress
    CacheEntry e = cache.checkOrAddToCache(clientIp, xid);
    assertNull(e);
    e = cache.checkOrAddToCache(clientIp, xid);
    validateInprogressCacheEntry(e);
   
    // Set call as completed
View Full Code Here

    assertEquals(response, c.getResponse());
  }
 
  @Test
  public void testCacheEntry() {
    CacheEntry c = new CacheEntry();
    validateInprogressCacheEntry(c);
    assertTrue(c.isInProgress());
    assertFalse(c.isCompleted());
    assertNull(c.getResponse());
   
    XDR response = new XDR();
    c.setResponse(response);
    validateCompletedCacheEntry(c, response);
  }
View Full Code Here

            key.getClientId());
      }
     
      // Ensure cache entries are returned as in progress.
      for (int i = 0; i < size; i++) {
        CacheEntry e = cache.checkOrAddToCache(
            InetAddress.getByName("1.1.1." + (startEntry + i)), 0);
        assertNotNull(e);
        assertTrue(e.isInProgress());
        assertFalse(e.isCompleted());
      }
    }
  }
View Full Code Here

    InetAddress clientIp = InetAddress.getByName("1.1.1.1");
    int xid = 100;
   
    // Ensure null is returned when there is no entry in the cache
    // An entry is added to indicate the request is in progress
    CacheEntry e = cache.checkOrAddToCache(clientIp, xid);
    assertNull(e);
    e = cache.checkOrAddToCache(clientIp, xid);
    validateInprogressCacheEntry(e);
   
    // Set call as completed
View Full Code Here

    assertEquals(response, c.getResponse());
  }
 
  @Test
  public void testCacheEntry() {
    CacheEntry c = new CacheEntry();
    validateInprogressCacheEntry(c);
    assertTrue(c.isInProgress());
    assertFalse(c.isCompleted());
    assertNull(c.getResponse());
   
    RpcResponse response = mock(RpcResponse.class);
    c.setResponse(response);
    validateCompletedCacheEntry(c, response);
  }
View Full Code Here

            key.getClientId());
      }
     
      // Ensure cache entries are returned as in progress.
      for (int i = 0; i < size; i++) {
        CacheEntry e = cache.checkOrAddToCache(
            InetAddress.getByName("1.1.1." + (startEntry + i)), 0);
        assertNotNull(e);
        assertTrue(e.isInProgress());
        assertFalse(e.isCompleted());
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.oncrpc.RpcCallCache.CacheEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.