public void removeListener(DMoteModelListener listener) {
   if (listeners == null) return;
   Iterator it = listeners.iterator();
   while (it.hasNext()) {
     if (it.next() == listener) {
       it.remove();
       return;
     }
   }
 }
Exemplo n.º 2
0
    void processSelectedKeys() throws IOException {
      for (Iterator i = sel.selectedKeys().iterator(); i.hasNext(); ) {

        SelectionKey sk = (SelectionKey) i.next();
        i.remove();

        Target t = (Target) sk.attachment();
        SocketChannel sc = (SocketChannel) sk.channel();

        try {
          if (sc.finishConnect()) {
            sk.cancel();
            t.connectFinish = System.currentTimeMillis();
            sc.close();
            printer.add(t);
          }
        } catch (IOException x) {
          sc.close();
          t.failure = x;
          printer.add(t);
        }
      }
    }