2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org
.apache
.hadoop
.hbase
;
20 import org
.apache
.yetus
.audience
.InterfaceAudience
;
22 /** Builder for information about active monitored server tasks */
23 @InterfaceAudience.Private
24 public final class ServerTaskBuilder
{
26 public static ServerTaskBuilder
newBuilder() {
27 return new ServerTaskBuilder();
30 private String description
= "";
31 private String status
= "";
32 private ServerTask
.State state
= ServerTask
.State
.RUNNING
;
33 private long startTime
;
34 private long completionTime
;
36 private ServerTaskBuilder() { }
38 private static final class ServerTaskImpl
implements ServerTask
{
40 private final String description
;
41 private final String status
;
42 private final ServerTask
.State state
;
43 private final long startTime
;
44 private final long completionTime
;
46 private ServerTaskImpl(final String description
, final String status
,
47 final ServerTask
.State state
, final long startTime
, final long completionTime
) {
48 this.description
= description
;
51 this.startTime
= startTime
;
52 this.completionTime
= completionTime
;
56 public String
getDescription() {
61 public String
getStatus() {
66 public State
getState() {
71 public long getStartTime() {
76 public long getCompletionTime() {
77 return completionTime
;
81 public String
toString() {
82 StringBuilder sb
= new StringBuilder(512);
83 sb
.append(getDescription());
84 sb
.append(": status=");
85 sb
.append(getStatus());
86 sb
.append(", state=");
87 sb
.append(getState());
88 sb
.append(", startTime=");
89 sb
.append(getStartTime());
90 sb
.append(", completionTime=");
91 sb
.append(getCompletionTime());
97 public ServerTaskBuilder
setDescription(final String description
) {
98 this.description
= description
;
102 public ServerTaskBuilder
setStatus(final String status
) {
103 this.status
= status
;
107 public ServerTaskBuilder
setState(final ServerTask
.State state
) {
112 public ServerTaskBuilder
setStartTime(final long startTime
) {
113 this.startTime
= startTime
;
117 public ServerTaskBuilder
setCompletionTime(final long completionTime
) {
118 this.completionTime
= completionTime
;
122 public ServerTask
build() {
123 return new ServerTaskImpl(description
, status
, state
, startTime
, completionTime
);