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


Java CancelDelegationTokenServlet类代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.server.namenode.CancelDelegationTokenServlet的典型用法代码示例。如果您正苦于以下问题:Java CancelDelegationTokenServlet类的具体用法?Java CancelDelegationTokenServlet怎么用?Java CancelDelegationTokenServlet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CancelDelegationTokenServlet类属于org.apache.hadoop.hdfs.server.namenode包,在下文中一共展示了CancelDelegationTokenServlet类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cancelDelegationToken

import org.apache.hadoop.hdfs.server.namenode.CancelDelegationTokenServlet; //导入依赖的package包/类
/**
 * Cancel a Delegation Token.
 * @param nnAddr the NameNode's address
 * @param tok the token to cancel
 * @throws IOException
 */
static public void cancelDelegationToken(String nnAddr,
                                         Token<DelegationTokenIdentifier> tok
                                         ) throws IOException {
  StringBuilder buf = new StringBuilder();
  buf.append(nnAddr);
  buf.append(CancelDelegationTokenServlet.PATH_SPEC);
  buf.append("?");
  buf.append(CancelDelegationTokenServlet.TOKEN);
  buf.append("=");
  buf.append(tok.encodeToUrlString());
  BufferedReader in = null;
  try {
    URL url = new URL(buf.toString());
    HttpURLConnection connection =
            (HttpURLConnection)SecurityUtil.openSecureHttpConnection(url);
    if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
      throw new IOException("Error cancelling token:" + 
                            connection.getResponseMessage());
    }
  } catch (IOException ie) {
    IOUtils.cleanup(LOG, in);
    throw ie;
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:31,代码来源:DelegationTokenFetcher.java

示例2: cancelDelegationToken

import org.apache.hadoop.hdfs.server.namenode.CancelDelegationTokenServlet; //导入依赖的package包/类
/**
 * Cancel a Delegation Token.
 * @param nnAddr the NameNode's address
 * @param tok the token to cancel
 * @throws IOException
 */
static public void cancelDelegationToken(String nnAddr,
    Token<DelegationTokenIdentifier> tok
) throws IOException {
  StringBuilder buf = new StringBuilder();
  buf.append(nnAddr);
  buf.append(CancelDelegationTokenServlet.PATH_SPEC);
  buf.append("?");
  buf.append(CancelDelegationTokenServlet.TOKEN);
  buf.append("=");
  buf.append(tok.encodeToUrlString());
  BufferedReader in = null;
  try {
    URL url = new URL(buf.toString());
    SecurityUtil.fetchServiceTicket(url);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
      throw new IOException("Error cancelling token: " + 
          connection.getResponseMessage());
    }
  } catch (IOException ie) {
    IOUtils.cleanup(LOG, in);
    throw ie;
  }
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:31,代码来源:DelegationTokenFetcher.java

示例3: cancelDelegationToken

import org.apache.hadoop.hdfs.server.namenode.CancelDelegationTokenServlet; //导入依赖的package包/类
/**
 * Cancel a Delegation Token.
 * @param nnAddr the NameNode's address
 * @param tok the token to cancel
 * @throws IOException
 * @throws AuthenticationException
 */
static public void cancelDelegationToken(URLConnectionFactory factory,
    URI nnAddr, Token<DelegationTokenIdentifier> tok) throws IOException,
    AuthenticationException {
  StringBuilder buf = new StringBuilder(nnAddr.toString())
      .append(CancelDelegationTokenServlet.PATH_SPEC).append("?")
      .append(CancelDelegationTokenServlet.TOKEN).append("=")
      .append(tok.encodeToUrlString());
  HttpURLConnection conn = run(factory, new URL(buf.toString()));
  conn.disconnect();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:DelegationTokenFetcher.java

示例4: cancelDelegationToken

import org.apache.hadoop.hdfs.server.namenode.CancelDelegationTokenServlet; //导入依赖的package包/类
/**
 * Cancel a Delegation Token.
 * @param nnAddr the NameNode's address
 * @param tok the token to cancel
 * @throws IOException
 */
static public void cancelDelegationToken(String nnAddr,
    Token<DelegationTokenIdentifier> tok
) throws IOException {
  StringBuilder buf = new StringBuilder();
  buf.append(nnAddr);
  buf.append(CancelDelegationTokenServlet.PATH_SPEC);
  buf.append("?");
  buf.append(CancelDelegationTokenServlet.TOKEN);
  buf.append("=");
  buf.append(tok.encodeToUrlString());
  BufferedReader in = null;
  HttpURLConnection connection=null;
  try {
    URL url = new URL(buf.toString());
    connection = (HttpURLConnection) SecurityUtil.openSecureHttpConnection(url);
    if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
      throw new IOException("Error cancelling token: " + 
          connection.getResponseMessage());
    }
  } catch (IOException ie) {
    LOG.info("error in cancel over HTTP", ie);
    IOException e = getExceptionFromResponse(connection);

    IOUtils.cleanup(LOG, in);
    if(e!=null) {
      LOG.info("rethrowing exception from HTTP request: " + 
               e.getLocalizedMessage());
      throw e;
    }
    throw ie;
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:39,代码来源:DelegationTokenFetcher.java

示例5: cancelDelegationToken

import org.apache.hadoop.hdfs.server.namenode.CancelDelegationTokenServlet; //导入依赖的package包/类
/**
 * Cancel a Delegation Token.
 *
 * @param nnAddr
 *     the NameNode's address
 * @param tok
 *     the token to cancel
 * @throws IOException
 */
static public void cancelDelegationToken(String nnAddr,
    Token<DelegationTokenIdentifier> tok) throws IOException {
  StringBuilder buf = new StringBuilder();
  buf.append(nnAddr);
  buf.append(CancelDelegationTokenServlet.PATH_SPEC);
  buf.append("?");
  buf.append(CancelDelegationTokenServlet.TOKEN);
  buf.append("=");
  buf.append(tok.encodeToUrlString());
  BufferedReader in = null;
  HttpURLConnection connection = null;
  try {
    URL url = new URL(buf.toString());
    connection =
        (HttpURLConnection) SecurityUtil2.openSecureHttpConnection(url);
    if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
      throw new IOException(
          "Error cancelling token: " + connection.getResponseMessage());
    }
  } catch (IOException ie) {
    LOG.info("error in cancel over HTTP", ie);
    IOException e = getExceptionFromResponse(connection);

    IOUtils.cleanup(LOG, in);
    if (e != null) {
      LOG.info("rethrowing exception from HTTP request: " +
          e.getLocalizedMessage());
      throw e;
    }
    throw ie;
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:42,代码来源:DelegationTokenFetcher.java


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