@Override
  public void setup(HttpURLConnection connection) {
    if (!hostsDefined) {
      String hostList = connection.getHeaderField(X_HOST_LIST_FIELD);
      if (hostList != null) {

        List<FailoverServer> servers = failoverServerFactory.buildFailoverServers(hostList);

        if (servers != null && !servers.isEmpty()) {
          bitcoinUrlFactory.pushFailoverDecoratorFactory(
              new FailoverServerSwitcherDecorator(servers));
          output.notification("Failover Servers Extension: Enabled");
          for (FailoverServer failoverServer : servers) {
            output.verbose("Added Server: " + failoverServer.toString());
          }
          hostsDefined = true;
        }
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public void check(MinerResult result, Work work) {
    result.getEvent().waitFor();
    IntBuffer buffer = result.getBuffer();
    try {
      clIntBufferPool.returnObject(result.getClBuffer());

      if (buffer.get(bufferSize - 1) > 0) {
        for (int i = 0; i < bufferSize - 1; i++) {
          if (buffer.get(i) > 0) {
            this.output.verbose("Found Hash, proceeding to local verification");
            verifyHash.verify(work, buffer.get(i));
          }
        }
      }
      resultPool.returnObject(result);
      intBufferPool.returnObject(buffer);
    } catch (Exception e) {
      output.error(e);
    }
  }