Package com.sissi.server.exchange

Examples of com.sissi.server.exchange.Exchanger


  @Override
  public Exchanger activate(String host) {
    if (MongoUtils.success(this.config.collection().remove(this.build(host, false), WriteConcern.SAFE))) {
      // Double check 4 multi thread
      Exchanger exchanger = this.exchangers.remove(host);
      return exchanger != null ? exchanger : new NothingExchanger(host);
    }
    return new NothingExchanger(host);
  }
View Full Code Here


    }

    private Timeout timeout() {
      try (DBCursor cursor = BridgeExchangerContext.this.config.collection().find(BasicDBObjectBuilder.start(BridgeExchangerContext.this.date, BasicDBObjectBuilder.start("$lt", System.currentTimeMillis() - BridgeExchangerContext.this.timeout).get()).get(), BridgeExchangerContext.this.filter)) {
        while (cursor.hasNext()) {
          Exchanger exchanger = BridgeExchangerContext.this.activate(MongoUtils.asString(DBObject.class.cast(cursor.next()), Dictionary.FIELD_HOST));
          // Double check 4 multi thread
          if (exchanger != null) {
            BridgeExchangerContext.this.log.warn("Timeout socks: " + exchanger.host());
            exchanger.close(Terminal.ALL);
          }
        }
      }
      return this;
    }
View Full Code Here

TOP

Related Classes of com.sissi.server.exchange.Exchanger

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.