本文整理汇总了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);
}
示例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();
}
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
}
示例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);
}
示例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. ");
}
示例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. ");
}
示例10: getDelegate
import org.apache.hadoop.hbase.thrift.generated.Hbase; //导入方法依赖的package包/类
public Hbase.Client getDelegate() {
return delegate;
}
示例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);
}