org.apache.hadoop.mapreduce.util
Class CountersStrings

java.lang.Object
  extended by org.apache.hadoop.mapreduce.util.CountersStrings

@InterfaceAudience.Private
public class CountersStrings
extends Object

String conversion utilities for counters. Candidate for deprecation since we start to use JSON in 0.21+


Constructor Summary
CountersStrings()
           
 
Method Summary
static
<C extends Counter,G extends CounterGroupBase<C>,T extends AbstractCounters<C,G>>
T
parseEscapedCompactString(String compactString, T counters)
          Parse a pre 0.21 counters string into a counter object.
static String toEscapedCompactString(Counter counter)
          Make the pre 0.21 counter string (for e.g.
static
<G extends CounterGroupBase<?>>
String
toEscapedCompactString(G group)
          Make the 0.21 counter group string.
static
<C extends Counter,G extends CounterGroupBase<C>,T extends AbstractCounters<C,G>>
String
toEscapedCompactString(T counters)
          Make the pre 0.21 counters string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountersStrings

public CountersStrings()
Method Detail

toEscapedCompactString

public static String toEscapedCompactString(Counter counter)
Make the pre 0.21 counter string (for e.g. old job history files) [(actual-name)(display-name)(value)]

Parameters:
counter - to stringify
Returns:
the stringified result

toEscapedCompactString

public static <G extends CounterGroupBase<?>> String toEscapedCompactString(G group)
Make the 0.21 counter group string. format: {(actual-name)(display-name)(value)[][][]} where [] are compact strings for the counters within.

Type Parameters:
G - type of the group
Parameters:
group - to stringify
Returns:
the stringified result

toEscapedCompactString

public static <C extends Counter,G extends CounterGroupBase<C>,T extends AbstractCounters<C,G>> String toEscapedCompactString(T counters)
Make the pre 0.21 counters string

Type Parameters:
C - type of the counter
G - type of the counter group
T - type of the counters object
Parameters:
counters - the object to stringify
Returns:
the string in the following format {(groupName)(group-displayName)[(counterName)(displayName)(value)]*}*

parseEscapedCompactString

public static <C extends Counter,G extends CounterGroupBase<C>,T extends AbstractCounters<C,G>> T parseEscapedCompactString(String compactString,
                                                                                                                            T counters)
                                                                 throws ParseException
Parse a pre 0.21 counters string into a counter object.

Type Parameters:
C - type of the counter
G - type of the counter group
T - type of the counters object
Parameters:
compactString - to parse
counters - an empty counters object to hold the result
Returns:
the counters object holding the result
Throws:
ParseException


Copyright © 2012 Apache Software Foundation. All Rights Reserved.