java enumberation_Java ServerCallable類代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.ServerCallable類的典型用法代碼示例。如果您正苦於以下問題:Java ServerCallable類的具體用法?Java ServerCallable怎麽用?Java ServerCallable使用的例子?那麽恭喜您, 這裏精選的類代碼示例或許可以為您提供幫助。

ServerCallable類屬於org.apache.hadoop.hbase.client包,在下文中一共展示了ServerCallable類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: putAndCommit

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

@SuppressWarnings({ "deprecation" })

public static void putAndCommit(HTable table, final Put put) throws IOException {

try {

table.getConnection().getRegionServerWithRetries(

new ServerCallable(table.getConnection(), table.getTableName(), put.getRow()) {

public Boolean call() throws Exception {

server.put(location.getRegionInfo().getRegionName(), put);

return true;

}

});

} catch (Exception e) {

throw new IOException(e);

}

}

開發者ID:javachen,項目名稱:learning-hadoop,代碼行數:15,

示例2: tryAtomicRegionLoad

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

/**

* Attempts to do an atomic load of many hfiles into a region. If it fails,

* it returns a list of hfiles that need to be retried. If it is successful

* it will return an empty list.

*

* NOTE: To maintain row atomicity guarantees, region server callable should

* succeed atomically and fails atomically.

*

* Protected for testing.

*

* @return empty list if success, list of items to retry on recoverable

* failure

*/

protected List tryAtomicRegionLoad(final HConnection conn,

byte[] tableName, final byte[] first, Collection lqis) throws IOException {

final List> famPaths =

new ArrayList>(lqis.size());

for (LoadQueueItem lqi : lqis) {

famPaths.add(Pair.newPair(lqi.family, lqi.hfilePath.toString()));

}

final ServerCallable svrCallable = new ServerCallable(conn,

tableName, first) {

@Override

public Boolean call() throws Exception {

LOG.debug("Going to connect to server " + location + " for row "

+ Bytes.toStringBinary(row));

byte[] regionName = location.getRegionInfo().getRegionName();

return server.bulkLoadHFiles(famPaths, regionName);

}

};

try {

List toRetry = new ArrayList();

boolean success = conn.getRegionServerWithRetries(svrCallable);

if (!success) {

LOG.warn("Attempt to bulk load region containing "

+ Bytes.toStringBinary(first) + " into table "

+ Bytes.toStringBinary(tableName) + " with files " + lqis

+ " failed. This is recoverable and they will be retried.");

toRetry.addAll(lqis); // return lqi's to retry

}

// success

return toRetry;

} catch (IOException e) {

LOG.error("Encountered unrecoverable error from region server", e);

throw e;

}

}

開發者ID:lifeng5042,項目名稱:RStore,代碼行數:51,

示例3: tryAtomicRegionLoad

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

/**

* Attempts to do an atomic load of many hfiles into a region. If it fails,

* it returns a list of hfiles that need to be retried. If it is successful

* it will return an empty list.

*

* NOTE: To maintain row atomicity guarantees, region server callable should

* succeed atomically and fails atomically.

*

* Protected for testing.

*

* @return empty list if success, list of items to retry on recoverable

* failure

*/

protected List tryAtomicRegionLoad(final HConnection conn,

byte[] tableName, final byte[] first, Collection lqis) throws IOException {

final List> famPaths =

new ArrayList>(lqis.size());

for (LoadQueueItem lqi : lqis) {

famPaths.add(Pair.newPair(lqi.family, lqi.hfilePath.toString()));

}

final ServerCallable svrCallable = new ServerCallable(conn,

tableName, first) {

@Override

public Boolean call() throws Exception {

LOG.debug("Going to connect to server " + location + " for row "

+ Bytes.toStringBinary(row));

byte[] regionName = location.getRegionInfo().getRegionName();

return ProtobufUtil.bulkLoadHFile(server, famPaths, regionName,

assignSeqIds);

}

};

try {

List toRetry = new ArrayList();

boolean success = svrCallable.withRetries();

if (!success) {

LOG.warn("Attempt to bulk load region containing "

+ Bytes.toStringBinary(first) + " into table "

+ Bytes.toStringBinary(tableName) + " with files " + lqis

+ " failed. This is recoverable and they will be retried.");

toRetry.addAll(lqis); // return lqi's to retry

}

// success

return toRetry;

} catch (IOException e) {

LOG.error("Encountered unrecoverable error from region server", e);

throw e;

}

}

