1 4 package com.tcclient.object; 5 6 import java.util.LinkedList ; 7 import java.util.List ; 8 9 12 public class Client { 13 private final List myEvents = new LinkedList (); 14 private long lastChecked = System.currentTimeMillis(); 15 16 public void add(DistributedMethodCall dmc) { 17 myEvents.add(dmc); 18 } 19 20 public DistributedMethodCall next() { 21 return (DistributedMethodCall) myEvents.remove(0); 22 } 23 24 public boolean isEmpty() { 25 lastChecked = System.currentTimeMillis(); 26 return myEvents.isEmpty(); 27 } 28 29 public boolean isTimedOut() { 30 return System.currentTimeMillis() - lastChecked > 60 * 1000 * 10; 31 } 32 33 public String toString() { 34 return super.toString() + "[" + myEvents + "]"; 35 } 36 } | Popular Tags |