本文整理汇总了Java中org.voltdb.client.ClientResponse.getStatus方法的典型用法代码示例。如果您正苦于以下问题:Java ClientResponse.getStatus方法的具体用法?Java ClientResponse.getStatus怎么用?Java ClientResponse.getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.client.ClientResponse
的用法示例。
在下文中一共展示了ClientResponse.getStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResult
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
private VoltTable getResult(Client client, String procName) throws Exception
{
VoltTable result = null;
Procedure catalog_proc = runner.catalog_db.getProcedures().getIgnoreCase(procName);
if (catalog_proc == null) {
throw new Exception("Invalid stored procedure name '" + procName + "'");
}
//result = client.asynCallProcedure(null, catalog_proc.getName(), null, params);
ClientResponse response = client.callProcedure(catalog_proc.getName());
if(response.getStatus()==Status.OK)
{
result = response.getResults()[0];
}
else
System.out.println("Failed : " + catalog_proc.getName());
return result;
}
示例2: getResult
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
private VoltTable getResult(Client client, String procName) throws Exception
{
VoltTable result = null;
Procedure catalog_proc = this.catalog_db.getProcedures().getIgnoreCase(procName);
if (catalog_proc == null) {
throw new Exception("Invalid stored procedure name '" + procName + "'");
}
//result = client.asynCallProcedure(null, catalog_proc.getName(), null, params);
ClientResponse response = client.callProcedure(catalog_proc.getName());
if(response.getStatus()==Status.OK)
{
result = response.getResults()[0];
}
else
System.out.println("Failed : " + catalog_proc.getName());
return result;
}
示例3: clientCallback
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallback(ClientResponse clientResponse) {
if (trace.val) LOG.trace("clientCallback(cid = " + getClientId() + "):: txn = " + txn.getDisplayName());
incrementTransactionCounter(clientResponse, this.txn.ordinal());
VoltTable[] results = clientResponse.getResults();
if (clientResponse.getStatus() == Status.OK) {
try {
this.process(results);
} catch (Throwable ex) {
LOG.error("PARAMS: " + Arrays.toString(this.params));
for (int i = 0; i < results.length; i++) {
LOG.info(String.format("[%02d] RESULT\n%s", i, results[i]));
} // FOR
throw new RuntimeException("Failed to process results for " + this.txn, ex);
}
} else {
if (debug.val) LOG.debug(String.format("%s: %s", this.txn, clientResponse.getStatusString()), clientResponse.getException());
}
}
示例4: clientCallback
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallback(ClientResponse clientResponse) {
final Status status = clientResponse.getStatus();
if (status != Status.OK) {
if (status == Status.ABORT_CONNECTION_LOST){
/*
* Status of the last transaction involving the tournament
* is unknown it could have committed. Recovery code would
* go here.
*/
return;
}
if (clientResponse.getException() != null) {
clientResponse.getException().printStackTrace();
}
if (debug.val && clientResponse.getStatusString() != null) {
LOG.warn(clientResponse.getStatusString());
}
return;
}
synchronized (tournaments) {
tournaments.offer(Tourney.this);
tournaments.notifyAll();
}
incrementTransactionCounter(clientResponse, t.ordinal());
}
示例5: clientCallback
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallback(ClientResponse clientResponse) {
// Increment the BenchmarkComponent's internal counter on the
// number of transactions that have been completed
// NOTE: all callbacks will be for the "Vote" procedure. To see how many times other procedures are called, you will need to check the @Statistics system procedure
incrementTransactionCounter(clientResponse, 0);
// Keep track of state (optional)
if (clientResponse.getStatus() == Status.OK) {
VoltTable results[] = clientResponse.getResults();
assert(results.length == 1);
long status = results[0].asScalarLong();
if (status == VoterSStoreExampleConstants.VOTE_SUCCESSFUL) {
acceptedVotes.incrementAndGet();
}
else if (status == VoterSStoreExampleConstants.ERR_INVALID_CONTESTANT) {
badContestantVotes.incrementAndGet();
}
else if (status == VoterSStoreExampleConstants.ERR_VOTER_OVER_VOTE_LIMIT) {
badVoteCountVotes.incrementAndGet();
}
}
else if (clientResponse.getStatus() == Status.ABORT_UNEXPECTED) {
if (clientResponse.getException() != null) {
clientResponse.getException().printStackTrace();
}
if (debug.val && clientResponse.getStatusString() != null) {
LOG.warn(clientResponse.getStatusString());
}
}
}
示例6: clientCallback
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallback(ClientResponse clientResponse) {
if (clientResponse.getStatus() == Status.ABORT_CONNECTION_LOST){
return;
}
incrementTransactionCounter(clientResponse, Transaction.kUpdateReservation.ordinal());
VoltTable[] results = clientResponse.getResults();
if (m_rid < (150 * .5 * m_maxfid)) {
assert (results.length == 1);
assert (results[0].getRowCount() == 1);
assert (results[0].asScalarLong() == 1);
}
}
示例7: clientCallbackImpl
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallbackImpl(ClientResponse clientResponse) {
VoltTable[] results = clientResponse.getResults();
if (clientResponse.getStatus() == Status.OK) {
assert (results.length >= 1);
assert (results[0].getRowCount() == 1);
// assert (results[0].asScalarLong() == 1);
} else if (debug.val) {
LOG.debug("UpdateCustomer " + ": " + clientResponse.getStatusString(), clientResponse.getException());
}
}
示例8: clientCallback
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallback(ClientResponse clientResponse) {
m_outstandingCalls.decrementAndGet();
if (m_expectedStatus != clientResponse.getStatus()) {
if (clientResponse.getStatusString() != null)
System.err.println(clientResponse.getStatusString());
if (clientResponse.getException() != null)
clientResponse.getException().printStackTrace();
assertTrue(false);
}
}
示例9: clientCallback
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallback(ClientResponse clientResponse) {
// Increment the BenchmarkComponent's internal counter on the
// number of transactions that have been completed
incrementTransactionCounter(clientResponse, 0);
// Keep track of state (optional)
if (clientResponse.getStatus() == Status.OK) {
VoltTable results[] = clientResponse.getResults();
assert(results.length == 1);
long status = results[0].asScalarLong();
if (status == VoterConstants.VOTE_SUCCESSFUL) {
acceptedVotes.incrementAndGet();
}
else if (status == VoterConstants.ERR_INVALID_CONTESTANT) {
badContestantVotes.incrementAndGet();
}
else if (status == VoterConstants.ERR_VOTER_OVER_VOTE_LIMIT) {
badVoteCountVotes.incrementAndGet();
}
}
else if (clientResponse.getStatus() == Status.ABORT_UNEXPECTED) {
if (clientResponse.getException() != null) {
clientResponse.getException().printStackTrace();
}
if (debug.val && clientResponse.getStatusString() != null) {
LOG.warn(clientResponse.getStatusString());
}
}
}
示例10: clientCallbackImpl
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallbackImpl(ClientResponse clientResponse) {
if (clientResponse.getStatus() == Status.OK) {
assert (clientResponse.getResults().length == 1);
assert (clientResponse.getResults()[0].getRowCount() == 1);
assert (clientResponse.getResults()[0].asScalarLong() == 1 ||
clientResponse.getResults()[0].asScalarLong() == 0);
SEATSClient.this.requeueReservation(element);
}
}
示例11: clientCallback
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallback(ClientResponse clientResponse) {
final Status status = clientResponse.getStatus();
incrementTransactionCounter(clientResponse, 0);
if (status != Status.OK) {
System.err.println("Failed to execute!!!");
System.err.println(clientResponse.getException());
System.err.println(clientResponse.getStatusString());
System.exit(-1);
} else {
pClientCallback(clientResponse.getResults());
}
}
示例12: checkTransaction
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
/**
* Performs constraint checking on the result set in clientResponse. It does
* simple sanity checks like if the response code is SUCCESS. If the check
* transaction flag is set to true by calling setCheckTransaction(), then it
* will check the result set against constraints.
*
* @param procName
* The name of the procedure
* @param clientResponse
* The client response
* @param errorExpected
* true if the response is expected to be an error.
* @return true if it passes all tests, false otherwise
*/
protected boolean checkTransaction(String procName,
ClientResponse clientResponse,
boolean abortExpected,
boolean errorExpected) {
final Status status = clientResponse.getStatus();
// System.out.println(status);
if (status != Status.OK) {
if (errorExpected)
return true;
if (abortExpected && status == Status.ABORT_USER)
return true;
if (status == Status.ABORT_CONNECTION_LOST) {
return false;
}
if (status == Status.ABORT_REJECT) {
return false;
}
if (clientResponse.getException() != null) {
clientResponse.getException().printStackTrace();
}
if (clientResponse.getStatusString() != null) {
LOG.warn(clientResponse.getStatusString());
}
throw new RuntimeException("Invalid " + procName + " response!\n" + clientResponse);
}
if (m_checkGenerator.nextFloat() >= m_checkTransaction)
return true;
return checkConstraints(procName, clientResponse);
}
示例13: clientCallback
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
public void clientCallback(ClientResponse clientResponse) {
if (clientResponse.getStatus() == Status.ABORT_CONNECTION_LOST){
return;
}
assertTrue(clientResponse.getStatus() == Status.OK);
answersReceived.decrementAndGet();
}
示例14: Entry
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
public Entry(ClientResponse cr, int clientId, int txnNameId, long timestamp) {
this.txnNameId = txnNameId;
this.clientId = clientId;
this.timestamp = timestamp;
this.singlePartition = cr.isSinglePartition();
this.basePartition = cr.getBasePartition();
this.status = cr.getStatus();
this.resultSize = cr.getResultsSize();
this.clusterRoundTrip = cr.getClusterRoundtrip();
this.clientRoundTrip = cr.getClientRoundtrip();
this.restartCounter = cr.getRestartCounter();
}
示例15: incrementTransactionCounter
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
/**
* Increment the internal transaction counter. This should be invoked
* after the client has received a ClientResponse from the DBMS cluster
* The txn_index is the offset of the transaction that was executed. This offset
* is the same order as the array returned by getTransactionDisplayNames
* @param cresponse - The ClientResponse returned from the server
* @param txn_idx
*/
protected final void incrementTransactionCounter(final ClientResponse cresponse, final int txn_idx) {
// Only include it if it wasn't rejected
// This is actually handled in the Distributer, but it doesn't hurt to have this here
Status status = cresponse.getStatus();
// System.out.println(status);
if (status == Status.OK || status == Status.ABORT_USER) {
// TRANSACTION COUNTERS
boolean is_specexec = cresponse.isSpeculative();
boolean is_dtxn = (cresponse.isSinglePartition() == false);
synchronized (m_txnStats.transactions) {
m_txnStats.transactions.put(txn_idx);
if (is_dtxn) m_txnStats.dtxns.put(txn_idx);
if (is_specexec) m_txnStats.specexecs.put(txn_idx);
} // SYNCH
// LATENCIES COUNTERS
// Ignore zero latencies... Not sure why this happens...
int latency = cresponse.getClusterRoundtrip();
//int latency = cresponse.getClientRoundtrip();// modified by hawk, 2013/12/11, for micro-benchmark 4
if (latency > 0) {
Map<Integer, ObjectHistogram<Integer>> latenciesMap = (is_dtxn ? m_txnStats.dtxnLatencies :
m_txnStats.spLatencies);
Histogram<Integer> latencies = latenciesMap.get(txn_idx);
if (latencies == null) {
synchronized (latenciesMap) {
latencies = latenciesMap.get(txn_idx);
if (latencies == null) {
latencies = new ObjectHistogram<Integer>();
latenciesMap.put(txn_idx, (ObjectHistogram<Integer>)latencies);
}
} // SYNCH
}
synchronized (latencies) {
latencies.put(latency);
} // SYNCH
}
// RESPONSE ENTRIES
if (m_enableResponseEntries) {
long timestamp = System.currentTimeMillis();
m_responseEntries.add(cresponse, m_id, txn_idx, timestamp);
}
// BASE PARTITIONS
if (m_txnStats.isBasePartitionsEnabled()) {
synchronized (m_txnStats.basePartitions) {
m_txnStats.basePartitions.put(cresponse.getBasePartition());
} // SYNCH
}
}
// else if (status == Status.ABORT_UNEXPECTED) {
// LOG.warn("Invalid " + m_countDisplayNames[txn_idx] + " response!\n" + cresponse);
// if (cresponse.getException() != null) {
// cresponse.getException().printStackTrace();
// }
// if (cresponse.getStatusString() != null) {
// LOG.warn(cresponse.getStatusString());
// }
// }
if (m_txnStats.isResponsesStatusesEnabled()) {
synchronized (m_txnStats.responseStatuses) {
m_txnStats.responseStatuses.put(status.ordinal());
} // SYNCH
}
}