Package com.linkedin.databus.client.pub

Examples of com.linkedin.databus.client.pub.ServerInfo


    clientConfig.getContainer().getJmx().setRmiEnabled(false);
    clientConfig.getContainer().setHttpPort(10100);
    final DatabusHttpClientImpl client = new DatabusHttpClientImpl(clientConfig);

    int port = Utils.getAvailablePort(8888);
    @SuppressWarnings("unused")
    ServerInfo s1 = registerRelay(1, "relay1", new InetSocketAddress("localhost", port), "S1", client);
    final DummySuccessfulErrorCountingConsumer listener1 =
        new DummySuccessfulErrorCountingConsumer("consumer1", false);
    client.registerDatabusStreamListener(listener1 , null, "S1");
View Full Code Here


    int port = Utils.getAvailablePort(10100);
    clientConfig.getContainer().setHttpPort(0);
    final DatabusHttpClientImpl client = new DatabusHttpClientImpl(clientConfig);

    port = Utils.getAvailablePort(8898);
    @SuppressWarnings("unused")
    ServerInfo s1 = registerRelay(1, "relay1", new InetSocketAddress("localhost", port), "S1", client);
    //DummyStreamConsumer listener1 = new DummyStreamConsumer("consumer1");
    final DummySuccessfulErrorCountingConsumer listener1 =
        new DummySuccessfulErrorCountingConsumer("consumer1", true);
    client.registerDatabusStreamListener(listener1 , null, "S1");
View Full Code Here

      return;
    }

    Random rng = new Random();
    DatabusRelayConnection relayConn = null;
    ServerInfo serverInfo = null;

    int retriesLeft;
    BackoffTimer originalCounter =_status.getRetriesCounter();

    if( curState.isRelayFellOff())
      _status.setRetriesCounter(_retriesOnFallOff);

    while (null == relayConn && (retriesLeft = _status.getRetriesLeft()) >= 0 && !checkForShutdownRequest())
    {
      _log.info("picking a relay; retries left:" + retriesLeft +
                ", Backoff Timer :" + _status.getRetriesCounter() +
                ", Are we retrying because of SCNNotFoundException : " + curState.isRelayFellOff());

      backoffOnPullError();

      _curServerIdx =  (_curServerIdx < 0) ? rng.nextInt(serversNum)
                                           : (_curServerIdx + 1) % serversNum;

      Iterator<ServerInfo> setIter = _servers.iterator();
      for (int i = 0; i <= _curServerIdx; ++i) serverInfo = setIter.next();

      try
      {
        relayConn = _sourcesConn.getRelayConnFactory().createRelayConnection(
            serverInfo, this, _remoteExceptionHandler);
        _log.info("picked a relay:" + serverInfo.toSimpleString());
      }
      catch (Exception e)
      {
        _log.error("Unable to get connection to relay:" + serverInfo.toSimpleString(), e);
      }
    }

    _status.setRetriesCounter(originalCounter);

    if (!checkForShutdownRequest())
    {
      _curServer = serverInfo;

      if (null == relayConn)
      {
        if (_currentState.isRelayFellOff())
        {
          boolean enqueueMessage = false;

          try
          {
            enqueueMessage = onRelayFellOff(curState,
                              curState.getCheckpoint(),
                              new ScnNotFoundException("Retries on SCNNotFoundException exhausted !!"));
          } catch (InterruptedException ie) {
                _log.error("interrupted while processing onRelayFellOff", ie);
                curState.switchToPickServer();
                enqueueMessage(curState);
          } catch (InvalidEventException e) {
                _log.error("error trying to notify dispatcher of bootstrapping :" + e.getMessage(), e);
                curState.switchToPickServer();
                enqueueMessage(curState);
          }

          if ( enqueueMessage )
            enqueueMessage(curState);
        } else {
          // There are no retries left. Invoke an onError callback
          try
          {
            _log.info("Puller retries exhausted. Injecting an error event on dispatcher queue to invoke onError callback");
            _remoteExceptionHandler.handleException(new PullerRetriesExhaustedException());
          } catch (InterruptedException ie){
            _log.error("Interrupted while processing retries exhausted", ie);
          } catch (InvalidEventException e) {
            _log.error("Error trying to notify dispatcher of puller retries getting exhausted", e);
          }
          _log.error("Cannot find a relay");
        }
      }
      else
      {
        DatabusRelayConnection oldRelayConn = curState.getRelayConnection();

        if ( null != oldRelayConn)
        {
          resetConnectionAndSetFlag();
        }

        sendHeartbeat(_sourcesConn.getUnifiedClientStats());

        _log.info("Relay Puller switching to request sources");
        curState.switchToRequestSources(serverInfo, serverInfo.getAddress(), relayConn);
        _lastOpenConnection = relayConn;
        enqueueMessage(curState);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.linkedin.databus.client.pub.ServerInfo

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.