001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.runtime.common.driver.idle; 020 021/** 022 * A message to be used to indicate that the driver is potentially idle. 023 */ 024public final class IdleMessage { 025 026 private final String componentName; 027 private final String reason; 028 private final boolean isIdle; 029 030 /** 031 * @param componentName the name of the component that is indicating (not) idle, e.g. "Clock" 032 * @param reason the human-readable reason the component indicates (not) idle, "No more alarms scheduled." 033 * @param isIdle whether or not the component is idle. 034 */ 035 public IdleMessage(final String componentName, final String reason, final boolean isIdle) { 036 this.componentName = componentName; 037 this.reason = reason; 038 this.isIdle = isIdle; 039 } 040 041 /** 042 * @return the name of the component that indicated (not) idle. 043 */ 044 public String getComponentName() { 045 return this.componentName; 046 } 047 048 /** 049 * @return the reason for (no) idleness 050 */ 051 public String getReason() { 052 return this.reason; 053 } 054 055 /** 056 * @return true if this message indicates idle. 057 */ 058 public boolean isIdle() { 059 return this.isIdle; 060 } 061}