本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService类的典型用法代码示例。如果您正苦于以下问题:Java ClientService类的具体用法?Java ClientService怎么用?Java ClientService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClientService类属于org.apache.hadoop.hbase.protobuf.generated.ClientProtos包,在下文中一共展示了ClientService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:ProtobufUtil.java
示例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);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:ProtobufUtil.java
示例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;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:ConnectionManager.java
示例4: ScanOpenNextThenExceptionThenRecoverConnection
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入依赖的package包/类
ScanOpenNextThenExceptionThenRecoverConnection(Configuration conf,
boolean managed, ExecutorService pool) throws IOException {
super(conf, managed);
// Mock up my stub so open scanner returns a scanner id and then on next, we throw
// exceptions for three times and then after that, we return no more to scan.
this.stub = Mockito.mock(ClientService.BlockingInterface.class);
long sid = 12345L;
try {
Mockito.when(stub.scan((RpcController)Mockito.any(),
(ClientProtos.ScanRequest)Mockito.any())).
thenReturn(ClientProtos.ScanResponse.newBuilder().setScannerId(sid).build()).
thenThrow(new ServiceException(new RegionServerStoppedException("From Mockito"))).
thenReturn(ClientProtos.ScanResponse.newBuilder().setScannerId(sid).
setMoreResults(false).build());
} catch (ServiceException e) {
throw new IOException(e);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestClientNoCluster.java
示例5: RegionServerStoppedOnScannerOpenConnection
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入依赖的package包/类
RegionServerStoppedOnScannerOpenConnection(Configuration conf, boolean managed,
ExecutorService pool, User user) throws IOException {
super(conf, managed);
// Mock up my stub so open scanner returns a scanner id and then on next, we throw
// exceptions for three times and then after that, we return no more to scan.
this.stub = Mockito.mock(ClientService.BlockingInterface.class);
long sid = 12345L;
try {
Mockito.when(stub.scan((RpcController)Mockito.any(),
(ClientProtos.ScanRequest)Mockito.any())).
thenReturn(ClientProtos.ScanResponse.newBuilder().setScannerId(sid).build()).
thenThrow(new ServiceException(new RegionServerStoppedException("From Mockito"))).
thenReturn(ClientProtos.ScanResponse.newBuilder().setScannerId(sid).
setMoreResults(false).build());
} catch (ServiceException e) {
throw new IOException(e);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestClientNoCluster.java
示例6: 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);
}
}
开发者ID:grokcoder,项目名称:pbase,代码行数:25,代码来源:ProtobufUtil.java
示例7: 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;
}
开发者ID:grokcoder,项目名称:pbase,代码行数:23,代码来源:ConnectionManager.java
示例8: 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;
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:23,代码来源:HConnectionManager.java
示例9: 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;
}
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:23,代码来源:ConnectionManager.java
示例10: getServices
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入依赖的package包/类
/**
* @return list of blocking services and their security info classes that this server supports
*/
protected List<BlockingServiceAndInterface> getServices() {
List<BlockingServiceAndInterface> bssi = new ArrayList<BlockingServiceAndInterface>(2);
bssi.add(new BlockingServiceAndInterface(
ClientService.newReflectiveBlockingService(this),
ClientService.BlockingInterface.class));
bssi.add(new BlockingServiceAndInterface(
AdminService.newReflectiveBlockingService(this),
AdminService.BlockingInterface.class));
return bssi;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:RSRpcServices.java
示例11: 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);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:TestShortCircuitConnection.java
示例12: 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);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:ProtobufUtil.java
示例13: 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);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:ProtobufUtil.java
示例14: RpcTimeoutConnection
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入依赖的package包/类
RpcTimeoutConnection(Configuration conf, boolean managed, ExecutorService pool, User user)
throws IOException {
super(conf, managed);
// Mock up my stub so an exists call -- which turns into a get -- throws an exception
this.stub = Mockito.mock(ClientService.BlockingInterface.class);
try {
Mockito.when(stub.get((RpcController)Mockito.any(),
(ClientProtos.GetRequest)Mockito.any())).
thenThrow(new ServiceException(new RegionServerStoppedException("From Mockito")));
} catch (ServiceException e) {
throw new IOException(e);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:TestClientNoCluster.java
示例15: 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;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:TestClientNoCluster.java
示例16: 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;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:TestClientNoCluster.java
示例17: getServices
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入依赖的package包/类
/**
* @return list of blocking services and their security info classes that this server supports
*/
protected List<BlockingServiceAndInterface> getServices() {
List<BlockingServiceAndInterface> bssi = new ArrayList<BlockingServiceAndInterface>(2);
bssi.add(new BlockingServiceAndInterface(
ClientService.newReflectiveBlockingService(this),
ClientService.BlockingInterface.class));
bssi.add(new BlockingServiceAndInterface(
AdminService.newReflectiveBlockingService(this),
AdminService.BlockingInterface.class));
return bssi;
}
开发者ID:grokcoder,项目名称:pbase,代码行数:14,代码来源:RSRpcServices.java
示例18: 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);
}
}
开发者ID:grokcoder,项目名称:pbase,代码行数:14,代码来源:ProtobufUtil.java
示例19: getClient
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; //导入依赖的package包/类
public org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface
getClient(ServerName serverName) throws IOException {
// client is trying to reach off-server, so we can't do anything special
if (!this.serverName.equals(serverName)) {
return delegate.getClient(serverName);
}
// the client is attempting to write to the same regionserver, we can short-circuit to our
// local regionserver
final BlockingService blocking = ClientService.newReflectiveBlockingService(this.server);
final RpcServerInterface rpc = this.server.getRpcServer();
final MonitoredRPCHandler status =
TaskMonitor.get().createRPCStatus(Thread.currentThread().getName());
status.pause("Setting up server-local call");
final long timestamp = EnvironmentEdgeManager.currentTimeMillis();
BlockingRpcChannel channel = new BlockingRpcChannel() {
@Override
public Message callBlockingMethod(MethodDescriptor method, RpcController controller,
Message request, Message responsePrototype) throws ServiceException {
try {
// we never need a cell-scanner - everything is already fully formed
return rpc.call(blocking, method, request, null, timestamp, status).getFirst();
} catch (IOException e) {
throw new ServiceException(e);
}
}
};
return ClientService.newBlockingStub(channel);
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:32,代码来源:CoprocessorHConnection.java
示例20: 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
* @param payloadCarryingRpcController
* @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,
PayloadCarryingRpcController payloadCarryingRpcController) throws IOException {
GetRequest request =
RequestConverter.buildGetRowOrBeforeRequest(
regionName, row, family);
try {
GetResponse response = client.get(payloadCarryingRpcController, request);
if (!response.hasResult()) return null;
return toResult(response.getResult());
} catch (ServiceException se) {
throw getRemoteException(se);
}
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:25,代码来源:ProtobufUtil.java
注:本文中的org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论