remove a warning from agent

remove a warning from agent
This commit is contained in:
coderfengyun 2014-08-29 08:58:42 +08:00
parent ccc212b13f
commit 77168b6ac7
1 changed files with 60 additions and 56 deletions

View File

@ -92,16 +92,19 @@ public class HBasePlugin {
/**
* get style, read according to rowKey
*
* @param rowkey
* @throws IOException
* @return
*/
@SuppressWarnings("deprecation")
@Behavior(value = "Get", type = BehaviorType.USER_BEHAVIOR)
public HBaseReturn get(@Parameter(value = "rowkey", type = SupportTypes.Field) String rowkey) {
public HBaseReturn get(
@Parameter(value = "rowkey", type = SupportTypes.Field) String rowkey) {
try {
Get g = new Get(Bytes.toBytes(rowkey));
Result r = tableUnderTest.get(g);
for(KeyValue kv : r.raw()){
for (KeyValue kv : r.raw()) {
System.out.println("column: " + new String(kv.getRow()));
System.out.println("value: " + new String(kv.getValue()));
}
@ -112,18 +115,21 @@ public class HBasePlugin {
}
}
/**
* Perform a range scan for a set of records in the database.
* @param startkey The record key of the first record to read.
* @param recordcount The number of records to read
*
* @param startkey
* The record key of the first record to read.
* @param recordcount
* The number of records to read
* @return
*/
@SuppressWarnings("deprecation")
@Behavior(value = "Scan", type = BehaviorType.USER_BEHAVIOR)
public HBaseReturn scan(@Parameter(value = "startkey", type = SupportTypes.Field) String startkey,
@Parameter(value = "recordcount", type = SupportTypes.Field) String recordcount)
{
public HBaseReturn scan(
@Parameter(value = "startkey", type = SupportTypes.Field) String startkey,
@Parameter(value = "recordcount", type = SupportTypes.Field) String recordcount) {
Scan s = new Scan(Bytes.toBytes(startkey));
Integer count = Integer.getInteger(recordcount);
s.setCaching(count);
@ -131,24 +137,22 @@ public class HBasePlugin {
try {
scanner = tableUnderTest.getScanner(s);
int numResults = 0;
for (Result rr = scanner.next(); rr != null; rr = scanner.next())
{
for (Result rr = scanner.next(); rr != null; rr = scanner.next()) {
String key = Bytes.toString(rr.getRow());
for (KeyValue kv : rr.raw()) {
System.out.println("result: key =" + kv.getQualifier() + " value = " + kv.getValue());
System.out.println("result: key =" + kv.getQualifier()
+ " value = " + kv.getValue());
}
numResults++;
if (numResults >= count)
{
if (numResults >= count) {
break;
}
}
}catch (IOException e) {
} catch (IOException e) {
Logger.getLogger(HBasePlugin.class).info(e, e);
return new HBaseReturn(false);
}finally {
} finally {
scanner.close();
}