開發者ID:daidong,項目名稱:DominoHBase,代碼行數:52,

示例4: callExecService

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

@Override

protected Message callExecService(Descriptors.MethodDescriptor method,

Message request, Message responsePrototype)

throws IOException {

if (LOG.isDebugEnabled()) {

LOG.debug("Call: "+method.getName()+", "+request.toString());

}

if (row == null) {

throw new IllegalArgumentException("Missing row property for remote region location");

}

final ClientProtos.CoprocessorServiceCall call =

ClientProtos.CoprocessorServiceCall.newBuilder()

.setRow(ByteString.copyFrom(row))

.setServiceName(method.getService().getFullName())

.setMethodName(method.getName())

.setRequest(request.toByteString()).build();

ServerCallable callable =

new ServerCallable(connection, table, row) {

public CoprocessorServiceResponse call() throws Exception {

byte[] regionName = location.getRegionInfo().getRegionName();

return ProtobufUtil.execService(server, call, regionName);

}

};

CoprocessorServiceResponse result = callable.withRetries();

Message response = null;

if (result.getValue().hasValue()) {

response = responsePrototype.newBuilderForType()

.mergeFrom(result.getValue().getValue()).build();

} else {

response = responsePrototype.getDefaultInstanceForType();

}

lastRegion = result.getRegion().getValue().toByteArray();

if (LOG.isTraceEnabled()) {

LOG.trace("Result is region=" + Bytes.toStringBinary(lastRegion) + ", value=" + response);

}

return response;

}

開發者ID:daidong,項目名稱:DominoHBase,代碼行數:40,

示例5: tryAtomicRegionLoad

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

/**

* Attempts to do an atomic load of many hfiles into a region. If it fails, it returns a list of

* hfiles that need to be retried. If it is successful it will return an empty list. NOTE: To

* maintain row atomicity guarantees, region server callable should succeed atomically and fails

* atomically. Protected for testing.

* @return empty list if success, list of items to retry on recoverable failure

*/

protected List tryAtomicRegionLoad(final HConnection conn, byte[] tableName,

final byte[] first, Collection lqis) throws IOException {

final List> famPaths = new ArrayList>(lqis.size());

for (LoadQueueItem lqi : lqis) {

famPaths.add(Pair.newPair(lqi.family, lqi.hfilePath.toString()));

}

final ServerCallable svrCallable =

new ServerCallable(conn, tableName, first) {

@Override

public Boolean call() throws Exception {

if (LOG.isDebugEnabled()) {

LOG.debug("Going to connect to server " + location + " for row "

+ Bytes.toStringBinary(row));

}

byte[] regionName = location.getRegionInfo().getRegionName();

return server.bulkLoadHFiles(famPaths, regionName);

}

};

try {

List toRetry = new ArrayList();

boolean success = svrCallable.withRetries();

if (!success) {

LOG.warn("Attempt to bulk load region containing " + Bytes.toStringBinary(first)

+ " into table " + Bytes.toStringBinary(tableName) + " with files " + lqis

+ " failed. This is recoverable and they will be retried.");

toRetry.addAll(lqis); // return lqi's to retry

}

// success

return toRetry;

} catch (IOException e) {

LOG.error("Encountered unrecoverable error from region server", e);

throw e;

}

}

開發者ID:Huawei-Hadoop,項目名稱:hindex,代碼行數:45,

示例6: testServerNotRunningIOException

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

/**

* Test for HBASE-4288. Throw an IOE when trying to verify meta region and

* prove it doesn't cause master shutdown.

* @see HBASE-4288

* @throws IOException

* @throws InterruptedException

* @throws KeeperException

*/

@Test

public void testServerNotRunningIOException()

