@Cli(name="watch", description="Watch the value of one MBean attribute constantly", note="DO NOT call this command in a script and expect decent output") public class WatchCommand extends Command
Constructor and Description |
---|
WatchCommand() |
Modifier and Type | Method and Description |
---|---|
List<String> |
doSuggestArgument()
Provide a list of possible arguments for auto completion.
|
void |
execute()
Execute command
|
void |
setAttributes(List<String> attributes) |
void |
setOutputFormat(String outputFormat) |
void |
setRefreshInterval(int refreshInterval) |
void |
setReport(boolean report) |
void |
setStopAfter(int stopAfter) |
doSuggestOption, getSession, isHelp, setHelp, setSession, suggestArgument, suggestOption
public List<String> doSuggestArgument() throws IOException, JMException
Command
doSuggestArgument
in class Command
IOException
- IO errorsJMException
- JMX problemopublic void execute() throws IOException, JMException
Command
execute
in class Command
IOException
- IO errorsJMException
- JMX errors@MultiValue(listType=java.util.ArrayList.class, minValues=1) @Argument(displayName="attr", description="Name of attributes to watch") public final void setAttributes(List<String> attributes)
attributes
- Name of attributes to watch@Option(name="f", longName="format", displayName="expr", description="Java pattern(java.text.MessageFormat) to print attribute values") public final void setOutputFormat(String outputFormat)
outputFormat
- Pattern used in MessageFormat
@Option(name="i", longName="interval", displayName="sec", description="Optional number of seconds between consecutive poll, default is 1 second", defaultValue="1") public final void setRefreshInterval(int refreshInterval)
refreshInterval
- Refreshing interval in seconds@Option(name="r", longName="report", description="Output result line by line as report") public final void setReport(boolean report)
report
- True to output result line by line as report@Option(name="s", longName="stopafter", displayName="sec", description="Stop after watching a number of seconds") public final void setStopAfter(int stopAfter)
stopAfter
- After this number of seconds, stop watchingCopyright © 2008–2018. All rights reserved.