本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface方法的典型用法代码示例。如果您正苦于以下问题:Java ClientService.BlockingInterface方法的具体用法?Java ClientService.BlockingInterface怎么用?Java ClientService.BlockingInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService
的用法示例。
在下文中一共展示了ClientService.BlockingInterface方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRowOrBefore
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
/**
* A helper to get a row of the closet one before using client protocol.
*
* @param client
* @param regionName
* @param row
* @param family
* @return the row or the closestRowBefore if it doesn't exist
* @throws IOException
* @deprecated since 0.99 - use reversed scanner instead.
*/
@Deprecated
public static Result getRowOrBefore(final ClientService.BlockingInterface client,
final byte[] regionName, final byte[] row,
final byte[] family) throws IOException {
GetRequest request =
RequestConverter.buildGetRowOrBeforeRequest(
regionName, row, family);
try {
GetResponse response = client.get(null, request);
if (!response.hasResult()) return null;
return toResult(response.getResult());
} catch (ServiceException se) {
throw getRemoteException(se);
}
}
示例2: execRegionServerService
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
/**
* Make a region server endpoint call
* @param client
* @param call
* @return CoprocessorServiceResponse
* @throws IOException
*/
public static CoprocessorServiceResponse execRegionServerService(
final RpcController controller, final ClientService.BlockingInterface client,
final CoprocessorServiceCall call)
throws IOException {
CoprocessorServiceRequest request =
CoprocessorServiceRequest
.newBuilder()
.setCall(call)
.setRegion(
RequestConverter.buildRegionSpecifier(REGION_NAME, HConstants.EMPTY_BYTE_ARRAY))
.build();
try {
CoprocessorServiceResponse response = client.execRegionServerService(controller, request);
return response;
} catch (ServiceException se) {
throw getRemoteException(se);
}
}
示例3: getClient
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
@Override
public ClientService.BlockingInterface getClient(final ServerName sn)
throws IOException {
if (isDeadServer(sn)) {
throw new RegionServerStoppedException(sn + " is dead.");
}
String key = getStubKey(ClientService.BlockingInterface.class.getName(), sn.getHostname(),
sn.getPort(), this.hostnamesCanChange);
this.connectionLock.putIfAbsent(key, key);
ClientService.BlockingInterface stub = null;
synchronized (this.connectionLock.get(key)) {
stub = (ClientService.BlockingInterface)this.stubs.get(key);
if (stub == null) {
BlockingRpcChannel channel =
this.rpcClient.createBlockingRpcChannel(sn, user, rpcTimeout);
stub = ClientService.newBlockingStub(channel);
// In old days, after getting stub/proxy, we'd make a call. We are not doing that here.
// Just fail on first actual call rather than in here on setup.
this.stubs.put(key, stub);
}
}
return stub;
}
示例4: execRegionServerService
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
/**
* Make a region server endpoint call
* @param client
* @param call
* @return CoprocessorServiceResponse
* @throws IOException
*/
public static CoprocessorServiceResponse execRegionServerService(
final ClientService.BlockingInterface client, final CoprocessorServiceCall call)
throws IOException {
CoprocessorServiceRequest request =
CoprocessorServiceRequest
.newBuilder()
.setCall(call)
.setRegion(
RequestConverter.buildRegionSpecifier(REGION_NAME, HConstants.EMPTY_BYTE_ARRAY))
.build();
try {
CoprocessorServiceResponse response = client.execRegionServerService(null, request);
return response;
} catch (ServiceException se) {
throw getRemoteException(se);
}
}
示例5: getClient
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
@Override
public ClientService.BlockingInterface getClient(final ServerName sn)
throws IOException {
if (isDeadServer(sn)) {
throw new RegionServerStoppedException(sn + " is dead.");
}
String key = getStubKey(ClientService.BlockingInterface.class.getName(), sn.getHostAndPort());
this.connectionLock.putIfAbsent(key, key);
ClientService.BlockingInterface stub = null;
synchronized (this.connectionLock.get(key)) {
stub = (ClientService.BlockingInterface)this.stubs.get(key);
if (stub == null) {
BlockingRpcChannel channel = this.rpcClient.createBlockingRpcChannel(sn,
user, this.rpcTimeout);
stub = ClientService.newBlockingStub(channel);
// In old days, after getting stub/proxy, we'd make a call. We are not doing that here.
// Just fail on first actual call rather than in here on setup.
this.stubs.put(key, stub);
}
}
return stub;
}
示例6: getClient
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
@Override
public ClientService.BlockingInterface getClient(final ServerName sn)
throws IOException {
if (isDeadServer(sn)) {
throw new RegionServerStoppedException(sn + " is dead.");
}
String key = getStubKey(ClientService.BlockingInterface.class.getName(), sn.getHostAndPort());
this.connectionLock.putIfAbsent(key, key);
ClientService.BlockingInterface stub = null;
synchronized (this.connectionLock.get(key)) {
stub = (ClientService.BlockingInterface)this.stubs.get(key);
if (stub == null) {
BlockingRpcChannel channel =
this.rpcClient.createBlockingRpcChannel(sn, user, rpcTimeout);
stub = ClientService.newBlockingStub(channel);
// In old days, after getting stub/proxy, we'd make a call. We are not doing that here.
// Just fail on first actual call rather than in here on setup.
this.stubs.put(key, stub);
}
}
return stub;
}
示例7: testShortCircuitConnection
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
@Test
@SuppressWarnings("deprecation")
public void testShortCircuitConnection() throws IOException, InterruptedException {
String tnAsString = "testShortCircuitConnection";
TableName tn = TableName.valueOf(tnAsString);
HTableDescriptor htd = UTIL.createTableDescriptor(tnAsString);
HColumnDescriptor hcd = new HColumnDescriptor(Bytes.toBytes("cf"));
htd.addFamily(hcd);
UTIL.createTable(htd, null);
HRegionServer regionServer = UTIL.getRSForFirstRegionInTable(tn);
ClusterConnection connection = regionServer.getConnection();
HTableInterface tableIf = connection.getTable(tn);
assertTrue(tableIf instanceof HTable);
HTable table = (HTable) tableIf;
assertTrue(table.getConnection() == connection);
AdminService.BlockingInterface admin = connection.getAdmin(regionServer.getServerName());
ClientService.BlockingInterface client = connection.getClient(regionServer.getServerName());
assertTrue(admin instanceof RSRpcServices);
assertTrue(client instanceof RSRpcServices);
ServerName anotherSn = ServerName.valueOf(regionServer.getServerName().getHostAndPort(),
EnvironmentEdgeManager.currentTime());
admin = connection.getAdmin(anotherSn);
client = connection.getClient(anotherSn);
assertFalse(admin instanceof RSRpcServices);
assertFalse(client instanceof RSRpcServices);
assertTrue(connection.getAdmin().getConnection() == connection);
}
示例8: bulkLoadHFile
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
/**
* A helper to bulk load a list of HFiles using client protocol.
*
* @param client
* @param familyPaths
* @param regionName
* @param assignSeqNum
* @return true if all are loaded
* @throws IOException
*/
public static boolean bulkLoadHFile(final ClientService.BlockingInterface client,
final List<Pair<byte[], String>> familyPaths,
final byte[] regionName, boolean assignSeqNum) throws IOException {
BulkLoadHFileRequest request =
RequestConverter.buildBulkLoadHFileRequest(familyPaths, regionName, assignSeqNum);
try {
BulkLoadHFileResponse response =
client.bulkLoadHFile(null, request);
return response.getLoaded();
} catch (ServiceException se) {
throw getRemoteException(se);
}
}
示例9: execService
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
public static CoprocessorServiceResponse execService(final RpcController controller,
final ClientService.BlockingInterface client, final CoprocessorServiceCall call,
final byte[] regionName) throws IOException {
CoprocessorServiceRequest request = CoprocessorServiceRequest.newBuilder()
.setCall(call).setRegion(
RequestConverter.buildRegionSpecifier(REGION_NAME, regionName)).build();
try {
CoprocessorServiceResponse response =
client.execService(controller, request);
return response;
} catch (ServiceException se) {
throw getRemoteException(se);
}
}
示例10: ManyServersManyRegionsConnection
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
ManyServersManyRegionsConnection(Configuration conf, boolean managed,
ExecutorService pool, User user)
throws IOException {
super(conf, managed, pool, user);
int serverCount = conf.getInt("hbase.test.servers", 10);
this.serversByClient =
new HashMap<ServerName, ClientService.BlockingInterface>(serverCount);
this.meta = makeMeta(Bytes.toBytes(
conf.get("hbase.test.tablename", Bytes.toString(BIG_USER_TABLE))),
conf.getInt("hbase.test.regions", 100),
conf.getLong("hbase.test.namespace.span", 1000),
serverCount);
this.conf = conf;
}
示例11: getClient
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
@Override
public ClientService.BlockingInterface getClient(ServerName sn) throws IOException {
// if (!sn.toString().startsWith("meta")) LOG.info(sn);
ClientService.BlockingInterface stub = null;
synchronized (this.serversByClient) {
stub = this.serversByClient.get(sn);
if (stub == null) {
stub = new FakeServer(this.conf, meta, sequenceids);
this.serversByClient.put(sn, stub);
}
}
return stub;
}
示例12: execService
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
public static CoprocessorServiceResponse execService(final ClientService.BlockingInterface client,
final CoprocessorServiceCall call, final byte[] regionName) throws IOException {
CoprocessorServiceRequest request = CoprocessorServiceRequest.newBuilder()
.setCall(call).setRegion(
RequestConverter.buildRegionSpecifier(REGION_NAME, regionName)).build();
try {
CoprocessorServiceResponse response =
client.execService(null, request);
return response;
} catch (ServiceException se) {
throw getRemoteException(se);
}
}
示例13: execService
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
public static CoprocessorServiceResponse execService(
final ClientService.BlockingInterface client, final CoprocessorServiceCall call,
final byte[] regionName, PayloadCarryingRpcController controller) throws IOException {
CoprocessorServiceRequest request = CoprocessorServiceRequest.newBuilder()
.setCall(call).setRegion(
RequestConverter.buildRegionSpecifier(REGION_NAME, regionName)).build();
try {
CoprocessorServiceResponse response =
client.execService(controller, request);
return response;
} catch (ServiceException se) {
throw getRemoteException(se);
}
}
示例14: bulkLoadHFile
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
/**
* A helper to bulk load a list of HFiles using client protocol.
*
* @param client
* @param familyPaths
* @param regionName
* @param assignSeqNum
* @param controller
* @return true if all are loaded
* @throws IOException
*/
public static boolean bulkLoadHFile(final ClientService.BlockingInterface client,
final List<Pair<byte[], String>> familyPaths, final byte[] regionName, boolean assignSeqNum,
PayloadCarryingRpcController controller) throws IOException {
BulkLoadHFileRequest request =
RequestConverter.buildBulkLoadHFileRequest(familyPaths, regionName, assignSeqNum);
try {
BulkLoadHFileResponse response =
client.bulkLoadHFile(controller, request);
return response.getLoaded();
} catch (ServiceException se) {
throw getRemoteException(se);
}
}
示例15: getRowOrBefore
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入方法依赖的package包/类
/**
* A helper to get a row of the closet one before using client protocol.
*
* @param client
* @param regionName
* @param row
* @param family
* @return the row or the closestRowBefore if it doesn't exist
* @throws IOException
*/
public static Result getRowOrBefore(final ClientService.BlockingInterface client,
final byte[] regionName, final byte[] row,
final byte[] family) throws IOException {
GetRequest request =
RequestConverter.buildGetRowOrBeforeRequest(
regionName, row, family);
try {
GetResponse response = client.get(null, request);
if (!response.hasResult()) return null;
return toResult(response.getResult());
} catch (ServiceException se) {
throw getRemoteException(se);
}
}