Package org.apache.hadoop.ipc

Examples of org.apache.hadoop.ipc.VersionedProtocol


            info = UserGroupInformation.getCurrentUser();
        } catch (Exception e) {
            throw new IOException(StringUtils.stringifyException(e));
        }

        VersionedProtocol proxy = RPC.getProxy(NamenodeProtocol.class,
            NamenodeProtocol.versionID, address, info, conf,
            NetUtils.getDefaultSocketFactory(conf));
        NamenodeProtocol ret =
                (NamenodeProtocol)RetryProxy.create(NamenodeProtocol.class,
                    proxy, policyMap);
View Full Code Here


   */
  public static VersionedProtocol getProxy(Class<?> protocol,
      long clientVersion, InetSocketAddress addr, UserGroupInformation ticket,
      Configuration conf, SocketFactory factory)
  throws IOException {   
    VersionedProtocol proxy =
        (VersionedProtocol) Proxy.newProxyInstance(
            protocol.getClassLoader(), new Class[] { protocol },
            new Invoker(addr, ticket, conf, factory));
    long serverVersion = proxy.getProtocolVersion(protocol.getName(),
                                                  clientVersion);
    if (serverVersion == clientVersion) {
      return proxy;
    } else {
      throw new VersionMismatch(protocol.getName(), clientVersion,
View Full Code Here

   * talking to a server at the named address. */
  public static VersionedProtocol getProxy(Class<?> protocol,
      long clientVersion, InetSocketAddress addr, UserGroupInformation ticket,
      Configuration conf, SocketFactory factory) throws IOException {   

    VersionedProtocol proxy =
        (VersionedProtocol) Proxy.newProxyInstance(
            protocol.getClassLoader(), new Class[] { protocol },
            new Invoker(addr, ticket, conf, factory));
    long serverVersion = proxy.getProtocolVersion(protocol.getName(),
                                                  clientVersion);
    if (serverVersion == clientVersion) {
      return proxy;
    } else {
      throw new VersionMismatch(protocol.getName(), clientVersion,
View Full Code Here

   */
  public static VersionedProtocol getProxy(Class<?> protocol,
      long clientVersion, InetSocketAddress addr, UserGroupInformation ticket,
      Configuration conf, SocketFactory factory)
  throws IOException {
    VersionedProtocol proxy =
        (VersionedProtocol) Proxy.newProxyInstance(
            protocol.getClassLoader(), new Class[] { protocol },
            new Invoker(addr, ticket, conf, factory));
    long serverVersion = proxy.getProtocolVersion(protocol.getName(),
                                                  clientVersion);
    if (serverVersion == clientVersion) {
      return proxy;
    }
    throw new VersionMismatch(protocol.getName(), clientVersion,
View Full Code Here

   */
  public static VersionedProtocol getProxy(Class<?> protocol,
      long clientVersion, InetSocketAddress addr, UserGroupInformation ticket,
      Configuration conf, SocketFactory factory)
  throws IOException {   
    VersionedProtocol proxy =
        (VersionedProtocol) Proxy.newProxyInstance(
            protocol.getClassLoader(), new Class[] { protocol },
            new Invoker(addr, ticket, conf, factory));
    long serverVersion = proxy.getProtocolVersion(protocol.getName(),
                                                  clientVersion);
    if (serverVersion == clientVersion) {
      return proxy;
    }
    throw new VersionMismatch(protocol.getName(), clientVersion,
View Full Code Here

   */
  public static VersionedProtocol getProxy(Class<?> protocol,
      long clientVersion, InetSocketAddress addr, UserGroupInformation ticket,
      Configuration conf, SocketFactory factory)
  throws IOException {   
    VersionedProtocol proxy =
        (VersionedProtocol) Proxy.newProxyInstance(
            protocol.getClassLoader(), new Class[] { protocol },
            new Invoker(addr, ticket, conf, factory));
    long serverVersion = proxy.getProtocolVersion(protocol.getName(),
                                                  clientVersion);
    if (serverVersion == clientVersion) {
      return proxy;
    }
    throw new VersionMismatch(protocol.getName(), clientVersion,
View Full Code Here

              + "' (It should be a host name with a port number devided by a ':')");
    }
    final String hostName = hostName_port[0];
    final String port = hostName_port[1];
    final InetSocketAddress inetSocketAddress = new InetSocketAddress(hostName, Integer.parseInt(port));
    VersionedProtocol proxy = RPC.getProxy(_serverClass, 0L, inetSocketAddress, _hadoopConf);
    LOG.debug(String.format("Created a proxy %s for %s:%s %s", Proxy.getInvocationHandler(proxy), hostName, port,
            inetSocketAddress));
    return proxy;
  }
View Full Code Here

    return proxy;
  }

  @Override
  public VersionedProtocol getProxy(String nodeName, boolean establishIfNoExists) {
    VersionedProtocol versionedProtocol = _node2ProxyMap.get(nodeName);
    if (versionedProtocol == null && establishIfNoExists) {
      synchronized (nodeName.intern()) {
        if (!_node2ProxyMap.containsKey(nodeName)) {
          try {
            versionedProtocol = createNodeProxy(nodeName);
View Full Code Here

    synchronized (nodeName.intern()) {
      if (_node2ProxyMap.containsKey(nodeName)) {
        LOG.warn("removing proxy for node '" + nodeName + "' after " + failureCount + " proxy-invocation errors");
        _failedNodeInteractions.remove(nodeName, Integer.MAX_VALUE);
        _selectionPolicy.removeNode(nodeName);
        VersionedProtocol proxy = _node2ProxyMap.remove(nodeName);
        RPC.stopProxy(proxy);
      }
    }
  }
View Full Code Here

                }

                @Override
                public void added(String nodeName) {
                  LOG.info("shard '" + shardName + "' added to node '" + nodeName + "'");
                  VersionedProtocol proxy = _proxyManager.getProxy(nodeName, true);
                  if (proxy != null) {
                    Collection<String> shardNodes = new ArrayList<String>(_selectionPolicy.getShardNodes(shardName));
                    shardNodes.add(nodeName);
                    _selectionPolicy.update(shardName, shardNodes);
                  }
                }
              });
      Collection<String> shardNodes = new ArrayList<String>(3);
      for (String node : nodes) {
        VersionedProtocol proxy = _proxyManager.getProxy(node, true);
        if (proxy != null) {
          shardNodes.add(node);
        }
      }
      _selectionPolicy.update(shardName, shardNodes);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.ipc.VersionedProtocol

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.