当前位置: 首页>>代码示例>>Java>>正文


Java Addressing.parseHostname方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.Addressing.parseHostname方法的典型用法代码示例。如果您正苦于以下问题:Java Addressing.parseHostname方法的具体用法?Java Addressing.parseHostname怎么用?Java Addressing.parseHostname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.util.Addressing的用法示例。


在下文中一共展示了Addressing.parseHostname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stopRegionServer

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Stop the designated regionserver
 * @param hostnamePort Hostname and port delimited by a <code>:</code> as in
 * <code>example.org:1234</code>
 * @throws IOException if a remote or network exception occurs
 */
@Override
public synchronized void stopRegionServer(final String hostnamePort)
throws IOException {
  String hostname = Addressing.parseHostname(hostnamePort);
  int port = Addressing.parsePort(hostnamePort);
  AdminService.BlockingInterface admin =
    this.connection.getAdmin(ServerName.valueOf(hostname, port, 0));
  StopServerRequest request = RequestConverter.buildStopServerRequest(
    "Called by admin client " + this.connection.toString());
  PayloadCarryingRpcController controller = rpcControllerFactory.newController();

  controller.setPriority(HConstants.HIGH_QOS);
  try {
    // TODO: this does not do retries, it should. Set priority and timeout in controller
    admin.stopServer(controller, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:HBaseAdmin.java

示例2: dataToServerName

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
private static ServerName dataToServerName(final byte [] data) {
  // The str returned could be old style -- pre hbase-1502 -- which was
  // hostname and port seperated by a colon rather than hostname, port and
  // startcode delimited by a ','.
  if (data == null || data.length <= 0) return null;
  String str = Bytes.toString(data);
  int index = str.indexOf(ServerName.SERVERNAME_SEPARATOR);
  if (index != -1) {
    // Presume its ServerName.toString() format.
    return ServerName.parseServerName(str);
  }
  // Presume it a hostname:port format.
  String hostname = Addressing.parseHostname(str);
  int port = Addressing.parsePort(str);
  return new ServerName(hostname, port, -1L);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:RootRegionTracker.java

示例3: stopRegionServer

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Stop the designated regionserver
 * @param hostnamePort Hostname and port delimited by a <code>:</code> as in
 * <code>example.org:1234</code>
 * @throws IOException if a remote or network exception occurs
 */
@Override
public synchronized void stopRegionServer(final String hostnamePort)
throws IOException {
  String hostname = Addressing.parseHostname(hostnamePort);
  int port = Addressing.parsePort(hostnamePort);
  AdminService.BlockingInterface admin =
    this.connection.getAdmin(ServerName.valueOf(hostname, port, 0));
  StopServerRequest request = RequestConverter.buildStopServerRequest(
    "Called by admin client " + this.connection.toString());
  try {
    admin.stopServer(null, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:22,代码来源:HBaseAdmin.java

示例4: stopRegionServer

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
@Override
public synchronized void stopRegionServer(final String hostnamePort)
throws IOException {
  String hostname = Addressing.parseHostname(hostnamePort);
  int port = Addressing.parsePort(hostnamePort);
  final AdminService.BlockingInterface admin =
    this.connection.getAdmin(ServerName.valueOf(hostname, port, 0));
  // TODO: There is no timeout on this controller. Set one!
  HBaseRpcController controller = rpcControllerFactory.newController();
  controller.setPriority(HConstants.HIGH_QOS);
  StopServerRequest request = RequestConverter.buildStopServerRequest(
      "Called by admin client " + this.connection.toString());
  try {
    admin.stopServer(controller, request);
  } catch (Exception e) {
    throw ProtobufUtil.handleRemoteException(e);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:HBaseAdmin.java

示例5: parseFrom

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Get a ServerName from the passed in data bytes.
 * @param data Data with a serialize server name in it; can handle the old style
 * servername where servername was host and port.  Works too with data that
 * begins w/ the pb 'PBUF' magic and that is then followed by a protobuf that
 * has a serialized {@link ServerName} in it.
 * @return Returns null if <code>data</code> is null else converts passed data
 * to a ServerName instance.
 * @throws DeserializationException 
 */
public static ServerName parseFrom(final byte [] data) throws DeserializationException {
  if (data == null || data.length <= 0) return null;
  if (ProtobufUtil.isPBMagicPrefix(data)) {
    int prefixLen = ProtobufUtil.lengthOfPBMagic();
    try {
      ZooKeeperProtos.Master rss =
        ZooKeeperProtos.Master.PARSER.parseFrom(data, prefixLen, data.length - prefixLen);
      org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName sn = rss.getMaster();
      return valueOf(sn.getHostName(), sn.getPort(), sn.getStartCode());
    } catch (InvalidProtocolBufferException e) {
      // A failed parse of the znode is pretty catastrophic. Rather than loop
      // retrying hoping the bad bytes will changes, and rather than change
      // the signature on this method to add an IOE which will send ripples all
      // over the code base, throw a RuntimeException.  This should "never" happen.
      // Fail fast if it does.
      throw new DeserializationException(e);
    }
  }
  // The str returned could be old style -- pre hbase-1502 -- which was
  // hostname and port seperated by a colon rather than hostname, port and
  // startcode delimited by a ','.
  String str = Bytes.toString(data);
  int index = str.indexOf(ServerName.SERVERNAME_SEPARATOR);
  if (index != -1) {
    // Presume its ServerName serialized with versioned bytes.
    return ServerName.parseVersionedServerName(data);
  }
  // Presume it a hostname:port format.
  String hostname = Addressing.parseHostname(str);
  int port = Addressing.parsePort(str);
  return valueOf(hostname, port, -1L);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:43,代码来源:ServerName.java

示例6: stopRegionServer

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Stop the designated regionserver
 * @param hostnamePort Hostname and port delimited by a <code>:</code> as in
 *          <code>example.org:1234</code>
 * @throws IOException if a remote or network exception occurs
 */
public synchronized void stopRegionServer(final String hostnamePort) throws IOException {
  String hostname = Addressing.parseHostname(hostnamePort);
  int port = Addressing.parsePort(hostnamePort);
  HRegionInterface rs = this.connection.getHRegionConnection(hostname, port);
  rs.stop("Called by admin client " + this.connection.toString());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:13,代码来源:HBaseAdmin.java

示例7: stopRegionServer

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Stop the designated regionserver
 * @param hostnamePort Hostname and port delimited by a <code>:</code> as in
 * <code>example.org:1234</code>
 * @throws IOException if a remote or network exception occurs
 */
public synchronized void stopRegionServer(final String hostnamePort)
throws IOException {
  String hostname = Addressing.parseHostname(hostnamePort);
  int port = Addressing.parsePort(hostnamePort);
  AdminService.BlockingInterface admin =
    this.connection.getAdmin(ServerName.valueOf(hostname, port, 0));
  StopServerRequest request = RequestConverter.buildStopServerRequest(
    "Called by admin client " + this.connection.toString());
  try {
    admin.stopServer(null, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:21,代码来源:HBaseAdmin.java

示例8: parseFrom

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Get a ServerName from the passed in data bytes.
 * @param data Data with a serialize server name in it; can handle the old style
 * servername where servername was host and port.  Works too with data that
 * begins w/ the pb 'PBUF' magic and that is then followed by a protobuf that
 * has a serialized {@link ServerName} in it.
 * @return Returns null if <code>data</code> is null else converts passed data
 * to a ServerName instance.
 * @throws DeserializationException 
 */
public static ServerName parseFrom(final byte [] data) throws DeserializationException {
  if (data == null || data.length <= 0) return null;
  if (ProtobufUtil.isPBMagicPrefix(data)) {
    int prefixLen = ProtobufUtil.lengthOfPBMagic();
    try {
      MetaRegionServer rss =
        MetaRegionServer.PARSER.parseFrom(data, prefixLen, data.length - prefixLen);
      org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName sn = rss.getServer();
      return valueOf(sn.getHostName(), sn.getPort(), sn.getStartCode());
    } catch (InvalidProtocolBufferException e) {
      // A failed parse of the znode is pretty catastrophic. Rather than loop
      // retrying hoping the bad bytes will changes, and rather than change
      // the signature on this method to add an IOE which will send ripples all
      // over the code base, throw a RuntimeException.  This should "never" happen.
      // Fail fast if it does.
      throw new DeserializationException(e);
    }
  }
  // The str returned could be old style -- pre hbase-1502 -- which was
  // hostname and port seperated by a colon rather than hostname, port and
  // startcode delimited by a ','.
  String str = Bytes.toString(data);
  int index = str.indexOf(ServerName.SERVERNAME_SEPARATOR);
  if (index != -1) {
    // Presume its ServerName serialized with versioned bytes.
    return ServerName.parseVersionedServerName(data);
  }
  // Presume it a hostname:port format.
  String hostname = Addressing.parseHostname(str);
  int port = Addressing.parsePort(str);
  return valueOf(hostname, port, -1L);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:43,代码来源:ServerName.java

示例9: stopRegionServer

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Stop the designated regionserver
 * @param hostnamePort Hostname and port delimited by a <code>:</code> as in
 * <code>example.org:1234</code>
 * @throws IOException if a remote or network exception occurs
 */
public synchronized void stopRegionServer(final String hostnamePort)
throws IOException {
  String hostname = Addressing.parseHostname(hostnamePort);
  int port = Addressing.parsePort(hostnamePort);
  HRegionInterface rs =
    this.connection.getHRegionConnection(hostname, port);
  rs.stop("Called by admin client " + this.connection.toString());
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:15,代码来源:HBaseAdmin.java

示例10: toServerName

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Get a ServerName from the passed in data bytes.
 * @param data Data with a serialize server name in it; can handle the old style
 * servername where servername was host and port.  Works too with data that
 * begins w/ the pb 'PBUF' magic and that is then followed by a protobuf that
 * has a serialized {@link ServerName} in it.
 * @return Returns null if <code>data</code> is null else converts passed data
 * to a ServerName instance.
 * @throws DeserializationException
 */
public static ServerName toServerName(final byte [] data) throws DeserializationException {
  if (data == null || data.length <= 0) return null;
  if (ProtobufMagic.isPBMagicPrefix(data)) {
    int prefixLen = ProtobufMagic.lengthOfPBMagic();
    try {
      ZooKeeperProtos.Master rss =
        ZooKeeperProtos.Master.PARSER.parseFrom(data, prefixLen, data.length - prefixLen);
      org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName sn =
          rss.getMaster();
      return ServerName.valueOf(sn.getHostName(), sn.getPort(), sn.getStartCode());
    } catch (/*InvalidProtocolBufferException*/IOException e) {
      // A failed parse of the znode is pretty catastrophic. Rather than loop
      // retrying hoping the bad bytes will changes, and rather than change
      // the signature on this method to add an IOE which will send ripples all
      // over the code base, throw a RuntimeException.  This should "never" happen.
      // Fail fast if it does.
      throw new DeserializationException(e);
    }
  }
  // The str returned could be old style -- pre hbase-1502 -- which was
  // hostname and port seperated by a colon rather than hostname, port and
  // startcode delimited by a ','.
  String str = Bytes.toString(data);
  int index = str.indexOf(ServerName.SERVERNAME_SEPARATOR);
  if (index != -1) {
    // Presume its ServerName serialized with versioned bytes.
    return ServerName.parseVersionedServerName(data);
  }
  // Presume it a hostname:port format.
  String hostname = Addressing.parseHostname(str);
  int port = Addressing.parsePort(str);
  return ServerName.valueOf(hostname, port, -1L);
}
 
开发者ID:apache,项目名称:hbase,代码行数:44,代码来源:ProtobufUtil.java

示例11: parseServerNameFrom

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Get a ServerName from the passed in data bytes.
 * @param data Data with a serialize server name in it; can handle the old style
 * servername where servername was host and port.  Works too with data that
 * begins w/ the pb 'PBUF' magic and that is then followed by a protobuf that
 * has a serialized {@link ServerName} in it.
 * @return Returns null if <code>data</code> is null else converts passed data
 * to a ServerName instance.
 * @throws DeserializationException
 */
public static ServerName parseServerNameFrom(final byte [] data) throws DeserializationException {
  if (data == null || data.length <= 0) return null;
  if (ProtobufMagic.isPBMagicPrefix(data)) {
    int prefixLen = ProtobufMagic.lengthOfPBMagic();
    try {
      ZooKeeperProtos.Master rss =
        ZooKeeperProtos.Master.PARSER.parseFrom(data, prefixLen, data.length - prefixLen);
      org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName sn =
          rss.getMaster();
      return ServerName.valueOf(sn.getHostName(), sn.getPort(), sn.getStartCode());
    } catch (/*InvalidProtocolBufferException*/IOException e) {
      // A failed parse of the znode is pretty catastrophic. Rather than loop
      // retrying hoping the bad bytes will changes, and rather than change
      // the signature on this method to add an IOE which will send ripples all
      // over the code base, throw a RuntimeException.  This should "never" happen.
      // Fail fast if it does.
      throw new DeserializationException(e);
    }
  }
  // The str returned could be old style -- pre hbase-1502 -- which was
  // hostname and port seperated by a colon rather than hostname, port and
  // startcode delimited by a ','.
  String str = Bytes.toString(data);
  int index = str.indexOf(ServerName.SERVERNAME_SEPARATOR);
  if (index != -1) {
    // Presume its ServerName serialized with versioned bytes.
    return ServerName.parseVersionedServerName(data);
  }
  // Presume it a hostname:port format.
  String hostname = Addressing.parseHostname(str);
  int port = Addressing.parsePort(str);
  return ServerName.valueOf(hostname, port, -1L);
}
 
开发者ID:apache,项目名称:hbase,代码行数:44,代码来源:ProtobufUtil.java

示例12: stopRegionServer

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Stop the designated regionserver
 * @param hostnamePort Hostname and port delimited by a <code>:</code> as in
 * <code>example.org:1234</code>
 * @throws IOException if a remote or network exception occurs
 */
public synchronized void stopRegionServer(final String hostnamePort)
throws IOException {
  String hostname = Addressing.parseHostname(hostnamePort);
  int port = Addressing.parsePort(hostnamePort);
  AdminProtocol admin =
    this.connection.getAdmin(hostname, port);
  StopServerRequest request = RequestConverter.buildStopServerRequest(
    "Called by admin client " + this.connection.toString());
  try {
    admin.stopServer(null, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:21,代码来源:HBaseAdmin.java

示例13: parseFrom

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
/**
 * Get a ServerName from the passed in data bytes.
 * @param data Data with a serialize server name in it; can handle the old style
 * servername where servername was host and port.  Works too with data that
 * begins w/ the pb 'PBUF' magic and that is then followed by a protobuf that
 * has a serialized {@link ServerName} in it.
 * @return Returns null if <code>data</code> is null else converts passed data
 * to a ServerName instance.
 * @throws DeserializationException 
 */
public static ServerName parseFrom(final byte [] data) throws DeserializationException {
  if (data == null || data.length <= 0) return null;
  if (ProtobufUtil.isPBMagicPrefix(data)) {
    int prefixLen = ProtobufUtil.lengthOfPBMagic();
    try {
      RootRegionServer rss =
        RootRegionServer.newBuilder().mergeFrom(data, prefixLen, data.length - prefixLen).build();
      org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName sn = rss.getServer();
      return new ServerName(sn.getHostName(), sn.getPort(), sn.getStartCode());
    } catch (InvalidProtocolBufferException e) {
      // A failed parse of the znode is pretty catastrophic. Rather than loop
      // retrying hoping the bad bytes will changes, and rather than change
      // the signature on this method to add an IOE which will send ripples all
      // over the code base, throw a RuntimeException.  This should "never" happen.
      // Fail fast if it does.
      throw new DeserializationException(e);
    }
  }
  // The str returned could be old style -- pre hbase-1502 -- which was
  // hostname and port seperated by a colon rather than hostname, port and
  // startcode delimited by a ','.
  String str = Bytes.toString(data);
  int index = str.indexOf(ServerName.SERVERNAME_SEPARATOR);
  if (index != -1) {
    // Presume its ServerName serialized with versioned bytes.
    return ServerName.parseVersionedServerName(data);
  }
  // Presume it a hostname:port format.
  String hostname = Addressing.parseHostname(str);
  int port = Addressing.parsePort(str);
  return new ServerName(hostname, port, -1L);
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:43,代码来源:ServerName.java

示例14: ServerName

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
private ServerName(final String hostAndPort, final long startCode) {
  this(Addressing.parseHostname(hostAndPort),
    Addressing.parsePort(hostAndPort), startCode);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:5,代码来源:ServerName.java

示例15: ServerName

import org.apache.hadoop.hbase.util.Addressing; //导入方法依赖的package包/类
public ServerName(final String hostAndPort, final long startCode) {
  this(Addressing.parseHostname(hostAndPort),
    Addressing.parsePort(hostAndPort), startCode);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:5,代码来源:ServerName.java


注:本文中的org.apache.hadoop.hbase.util.Addressing.parseHostname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。