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


Java ClientResponse.getStatusString方法代码示例

本文整理汇总了Java中org.voltdb.client.ClientResponse.getStatusString方法的典型用法代码示例。如果您正苦于以下问题:Java ClientResponse.getStatusString方法的具体用法?Java ClientResponse.getStatusString怎么用?Java ClientResponse.getStatusString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.voltdb.client.ClientResponse的用法示例。


在下文中一共展示了ClientResponse.getStatusString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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());
        }
    }
    
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:33,代码来源:VoterSStoreExampleClient.java

示例2: 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());
        }
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:31,代码来源:VoterClient.java

示例3: 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);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:49,代码来源:BenchmarkComponent.java

示例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());
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:28,代码来源:BingoClient.java

示例5: 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);
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:12,代码来源:TestCatalogUpdateSuite.java

示例6: clientCallbackImpl

import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
@Override
        public void clientCallbackImpl(ClientResponse clientResponse) {
            final VoltTable[] results = clientResponse.getResults();
            final BitSet seats = getSeatsBitSet(element.flight_id);
            
            // Valid NewReservation
            if (clientResponse.getStatus() == Status.OK) {
                assert(results.length > 1);
                assert(results[0].getRowCount() == 1);
                assert(results[0].asScalarLong() == 1);

                // Mark this seat as successfully reserved
                seats.set(element.seatnum);

                // Set it up so we can play with it later
                SEATSClient.this.requeueReservation(element);
            }
            // Aborted - Figure out why!
            else if (clientResponse.getStatus() == Status.ABORT_USER) {
                String msg = clientResponse.getStatusString();
                ErrorType errorType = ErrorType.getErrorType(msg);
                
                if (debug.val)
                    LOG.debug(String.format("Client %02d :: NewReservation %s [ErrorType=%s] - %s",
                              getClientId(), clientResponse.getStatus(), errorType, clientResponse.getStatusString()),
                              clientResponse.getException());
                switch (errorType) {
                    case NO_MORE_SEATS: {
                        seats.set(0, SEATSConstants.FLIGHTS_NUM_SEATS);
                        if (debug.val)
                            LOG.debug(String.format("FULL FLIGHT: %s", element.flight_id));                        
                        break;
                    }
                    case CUSTOMER_ALREADY_HAS_SEAT: {
                        Set<Long> f_ids = getCustomerBookedFlights(element.customer_id);
                        f_ids.add(element.flight_id);
                        if (debug.val)
                            LOG.debug(String.format("ALREADY BOOKED: %s -> %s", element.customer_id, f_ids));
                        break;
                    }
                    case SEAT_ALREADY_RESERVED: {
                        seats.set(element.seatnum);
                        if (debug.val)
                            LOG.debug(String.format("ALREADY BOOKED SEAT: %s/%d -> %s",
                                                    element.customer_id, element.seatnum, seats));
                        break;
                    }
                    case INVALID_CUSTOMER_ID: {
                        LOG.warn("Unexpected invalid CustomerId: " + element.customer_id);
                        break;
                    }
                    case INVALID_FLIGHT_ID: {
                        LOG.warn("Unexpected invalid FlightId: " + element.flight_id);
                        break;
                    }
                    case UNKNOWN: {
//                        if (debug.val) 
                            LOG.warn(msg);
                        break;
                    }
                    default: {
                        if (debug.val) LOG.debug("BUSTED ID: " + element.flight_id + " / " + element.flight_id);
                    }
                } // SWITCH
            }
        }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:67,代码来源:SEATSClient.java


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