throws IOException, InterruptedException, KeeperException {

// Mock an HRegionInterface.

final HRegionInterface implementation = Mockito.mock(HRegionInterface.class);

HConnection connection = mockConnection(implementation);

// If a 'getRegionInfo' is called on mocked HRegionInterface, throw IOE

// the first time. 'Succeed' the second time we are called.

Mockito.when(implementation.getRegionInfo((byte[]) Mockito.any())).

thenThrow(new IOException("Server not running, aborting")).

thenReturn(new HRegionInfo());

// After we encounter the above 'Server not running', we should catch the

// IOE and go into retrying for the meta mode. We'll do gets on -ROOT- to

// get new meta location. Return something so this 'get' succeeds

// (here we mock up getRegionServerWithRetries, the wrapper around

// the actual get).

// TODO: Refactor. This method has been moved out of HConnection.

// It works for now but has been deprecated.

Mockito.when(connection.getRegionServerWithRetries((ServerCallable)Mockito.any())).

thenReturn(getMetaTableRowResult());

// Now start up the catalogtracker with our doctored Connection.

final CatalogTracker ct = constructAndStartCatalogTracker(connection);

try {

// Set a location for root and meta.

RootLocationEditor.setRootLocation(this.watcher, SN);

ct.setMetaLocation(SN);

// Call the method that HBASE-4288 calls. It will try and verify the

// meta location and will fail on first attempt then go into a long wait.

// So, do this in a thread and then reset meta location to break it out

// of its wait after a bit of time.

final AtomicBoolean metaSet = new AtomicBoolean(false);

final CountDownLatch latch = new CountDownLatch(1);

Thread t = new Thread() {

@Override

public void run() {

try {

latch.countDown();

metaSet.set(ct.waitForMeta(100000) != null);

} catch (Exception e) {

throw new RuntimeException(e);

}

}

};

t.start();

latch.await();

Threads.sleep(1);

// Now reset the meta as though it were redeployed.

ct.setMetaLocation(SN);

t.join();

Assert.assertTrue(metaSet.get());

} finally {

// Clean out root and meta locations or later tests will be confused...

// they presume start fresh in zk.

ct.resetMetaLocation();

}

}

開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:69,

示例7: testNoTimeoutWaitForMeta

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

/**

* Test waiting on meta w/ no timeout specified.

* @throws Exception

*/

@Ignore // Can't make it work reliably on all platforms; mockito gets confused

// Throwing: org.mockito.exceptions.misusing.WrongTypeOfReturnValue:

// Result cannot be returned by locateRegion()

// If you plug locateRegion, it then throws for incCounter, and if you plug

// that ... and so one.

@Test public void testNoTimeoutWaitForMeta()

throws Exception {

// Mock an HConnection and a HRegionInterface implementation. Have the

// HConnection return the HRI. Have the HRI return a few mocked up responses

// to make our test work.

// Mock an HRegionInterface.

final HRegionInterface implementation = Mockito.mock(HRegionInterface.class);

HConnection connection = mockConnection(implementation);

// Now the ct is up... set into the mocks some answers that make it look

// like things have been getting assigned. Make it so we'll return a

// location (no matter what the Get is). Same for getHRegionInfo -- always

// just return the meta region.

final Result result = getMetaTableRowResult();

// TODO: Refactor. This method has been moved out of HConnection.

// It works for now but has been deprecated.

Mockito.when(connection.getRegionServerWithRetries((ServerCallable)Mockito.any())).

thenReturn(result);

Mockito.when(implementation.getRegionInfo((byte[]) Mockito.any())).

thenReturn(HRegionInfo.FIRST_META_REGIONINFO);

final CatalogTracker ct = constructAndStartCatalogTracker(connection);

ServerName hsa = ct.getMetaLocation();

Assert.assertNull(hsa);

// Now test waiting on meta location getting set.

Thread t = new WaitOnMetaThread(ct) {

@Override

void doWaiting() throws InterruptedException {

this.ct.waitForMeta();

}

};

startWaitAliveThenWaitItLives(t, 1000);

// This should trigger wake up of meta wait (Its the removal of the meta

// region unassigned node that triggers catalogtrackers that a meta has

// been assigned).

String node = ct.getMetaNodeTracker().getNode();

ZKUtil.createAndFailSilent(this.watcher, node);

MetaEditor.updateMetaLocation(ct, HRegionInfo.FIRST_META_REGIONINFO, SN);

ZKUtil.deleteNode(this.watcher, node);

// Go get the new meta location. waitForMeta gets and verifies meta.

Assert.assertTrue(ct.waitForMeta(10000).equals(SN));

// Join the thread... should exit shortly.

t.join();

// Now meta is available.

Assert.assertTrue(ct.waitForMeta(10000).equals(SN));

}

