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


Java TIOError类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.thrift2.generated.TIOError的典型用法代码示例。如果您正苦于以下问题:Java TIOError类的具体用法?Java TIOError怎么用?Java TIOError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TIOError类属于org.apache.hadoop.hbase.thrift2.generated包,在下文中一共展示了TIOError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkAndDelete

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Override
public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family,
    ByteBuffer qualifier, ByteBuffer value, TDelete deleteSingle) throws TIOError, TException {
  Table htable = getTable(table);

  try {
    if (value == null) {
      return htable.checkAndDelete(byteBufferToByteArray(row), byteBufferToByteArray(family),
        byteBufferToByteArray(qualifier), null, deleteFromThrift(deleteSingle));
    } else {
      return htable.checkAndDelete(byteBufferToByteArray(row), byteBufferToByteArray(family),
        byteBufferToByteArray(qualifier), byteBufferToByteArray(value),
        deleteFromThrift(deleteSingle));
    }
  } catch (IOException e) {
    throw getTIOError(e);
  } finally {
    closeTable(htable);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:ThriftHBaseServiceHandler.java

示例2: getScannerRows

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Override
public List<TResult> getScannerRows(int scannerId, int numRows) throws TIOError,
    TIllegalArgument, TException {
  ResultScanner scanner = getScanner(scannerId);
  if (scanner == null) {
    TIllegalArgument ex = new TIllegalArgument();
    ex.setMessage("Invalid scanner Id");
    throw ex;
  }

  try {
    return resultsFromHBase(scanner.next(numRows));
  } catch (IOException e) {
    throw getTIOError(e);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:ThriftHBaseServiceHandler.java

示例3: getScannerResults

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Override
public List<TResult> getScannerResults(ByteBuffer table, TScan scan, int numRows)
    throws TIOError, TException {
  Table htable = getTable(table);
  List<TResult> results = null;
  ResultScanner scanner = null;
  try {
    scanner = htable.getScanner(scanFromThrift(scan));
    results = resultsFromHBase(scanner.next(numRows));
  } catch (IOException e) {
    throw getTIOError(e);
  } finally {
    if (scanner != null) {
      scanner.close();
    }
    closeTable(htable);
  }
  return results;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:ThriftHBaseServiceHandler.java

示例4: testExists

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Test
public void testExists() throws TIOError, TException {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = "testExists".getBytes();
  ByteBuffer table = wrap(tableAname);

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestThriftHBaseServiceHandler.java

示例5: checkAndDelete

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Override
public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family,
    ByteBuffer qualifier, ByteBuffer value, TDelete deleteSingle) throws TIOError, TException {
  HTableInterface htable = getTable(table);

  try {
    if (value == null) {
      return htable.checkAndDelete(byteBufferToByteArray(row), byteBufferToByteArray(family),
        byteBufferToByteArray(qualifier), null, deleteFromThrift(deleteSingle));
    } else {
      return htable.checkAndDelete(byteBufferToByteArray(row), byteBufferToByteArray(family),
        byteBufferToByteArray(qualifier), byteBufferToByteArray(value),
        deleteFromThrift(deleteSingle));
    }
  } catch (IOException e) {
    throw getTIOError(e);
  } finally {
    closeTable(htable);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:21,代码来源:ThriftHBaseServiceHandler.java

示例6: getScannerResults

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Override
public List<TResult> getScannerResults(ByteBuffer table, TScan scan, int numRows)
    throws TIOError, TException {
  HTableInterface htable = getTable(table);
  List<TResult> results = null;
  ResultScanner scanner = null;
  try {
    scanner = htable.getScanner(scanFromThrift(scan));
    results = resultsFromHBase(scanner.next(numRows));
  } catch (IOException e) {
    throw getTIOError(e);
  } finally {
    if (scanner != null) {
      scanner.close();
    }
    closeTable(htable);
  }
  return results;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:20,代码来源:ThriftHBaseServiceHandler.java

示例7: existsAll

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Override
public List<Boolean> existsAll(ByteBuffer table, List<TGet> gets) throws TIOError, TException {
  Table htable = getTable(table);
  try {
    boolean[] exists = htable.existsAll(getsFromThrift(gets));
    List<Boolean> result = new ArrayList<>(exists.length);
    for (boolean exist : exists) {
      result.add(exist);
    }
    return result;
  } catch (IOException e) {
    throw getTIOError(e);
  } finally {
    closeTable(htable);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:ThriftHBaseServiceHandler.java

示例8: checkAndPut

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Override
public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer family,
    ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, TException {
  checkReadOnlyMode();
  Table htable = getTable(table);
  try {
    Table.CheckAndMutateBuilder builder = htable.checkAndMutate(byteBufferToByteArray(row),
        byteBufferToByteArray(family)).qualifier(byteBufferToByteArray(qualifier));
    if (value == null) {
      return builder.ifNotExists().thenPut(putFromThrift(put));
    } else {
      return builder.ifEquals(byteBufferToByteArray(value)).thenPut(putFromThrift(put));
    }
  } catch (IOException e) {
    throw getTIOError(e);
  } finally {
    closeTable(htable);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:ThriftHBaseServiceHandler.java

示例9: checkAndDelete

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Override
public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family,
    ByteBuffer qualifier, ByteBuffer value, TDelete deleteSingle) throws TIOError, TException {
  checkReadOnlyMode();
  Table htable = getTable(table);
  try {
    Table.CheckAndMutateBuilder mutateBuilder =
        htable.checkAndMutate(byteBufferToByteArray(row), byteBufferToByteArray(family))
            .qualifier(byteBufferToByteArray(qualifier));
    if (value == null) {
      return mutateBuilder.ifNotExists().thenDelete(deleteFromThrift(deleteSingle));
    } else {
      return mutateBuilder.ifEquals(byteBufferToByteArray(value))
          .thenDelete(deleteFromThrift(deleteSingle));
    }
  } catch (IOException e) {
    throw getTIOError(e);
  } finally {
    closeTable(htable);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:ThriftHBaseServiceHandler.java

示例10: getScannerRows

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Override
public List<TResult> getScannerRows(int scannerId, int numRows) throws TIOError,
    TIllegalArgument, TException {
  ResultScanner scanner = getScanner(scannerId);
  if (scanner == null) {
    TIllegalArgument ex = new TIllegalArgument();
    ex.setMessage("Invalid scanner Id");
    throw ex;
  }
  try {
    connectionCache.updateConnectionAccessTime();
    return resultsFromHBase(scanner.next(numRows));
  } catch (IOException e) {
    throw getTIOError(e);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:ThriftHBaseServiceHandler.java

示例11: testExistsWithReadOnly

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Test
public void testExistsWithReadOnly() throws TException {

  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = Bytes.toBytes("testExists");
  ByteBuffer table = wrap(tableAname);
  TGet get = new TGet(wrap(rowName));

  boolean exceptionCaught = false;
  try {
    handler.exists(table, get);
  } catch (TIOError e) {
    exceptionCaught = true;
  } finally {
    assertFalse(exceptionCaught);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java

示例12: testExistsAllWithReadOnly

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Test
public void testExistsAllWithReadOnly() throws TException {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName1 = Bytes.toBytes("testExistsAll1");
  byte[] rowName2 = Bytes.toBytes("testExistsAll2");
  ByteBuffer table = wrap(tableAname);

  List<TGet> gets = new ArrayList<>();
  gets.add(new TGet(wrap(rowName1)));
  gets.add(new TGet(wrap(rowName2)));

  boolean exceptionCaught = false;
  try {
    handler.existsAll(table, gets);
  } catch (TIOError e) {
    exceptionCaught = true;
  } finally {
    assertFalse(exceptionCaught);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java

示例13: testGetWithReadOnly

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Test
public void testGetWithReadOnly() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = Bytes.toBytes("testGet");
  ByteBuffer table = wrap(tableAname);

  TGet get = new TGet(wrap(rowName));

  boolean exceptionCaught = false;
  try {
    handler.get(table, get);
  } catch (TIOError e) {
    exceptionCaught = true;
  } finally {
    assertFalse(exceptionCaught);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java

示例14: testGetMultipleWithReadOnly

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Test
public void testGetMultipleWithReadOnly() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  ByteBuffer table = wrap(tableAname);
  byte[] rowName1 = Bytes.toBytes("testGetMultiple1");
  byte[] rowName2 = Bytes.toBytes("testGetMultiple2");

  List<TGet> gets = new ArrayList<>(2);
  gets.add(new TGet(wrap(rowName1)));
  gets.add(new TGet(wrap(rowName2)));

  boolean exceptionCaught = false;
  try {
    handler.getMultiple(table, gets);
  } catch (TIOError e) {
    exceptionCaught = true;
  } finally {
    assertFalse(exceptionCaught);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java

示例15: testPutWithReadOnly

import org.apache.hadoop.hbase.thrift2.generated.TIOError; //导入依赖的package包/类
@Test
public void testPutWithReadOnly() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  ByteBuffer table = wrap(tableAname);
  byte[] rowName = Bytes.toBytes("testPut");

  List<TColumnValue> columnValues = new ArrayList<>(2);
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);

  boolean exceptionCaught = false;
  try {
    handler.put(table, put);
  } catch (TIOError e) {
    exceptionCaught = true;
    assertTrue(e.getCause() instanceof DoNotRetryIOException);
    assertEquals("Thrift Server is in Read-only mode.", e.getMessage());
  } finally {
    assertTrue(exceptionCaught);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:23,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java


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