本文整理汇总了Java中org.voltdb.client.ClientResponse.isSinglePartition方法的典型用法代码示例。如果您正苦于以下问题:Java ClientResponse.isSinglePartition方法的具体用法?Java ClientResponse.isSinglePartition怎么用?Java ClientResponse.isSinglePartition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.client.ClientResponse
的用法示例。
在下文中一共展示了ClientResponse.isSinglePartition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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
}
}