開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:58,

示例8: doAnAction

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

public void doAnAction() throws Exception {

long iteration = numBulkLoads.getAndIncrement();

Path dir = UTIL.getDataTestDir(String.format("bulkLoad_%08d",

iteration));

// create HFiles for different column families

FileSystem fs = UTIL.getTestFileSystem();

byte[] val = Bytes.toBytes(String.format("%010d", iteration));

final List> famPaths = new ArrayList>(

NUM_CFS);

for (int i = 0; i < NUM_CFS; i++) {

Path hfile = new Path(dir, family(i));

byte[] fam = Bytes.toBytes(family(i));

createHFile(fs, hfile, fam, QUAL, val, 1000);

famPaths.add(new Pair(fam, hfile.toString()));

}

// bulk load HFiles

HConnection conn = UTIL.getHBaseAdmin().getConnection();

byte[] tbl = Bytes.toBytes(tableName);

new ServerCallable(conn, tbl, Bytes

.toBytes("aaa")) {

@Override

public Void call() throws Exception {

LOG.debug("Going to connect to server " + location + " for row "

+ Bytes.toStringBinary(row));

byte[] regionName = location.getRegionInfo().getRegionName();

server.bulkLoadHFiles(famPaths, regionName, true);

return null;

}

}.withRetries();

// Periodically do compaction to reduce the number of open file handles.

if (numBulkLoads.get() % 10 == 0) {

// 10 * 50 = 500 open file handles!

new ServerCallable(conn, tbl,

Bytes.toBytes("aaa")) {

@Override

public Void call() throws Exception {

LOG.debug("compacting " + location + " for row "

+ Bytes.toStringBinary(row));

server.compactRegion(location.getRegionInfo(), true);

numCompactions.incrementAndGet();

return null;

}

}.withRetries();

}

}

開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:49,

示例9: testServerNotRunningIOException

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

/**

* Test for HBASE-4288. Throw an IOE when trying to verify meta region and

* prove it doesn't cause master shutdown.

* @see HBASE-4288

* @throws IOException

* @throws InterruptedException

* @throws KeeperException

*/

@Test

public void testServerNotRunningIOException()

throws IOException, InterruptedException, KeeperException {

// Mock an HRegionInterface.

final HRegionInterface implementation = Mockito.mock(HRegionInterface.class);

HConnection connection = mockConnection(implementation);

try {

// If a 'getRegionInfo' is called on mocked HRegionInterface, throw IOE

// the first time. 'Succeed' the second time we are called.

Mockito.when(implementation.getRegionInfo((byte[]) Mockito.any())).

thenThrow(new IOException("Server not running, aborting")).

thenReturn(new HRegionInfo());

// After we encounter the above 'Server not running', we should catch the

// IOE and go into retrying for the meta mode. We'll do gets on -ROOT- to

// get new meta location. Return something so this 'get' succeeds

// (here we mock up getRegionServerWithRetries, the wrapper around

// the actual get).

// TODO: Refactor. This method has been moved out of HConnection.

// It works for now but has been deprecated.

Mockito.when(connection.getRegionServerWithRetries((ServerCallable)Mockito.any())).

thenReturn(getMetaTableRowResult());

// Now start up the catalogtracker with our doctored Connection.

final CatalogTracker ct = constructAndStartCatalogTracker(connection);

try {

// Set a location for root and meta.

RootLocationEditor.setRootLocation(this.watcher, SN);

ct.setMetaLocation(SN);

// Call the method that HBASE-4288 calls. It will try and verify the

// meta location and will fail on first attempt then go into a long wait.

// So, do this in a thread and then reset meta location to break it out

// of its wait after a bit of time.

final AtomicBoolean metaSet = new AtomicBoolean(false);

final CountDownLatch latch = new CountDownLatch(1);

Thread t = new Thread() {

@Override

public void run() {

try {

latch.countDown();

metaSet.set(ct.waitForMeta(100000) != null);

} catch (Exception e) {

throw new RuntimeException(e);

}

}

};

t.start();

latch.await();

Threads.sleep(1);

// Now reset the meta as though it were redeployed.

ct.setMetaLocation(SN);

t.join();

Assert.assertTrue(metaSet.get());

} finally {

// Clean out root and meta locations or later tests will be confused...

// they presume start fresh in zk.

ct.resetMetaLocation();

RootLocationEditor.deleteRootLocation(this.watcher);

}

} finally {

// Clear out our doctored connection or could mess up subsequent tests.

HConnectionManager.deleteConnection(UTIL.getConfiguration());

}

}

