Package org.apache.hadoop.hbase.ipc

Examples of org.apache.hadoop.hbase.ipc.RpcClient$Connection


     * For tests only.
     * @param rpcClient Client we should use instead.
     * @return Previous rpcClient
     */
    RpcClient setRpcClient(final RpcClient rpcClient) {
      RpcClient oldRpcClient = this.rpcClient;
      this.rpcClient = rpcClient;
      return oldRpcClient;
    }
View Full Code Here


      // Create the chore that cleans up nonces.
      nonceManagerChore = this.nonceManager.createCleanupChore(this);
    }

    // Setup RPC client for master communication
    rpcClient = new RpcClient(conf, clusterId, new InetSocketAddress(
        this.isa.getAddress(), 0));
    this.pauseMonitor = new JvmPauseMonitor(conf);
    pauseMonitor.start();
  }
View Full Code Here

    rpcServer = new RpcServer(null, "testSecuredDelayedRpc",
        Lists.newArrayList(new RpcServer.BlockingServiceAndInterface(service, null)),
          isa, conf, new FifoRpcScheduler(conf, 1));
    rpcServer.start();
    RpcClient rpcClient = new RpcClient(conf, HConstants.DEFAULT_CLUSTER_ID.toString());
    try {
      BlockingRpcChannel channel = rpcClient.createBlockingRpcChannel(
          ServerName.valueOf(rpcServer.getListenerAddress().getHostName(),
              rpcServer.getListenerAddress().getPort(), System.currentTimeMillis()),
          User.getCurrent(), 1000);
      TestDelayedRpcProtos.TestDelayedService.BlockingInterface stub =
        TestDelayedRpcProtos.TestDelayedService.newBlockingStub(channel);
      List<Integer> results = new ArrayList<Integer>();
      TestThread th1 = new TestThread(stub, true, results);
      th1.start();
      Thread.sleep(100);
      th1.join();

      assertEquals(0xDEADBEEF, results.get(0).intValue());
    } finally {
      rpcClient.stop();
    }
  }
View Full Code Here

    Configuration conf = TEST_UTIL.getConfiguration();
    conf.set(HConstants.MASTER_PORT, "0");
    CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
    HMaster hm = new HMaster(conf, cp);
    ServerName sm = hm.getServerName();
    RpcClient rpcClient = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT);
    try {
      int i = 0;
      //retry the RPC a few times; we have seen SocketTimeoutExceptions if we
      //try to connect too soon. Retry on SocketTimeoutException.
      while (i < 20) {
        try {
          BlockingRpcChannel channel =
            rpcClient.createBlockingRpcChannel(sm, User.getCurrent(), 0);
          MasterProtos.MasterService.BlockingInterface stub =
            MasterProtos.MasterService.newBlockingStub(channel);
          stub.isMasterRunning(null, IsMasterRunningRequest.getDefaultInstance());
          fail();
        } catch (ServiceException ex) {
          IOException ie = ProtobufUtil.getRemoteException(ex);
          if (!(ie instanceof SocketTimeoutException)) {
            if (ie.getMessage().startsWith("org.apache.hadoop.hbase.ipc." +
                "ServerNotRunningYetException: Server is not running yet")) {
              // Done.  Got the exception we wanted.
              System.out.println("Expected exception: " + ie.getMessage());
              return;
            } else {
              throw ex;
            }
          } else {
            System.err.println("Got SocketTimeoutException. Will retry. ");
          }
        } catch (Throwable t) {
          fail("Unexpected throwable: " + t);
        }
        Thread.sleep(100);
        i++;
      }
      fail();
    } finally {
      rpcClient.stop();
    }
  }
View Full Code Here

    // Setup the Quota Manager
    rsQuotaManager = new RegionServerQuotaManager(this);

    // Setup RPC client for master communication
    rpcClient = new RpcClient(conf, clusterId, new InetSocketAddress(
      rpcServices.isa.getAddress(), 0));

    int storefileRefreshPeriod = conf.getInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD
      , StorefileRefresherChore.DEFAULT_REGIONSERVER_STOREFILE_REFRESH_PERIOD);
    if (storefileRefreshPeriod > 0) {
View Full Code Here

    private void connectionClosed() {
        if(! reconnect.get()) {
            return; // Nothing to do
        }
        // Wait until the connection is closed before reconnecting
        final Connection connection = this.connection;
        if(connection != null) {
            if(channel == null) {
                connection.closeAsync();
            }
        } else {
            HostControllerLogger.ROOT_LOGGER.lostRemoteDomainConnection();
            executorService.execute(new Runnable() {
                @Override
View Full Code Here

     *
     * @param connectionURI the new connection URI
     */
    protected void reconfigure(final URI connectionURI) {
        configuration.setUri(connectionURI);
        final Connection connection = this.connection;
        if(connection != null) {
            connection.closeAsync();
        }
    }
View Full Code Here

            builder.set(Options.SASL_MECHANISMS, Sequence.of("JBOSS-LOCAL-USER"));
        }

        final IoFuture<Connection> futureConnection = endpoint.connect(connectionURI, builder.getMap(), new AuthenticationCallbackHandler(username, password));
        // wait for the connection to be established
        final Connection connection = IoFutureHelper.get(futureConnection, 5000, TimeUnit.MILLISECONDS);
        // create a remoting EJB receiver for this connection
        final EJBReceiver receiver = new RemotingConnectionEJBReceiver(connection);
        // associate it with the client context
        EJBClientContext context = EJBClientContext.create();
        context.registerEJBReceiver(receiver);
View Full Code Here

        return this.nodeName;
    }

    @Override
    public EJBReceiver getEJBReceiver() {
        Connection connection;
        final ReconnectHandler reconnectHandler;
        OptionMap channelCreationOptions = OptionMap.EMPTY;
        final EJBClientConfiguration ejbClientConfiguration = this.clusterContext.getEJBClientContext().getEJBClientConfiguration();
        try {
            // if the client configuration is available create the connection using those configs
View Full Code Here

            this.connectionTimeout = connectionTimeoutInMillis;
        }

        @Override
        public void reconnect() throws IOException {
            Connection connection = null;
            try {
                final IoFuture<Connection> futureConnection = NetworkUtil.connect(endpoint, destinationHost, destinationPort, null, connectionCreationOptions, callbackHandler, null);
                connection = IoFutureHelper.get(futureConnection, connectionTimeout, TimeUnit.MILLISECONDS);
                logger.debug("Successfully reconnected to connection " + connection);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.ipc.RpcClient$Connection

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.