Exemple #1
0
 public ConversationList() {
   readConv = new Conversation();
   hostsMap = new HashMap();
   modLong = new ModLong();
   modInt = new ModInteger();
   allConversations = new LinkedList();
   hasChanged = false;
   lockObject = new Object();
   lastTime = System.currentTimeMillis();
 }
Exemple #2
0
  private void gc() {
    if (gcTime == -1) {
      return;
    }

    long curTime = System.currentTimeMillis();

    if ((curTime - lastTime) > gcTime) {
      int collected = 0;
      lastTime = curTime;

      Conversation[] cons = getArray();
      for (int i = 0; i < cons.length; i++) {
        Conversation c = cons[i];

        long l = c.getLastActive();
        if ((curTime - l) > convTime) {
          collected++;
          removeConversation(c.getRmt_ip(), c.getLcl_port(), c.getRmt_port());
        }
      }
    }
  }