開發者ID:zwqjsj0404,項目名稱:HBase-Research,代碼行數:74,

示例10: testNoTimeoutWaitForMeta

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

/**

* Test waiting on meta w/ no timeout specified.

* @throws Exception

*/

@Ignore // Can't make it work reliably on all platforms; mockito gets confused

// Throwing: org.mockito.exceptions.misusing.WrongTypeOfReturnValue:

// Result cannot be returned by locateRegion()

// If you plug locateRegion, it then throws for incCounter, and if you plug

// that ... and so one.

@Test public void testNoTimeoutWaitForMeta()

throws Exception {

// Mock an HConnection and a HRegionInterface implementation. Have the

// HConnection return the HRI. Have the HRI return a few mocked up responses

// to make our test work.

// Mock an HRegionInterface.

final HRegionInterface implementation = Mockito.mock(HRegionInterface.class);

HConnection connection = mockConnection(implementation);

try {

// Now the ct is up... set into the mocks some answers that make it look

// like things have been getting assigned. Make it so we'll return a

// location (no matter what the Get is). Same for getHRegionInfo -- always

// just return the meta region.

final Result result = getMetaTableRowResult();

// TODO: Refactor. This method has been moved out of HConnection.

// It works for now but has been deprecated.

Mockito.when(connection.getRegionServerWithRetries((ServerCallable)Mockito.any())).

thenReturn(result);

Mockito.when(implementation.getRegionInfo((byte[]) Mockito.any())).

thenReturn(HRegionInfo.FIRST_META_REGIONINFO);

final CatalogTracker ct = constructAndStartCatalogTracker(connection);

ServerName hsa = ct.getMetaLocation();

Assert.assertNull(hsa);

// Now test waiting on meta location getting set.

Thread t = new WaitOnMetaThread(ct) {

@Override

void doWaiting() throws InterruptedException {

this.ct.waitForMeta();

}

};

startWaitAliveThenWaitItLives(t, 1000);

// This should trigger wake up of meta wait (Its the removal of the meta

// region unassigned node that triggers catalogtrackers that a meta has

// been assigned).

String node = ct.getMetaNodeTracker().getNode();

ZKUtil.createAndFailSilent(this.watcher, node);

MetaEditor.updateMetaLocation(ct, HRegionInfo.FIRST_META_REGIONINFO, SN);

ZKUtil.deleteNode(this.watcher, node);

// Go get the new meta location. waitForMeta gets and verifies meta.

Assert.assertTrue(ct.waitForMeta(10000).equals(SN));

// Join the thread... should exit shortly.

t.join();

// Now meta is available.

Assert.assertTrue(ct.waitForMeta(10000).equals(SN));

} finally {

HConnectionManager.deleteConnection(UTIL.getConfiguration());

}

}

開發者ID:zwqjsj0404,項目名稱:HBase-Research,代碼行數:61,

示例11: doAnAction

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

