Package com.splout.db.dnode.beans

Examples of com.splout.db.dnode.beans.DNodeSystemStatus


   * Returns an {@link com.splout.db.dnode.beans.DNodeSystemStatus} filled with the appropriated data.
   */
  @Override
  public String status() throws DNodeException {
    try {
      DNodeSystemStatus status = new DNodeSystemStatus();
      if(lastException == null) {
        status.setSystemStatus("UP");
        status.setLastExceptionTime(-1);
      } else {
        status.setSystemStatus("Last exception: " + lastException);
        status.setLastExceptionTime(lastExceptionTime);
      }
      status.setUpSince(upSince);
      status.setFailedQueries(failedQueries.get());
      status.setnQueries(performanceTool.getNQueries());
      status.setAverage(performanceTool.getAverage());
      status.setSlowQueries(slowQueries);
      status.setDeployInProgress(deployInProgress.get() > 0);
      status.setHttpExchangerAddress(httpExchangerAddress());
      status.setBalanceActionsStateMap(balanceActionsStateMap);
      File folder = new File(config.getString(DNodeProperties.DATA_FOLDER));
      if(folder.exists()) {
        status.setFreeSpaceInDisk(FileSystemUtils.freeSpaceKb(folder.toString()));
        status.setOccupiedSpaceInDisk(FileUtils.sizeOfDirectory(folder));
        Collection<File> files = FileUtils.listFilesAndDirs(folder, TrueFileFilter.INSTANCE,
            TrueFileFilter.INSTANCE);
        status.setFiles(new ArrayList<String>(Lists.transform(Lists.newArrayList(files),
            new Function<File, String>() {
              @Override
              public String apply(File file) {
                return file.getAbsolutePath() + " (" + FileUtils.sizeOf(file) + " bytes)";
              }
            })));
        Collections.sort(status.getFiles());
      } else {
        status.setOccupiedSpaceInDisk(0);
        status.setFreeSpaceInDisk(FileSystemUtils.freeSpaceKb("."));
        status.setFiles(new ArrayList<String>());
      }
      return JSONSerDe.ser(status);
    } catch(Throwable t) {
      unexpectedException(t);
      throw new DNodeException(EXCEPTION_UNEXPECTED, t.getMessage());
View Full Code Here


  public static String FOO_DEPLOY_FOLDER = TestDNode.class.getName() + "-foo-deploy";
  public static String DB_1 = TestDNode.class.getName() + ".db.1";
  public static String DB_2 = TestDNode.class.getName() + ".db.2";

  protected void waitForDeployToFinish(DNodeService.Client client) throws Exception {
    DNodeSystemStatus status = JSONSerDe.deSer(client.status(), DNodeSystemStatus.class);
    while(status.isDeployInProgress()) {
      Thread.sleep(10);
      status = JSONSerDe.deSer(client.status(), DNodeSystemStatus.class);
    }
  }
View Full Code Here

TOP

Related Classes of com.splout.db.dnode.beans.DNodeSystemStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.