Search in sources :

Example 1 with ResultHandler

use of org.apache.phoenix.pherf.result.ResultHandler in project phoenix by apache.

the class MonitorManager method readResults.

/**
     * This method should really only be used for testing
     *
     * @return List < {@link org.apache.phoenix.pherf.result.Result} >
     * @throws IOException
     */
public synchronized List<Result> readResults() throws Exception {
    ResultHandler handler = null;
    try {
        if (resultHandler.isClosed()) {
            handler = new CSVFileResultHandler();
            handler.setResultFileDetails(ResultFileDetails.CSV);
            handler.setResultFileName(PherfConstants.MONITOR_FILE_NAME);
            return handler.read();
        } else {
            return resultHandler.read();
        }
    } catch (Exception e) {
        throw new FileLoaderRuntimeException("Could not close monitor results.", e);
    } finally {
        if (handler != null) {
            handler.close();
        }
    }
}
Also used : CSVFileResultHandler(org.apache.phoenix.pherf.result.impl.CSVFileResultHandler) FileLoaderRuntimeException(org.apache.phoenix.pherf.exception.FileLoaderRuntimeException) ResultHandler(org.apache.phoenix.pherf.result.ResultHandler) CSVFileResultHandler(org.apache.phoenix.pherf.result.impl.CSVFileResultHandler) IOException(java.io.IOException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) FileLoaderRuntimeException(org.apache.phoenix.pherf.exception.FileLoaderRuntimeException)

Aggregations

IOException (java.io.IOException)1 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)1 FileLoaderRuntimeException (org.apache.phoenix.pherf.exception.FileLoaderRuntimeException)1 ResultHandler (org.apache.phoenix.pherf.result.ResultHandler)1 CSVFileResultHandler (org.apache.phoenix.pherf.result.impl.CSVFileResultHandler)1