public void doAnAction() throws Exception {

long iteration = numBulkLoads.getAndIncrement();

Path dir = UTIL.getDataTestDir(String.format("bulkLoad_%08d",

iteration));

// create HFiles for different column families

FileSystem fs = UTIL.getTestFileSystem();

byte[] val = Bytes.toBytes(String.format("%010d", iteration));

final List> famPaths = new ArrayList>(

NUM_CFS);

for (int i = 0; i < NUM_CFS; i++) {

Path hfile = new Path(dir, family(i));

byte[] fam = Bytes.toBytes(family(i));

createHFile(fs, hfile, fam, QUAL, val, 1000);

famPaths.add(new Pair(fam, hfile.toString()));

}

// bulk load HFiles

HConnection conn = UTIL.getHBaseAdmin().getConnection();

byte[] tbl = Bytes.toBytes(tableName);

new ServerCallable(conn, tbl, Bytes

.toBytes("aaa")) {

@Override

public Void call() throws Exception {

LOG.debug("Going to connect to server " + location + " for row "

+ Bytes.toStringBinary(row));

byte[] regionName = location.getRegionInfo().getRegionName();

server.bulkLoadHFiles(famPaths, regionName);

return null;

}

}.withRetries();

// Periodically do compaction to reduce the number of open file handles.

if (numBulkLoads.get() % 10 == 0) {

// 10 * 50 = 500 open file handles!

new ServerCallable(conn, tbl,

Bytes.toBytes("aaa")) {

@Override

public Void call() throws Exception {

LOG.debug("compacting " + location + " for row "

+ Bytes.toStringBinary(row));

server.compactRegion(location.getRegionInfo(), true);

numCompactions.incrementAndGet();

return null;

}

}.withRetries();

}

}

開發者ID:zwqjsj0404,項目名稱:HBase-Research,代碼行數:49,

示例12: testNoTimeoutWaitForMeta

​點讚 2

import org.apache.hadoop.hbase.client.ServerCallable; //導入依賴的package包/類

/**

* Test waiting on meta w/ no timeout specified.

* @throws Exception

*/

@Ignore // Can't make it work reliably on all platforms; mockito gets confused

// Throwing: org.mockito.exceptions.misusing.WrongTypeOfReturnValue:

// Result cannot be returned by locateRegion()

// If you plug locateRegion, it then throws for incCounter, and if you plug

// that ... and so one.

@Test public void testNoTimeoutWaitForMeta()

throws Exception {

// Mock an HConnection and a AdminProtocol implementation. Have the

// HConnection return the HRI. Have the HRI return a few mocked up responses

// to make our test work.

// Mock an AdminProtocol.

final AdminProtocol implementation = Mockito.mock(AdminProtocol.class);

HConnection connection = mockConnection(implementation, null);

try {

// Now the ct is up... set into the mocks some answers that make it look

// like things have been getting assigned. Make it so we'll return a

// location (no matter what the Get is). Same for getHRegionInfo -- always

// just return the meta region.

final Result result = getMetaTableRowResult();

// TODO: Refactor. This method has been moved out of HConnection.

// It works for now but has been deprecated.

Mockito.when(connection.getRegionServerWithRetries((ServerCallable)Mockito.any())).

thenReturn(result);

GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();

builder.setRegionInfo(HRegionInfo.convert(HRegionInfo.FIRST_META_REGIONINFO));

Mockito.when(implementation.getRegionInfo((RpcController)Mockito.any(),

(GetRegionInfoRequest)Mockito.any())).thenReturn(builder.build());

final CatalogTracker ct = constructAndStartCatalogTracker(connection);

ServerName hsa = ct.getMetaLocation();

Assert.assertNull(hsa);

// Now test waiting on meta location getting set.

Thread t = new WaitOnMetaThread(ct) {

@Override

void doWaiting() throws InterruptedException {

this.ct.waitForMeta();

}

};

startWaitAliveThenWaitItLives(t, 1000);

// This should trigger wake up of meta wait (Its the removal of the meta

// region unassigned node that triggers catalogtrackers that a meta has

// been assigned).

String node = ct.getMetaNodeTracker().getNode();

ZKUtil.createAndFailSilent(this.watcher, node);

MetaEditor.updateMetaLocation(ct, HRegionInfo.FIRST_META_REGIONINFO, SN);

ZKUtil.deleteNode(this.watcher, node);

// Go get the new meta location. waitForMeta gets and verifies meta.

Assert.assertTrue(ct.waitForMeta(10000).equals(SN));

// Join the thread... should exit shortly.

t.join();

// Now meta is available.

Assert.assertTrue(ct.waitForMeta(10000).equals(SN));

} finally {

HConnectionManager.deleteConnection(UTIL.getConfiguration(), true);

}

}

開發者ID:daidong,項目名稱:DominoHBase,代碼行數:63,

注:本文中的org.apache.hadoop.hbase.client.ServerCallable類示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值