All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hbase-webapps.master.startupProgress.jsp Maven / Gradle / Ivy

There is a newer version: 3.0.0-beta-1
Show newest version
<%--
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
--%>
<%@ page contentType="text/html;charset=UTF-8"
         import="java.util.Date"
         import="java.util.Iterator"
         import="java.util.List"
%>
<%@ page import="org.apache.hadoop.hbase.master.HMaster" %>
<%@ page import="org.apache.hadoop.hbase.monitoring.MonitoredTask" %>
<%@ page import="org.apache.hadoop.hbase.monitoring.TaskGroup" %>
<%
  final HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
%>

  


<% if(startupTaskGroup != null){ for (MonitoredTask task : startupTaskGroup.getTasks()) { %> <% } } %>
Task Current State Start Time Last status Time Elapsed Time(ms) Journals
<%= task.getDescription() %> <%= task.getState().name() %> <%= new Date(task.getStartTime()) %> <%= new Date(task.getStatusTime()) %> <%= task.getStatusTime() - task.getStartTime() %> <%= printLatestJournals(task, 30) %>
<%! private static String printLatestJournals(MonitoredTask task, int count) { List journal = task.getStatusJournal(); if (journal == null) { return ""; } int journalSize = journal.size(); StringBuilder sb = new StringBuilder(); int skips = journalSize - count; if (skips > 0) { sb.append("Current journal size is ").append(journalSize).append(", "); sb.append("skip the previous ones and show the latest ").append(count).append(" journals..."); sb.append("
"); } Iterator iter = journal.iterator(); MonitoredTask.StatusJournalEntry previousEntry = null; int i = 0; while (iter.hasNext()) { MonitoredTask.StatusJournalEntry entry = iter.next(); if (i >= skips) { sb.append(entry); if (previousEntry != null) { long delta = entry.getTimeStamp() - previousEntry.getTimeStamp(); if (delta != 0) { sb.append(" (+").append(delta).append(" ms)"); } } sb.append("
"); previousEntry = entry; } i++; } return sb.toString(); } private static String getStartupStatusString(TaskGroup startupTaskGroup) { MonitoredTask.State currentState = startupTaskGroup.getState(); if (currentState.equals(MonitoredTask.State.COMPLETE)) { return "Master initialized"; } else if (currentState.equals(MonitoredTask.State.RUNNING) | currentState.equals(MonitoredTask.State.WAITING)) { return "Master initialize in progress"; } else { return currentState.toString(); } } %>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy