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


Java Hbase.Client方法代码示例

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


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

示例1: setUpBeforeClass

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {

	// binaryProtocol
	if (binaryProtocol) {
		System.out.println("[blockingTransport]");
		ttransport = createTTransport();
		System.out.println("[binaryProtocol]");
		tprotocol = createTBinaryProtocol(ttransport);
	} else {
		System.out.println("[noblockingTransport]");
		ttransport = createTFramedTransport();
		System.out.println("[compactProtocol]");
		tprotocol = createTCompactProtocol(ttransport);
	}
	client = new Hbase.Client(tprotocol);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:18,代码来源:HBaseThriftDDLTest.java

示例2: talkToThriftServer

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
private void talkToThriftServer(int customHeaderSize) throws Exception {
  THttpClient httpClient = new THttpClient(
      "http://"+ HConstants.LOCALHOST + ":" + port);
  httpClient.open();

  if (customHeaderSize > 0) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < customHeaderSize; i++) {
      sb.append("a");
    }
    httpClient.setCustomHeader("User-Agent", sb.toString());
  }

  try {
    TProtocol prot;
    prot = new TBinaryProtocol(httpClient);
    Hbase.Client client = new Hbase.Client(prot);
    if (!tableCreated){
      TestThriftServer.createTestTables(client);
      tableCreated = true;
    }
    TestThriftServer.checkTableList(client);
  } finally {
    httpClient.close();
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:27,代码来源:TestThriftHttpServer.java

示例3: refresh

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
private Hbase.Client refresh(Hbase.Client client, THttpClient httpClient) {
  httpClient.setCustomHeader("doAs", doAsUser);
  if(secure) {
    try {
      httpClient.setCustomHeader("Authorization", generateTicket());
    } catch (GSSException e) {
      e.printStackTrace();
    }
  }
  return client;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:HttpDoAsClient.java

示例4: refresh

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
private Hbase.Client refresh(Hbase.Client client, THttpClient httpClient) {
  if(secure) {
    httpClient.setCustomHeader("doAs", "hbase");
    try {
      httpClient.setCustomHeader("Authorization", generateTicket());
    } catch (GSSException e) {
      e.printStackTrace();
    }
  }
  return client;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:12,代码来源:HttpDoAsClient.java

示例5: PoolableHbaseTTransport

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
public PoolableHbaseTTransport(TTransport ttransport, ObjectPool<TTransport> pool, boolean compactProtocol) {
	this.ttransport = ttransport;
	this.pool = pool;
	//
	this.compactProtocol = compactProtocol;
	if (!this.compactProtocol) {
		this.tprotocol = new TBinaryProtocol(ttransport);
	} else {
		this.tprotocol = new TCompactProtocol(ttransport);
	}
	this.delegate = new Hbase.Client(this.tprotocol);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:13,代码来源:PoolableHbaseTTransport.java

示例6: HtSessionImpl

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
public HtSessionImpl(HtSessionFactoryImpl factory,
		TTransport ttransport) {
	this.factory = factory;
	this.ttransport = ttransport;
	//
	if (ttransport instanceof Delegateable) {
		@SuppressWarnings("unchecked")
		Delegateable<Hbase.Client> targetable = (Delegateable<Hbase.Client>) ttransport;
		this.delegate = targetable.getDelegate();
	}
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:12,代码来源:HtSessionImpl.java

示例7: getTable

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
@Test
public void getTable() throws Exception {
	TTransport ttransport = htDataSource.getTTransport();
	TProtocol tprotocol = new TBinaryProtocol(ttransport);
	Hbase.Client client = new Hbase.Client(tprotocol);
	//
	String TABLE_NAME = "UIH_OverallItemInfo";
	//
	long beg = System.currentTimeMillis();
	Map<ByteBuffer, ColumnDescriptor> hcds = client
			.getColumnDescriptors(ByteBufferHelper.toByteBuffer(TABLE_NAME));
	//
	StringBuilder buffer = new StringBuilder();
	buffer.append("[");
	buffer.append(TABLE_NAME);
	buffer.append("] ");
	int size = hcds.size();
	int i = 0;
	for (ColumnDescriptor column : hcds.values()) {
		buffer.append(ByteHelper.toString(column.getName()));
		buffer.append(", " + column.getTimeToLive());// server沒提供
		if (i < size - 1) {
			buffer.append(", ");
		}
		i++;
	}
	ttransport.close();
	//
	long end = System.currentTimeMillis();
	System.out.println((end - beg) + " at mills.");
	System.out.println(buffer);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:33,代码来源:HtDataSourceImplTest.java

示例8: listTables

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
@Test
// 50 times: 59110 mills.
public void listTables() throws Exception {
	int count = 50;
	//
	long beg = System.currentTimeMillis();
	for (int i = 0; i < count; i++) {
		TTransport ttransport = htDataSource.getTTransport();
		TProtocol tprotocol = new TBinaryProtocol(ttransport);
		Hbase.Client client = new Hbase.Client(tprotocol);

		List<ByteBuffer> list = client.getTableNames();
		for (ByteBuffer name : list) {
			StringBuilder buffer = new StringBuilder();
			buffer.append("[");
			buffer.append(ByteBufferHelper.toString(name));
			buffer.append("] ");
			Map<ByteBuffer, ColumnDescriptor> hcds = client
					.getColumnDescriptors(name);
			int size = hcds.size();
			int j = 0;
			for (ColumnDescriptor column : hcds.values()) {
				buffer.append(ByteHelper.toString(column.getName()));
				if (j < size - 1) {
					buffer.append(", ");
				}
				j++;
			}
			//
			System.out.println(buffer);
			ttransport.close();
		}
	}
	long end = System.currentTimeMillis();
	System.out.println(count + " times: " + (end - beg) + " mills. ");
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:37,代码来源:HtDataSourceImplTest.java

示例9: listTables

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
/**
 * list all tables
 *
 * @throws Exception
 */
@Test
// 50 times: 59193 mills.
public void listTables() throws Exception {
	int count = 50;
	//
	long beg = System.currentTimeMillis();
	for (int i = 0; i < count; i++) {
		TTransport ttransport = createTTransport();
		TProtocol tprotocol = createTBinaryProtocol(ttransport);
		Hbase.Client client = createClient(tprotocol);
		System.out.println(client);
		//
		List<ByteBuffer> list = client.getTableNames();
		for (ByteBuffer name : list) {
			StringBuilder buffer = new StringBuilder();
			buffer.append("[");
			buffer.append(ByteBufferHelper.toString(name));
			buffer.append("] ");
			Map<ByteBuffer, ColumnDescriptor> hcds = client
					.getColumnDescriptors(name);
			int size = hcds.size();
			int j = 0;
			for (ColumnDescriptor column : hcds.values()) {
				buffer.append(ByteHelper.toString(column.getName()));
				if (j < size - 1) {
					buffer.append(", ");
				}
				j++;
			}
			//
			System.out.println(buffer);
		}
		ttransport.close();
	}
	long end = System.currentTimeMillis();
	System.out.println(count + " times: " + (end - beg) + " mills. ");
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:43,代码来源:HBaseThriftDDLTest.java

示例10: getDelegate

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
public Hbase.Client getDelegate() {
	return delegate;
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:4,代码来源:PoolableHbaseTTransport.java

示例11: createClient

import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
public static Hbase.Client createClient(TProtocol tprotocol)
		throws Exception {
	return new Hbase.Client(tprotocol);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:5,代码来源:HBaseThriftDDLTest.java


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