Ejemplo n.º 1
0
  public static void main(String[] args) {
    // TODO Auto-generated method stub

    ExpiryCache<String, String> emap = new ExpiryCache<String, String>();
    emap.put("abc", "xyz");
    emap.put("abc1", "xyz1");

    TestSync ts = new TestSync(emap);
    ts.runThreads();
    emap.getExpire().startExpiringIfNotStarted();
    T3 th = new T3(emap);
    th.stTh();
  }
Ejemplo n.º 2
0
  @Override
  public void run() {
    // TODO Auto-generated method stub
    for (int i = 0; i < 10000; i++) {
      if (Thread.currentThread().getName().equalsIgnoreCase("t1"))
        cache.put("keyt1" + i, "valuet1" + i);
      else cache.put("keyt2" + i, "valuet2" + i);

      try {
        Thread.sleep(10);
      } catch (InterruptedException e) {
      }
    }
  }
Ejemplo n.º 3
0
  @Override
  public void run() {
    // TODO Auto-generated method stub
    for (int i = 0; i < 100; i++) {
      System.out.println(cache.get("keyt1" + i));
      System.out.println(cache.get("keyt2" + i));

      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }