public abstract class AbstractDataReaderSun extends AbstractDataReader
It contains a lot of helper methods to do the actual parsing of the details of a gc event. New parsers for Sun / Oracle gc algorithms should derive from this class.
| Modifier and Type | Field and Description |
|---|---|
protected GcLogType |
gcLogType
the log type allowing for small differences between different versions of the gc logs
|
protected static String |
LOG_INFORMATION_COMMANDLINE_FLAGS |
protected static String |
LOG_INFORMATION_HOTSPOT |
protected static String |
LOG_INFORMATION_MEMORY |
protected static String |
LOG_INFORMATION_OPENJDK |
protected static List<String> |
LOG_INFORMATION_STRINGS |
protected static String |
LOGFILE_ROLLING_BEGIN |
protected static String |
LOGFILE_ROLLING_END |
gcResource, in| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDataReaderSun(GCResource gcResource,
InputStream in,
GcLogType gcLogType)
Create an instance of this class passing an inputStream and the type of the logfile.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
contains(String line,
List<String> lineContainsStrings,
boolean trimLine)
Tests if
line starts with one of the strings in lineStartStrings. |
protected AbstractGCEvent.ExtendedType |
extractTypeFromParsedString(String typeName) |
protected double |
getTimestamp(String line,
ParseInformation pos,
ZonedDateTime datestamp)
If the next thing in
line is a timestamp, it is parsed and returned. |
protected boolean |
hasNextDetail(String line,
ParseInformation pos) |
protected boolean |
nextCharIsBracket(String line,
ParseInformation pos) |
protected boolean |
nextIsDatestamp(String line,
ParseInformation pos)
Returns
true if text at parsePosition is a datestamp. |
protected boolean |
nextIsTimestamp(String line,
ParseInformation pos)
Returns
true, if next "token" is a timestamp. |
protected ZonedDateTime |
parseDatestamp(String line,
ParseInformation pos)
Parses a datestamp in
line at pos. |
protected void |
parseDetailEventsIfExist(String line,
ParseInformation pos,
GCEvent event)
Parses detail events if any exist at current
pos in line. |
protected abstract AbstractGCEvent<?> |
parseLine(String line,
ParseInformation pos) |
protected double |
parsePause(String line,
ParseInformation pos) |
protected AbstractGCEvent.ExtendedType |
parseType(String line,
ParseInformation pos) |
protected String |
parseTypeString(String line,
ParseInformation pos) |
protected void |
setMemory(AbstractGCEvent<?> event,
String line,
ParseInformation pos) |
protected void |
setMemoryAndPauses(GCEvent event,
String line)
Convenience method to parse memory information followed by a pause time.
|
protected void |
setMemoryAndPauses(GCEvent event,
String line,
ParseInformation pos)
Parses memory information in the format <number>KB-><number>KB(<number>KB), <number>ms
|
protected void |
setMemoryExtended(GCEvent event,
String line,
ParseInformation pos)
Parses a memory information with the following form: 8192K[(16M)]->7895K[(16M)] ("[...]"
means optional).
|
protected void |
skipLines(LineNumberReader in,
ParseInformation pos,
List<String> lineStartStrings)
Skips a block of lines containing information like they are generated by
-XX:+PrintHeapAtGC or -XX:+PrintAdaptiveSizePolicy.
|
protected boolean |
startsWith(String line,
List<String> lineStartStrings,
boolean trimLine)
Tests if
line starts with one of the strings in lineStartStrings. |
getDataReaderTools, getLogger, read, shouldContinueprotected static final String LOG_INFORMATION_OPENJDK
protected static final String LOG_INFORMATION_HOTSPOT
protected static final String LOG_INFORMATION_MEMORY
protected static final String LOG_INFORMATION_COMMANDLINE_FLAGS
protected static final String LOGFILE_ROLLING_BEGIN
protected static final String LOGFILE_ROLLING_END
protected GcLogType gcLogType
protected AbstractDataReaderSun(GCResource gcResource, InputStream in, GcLogType gcLogType) throws UnsupportedEncodingException
gcResource - information about the resource to be parsedin - inputstream to the log filegcLogType - type of the logfileUnsupportedEncodingException - if ASCII is not supportedprotected void setMemoryAndPauses(GCEvent event, String line) throws ParseException
event - event where the result should be written toline - line to be parsed (from the beginning)ParseException - is thrown to report any problems the parser runs intosetMemoryAndPauses(GCEvent, String, ParseInformation)protected void setMemoryAndPauses(GCEvent event, String line, ParseInformation pos) throws ParseException
event - event where result of parsing is to be storedline - line to be parsedpos - position where parsing should startParseException - is thrown to report any problems the parser runs intoprotected void setMemoryExtended(GCEvent event, String line, ParseInformation pos) throws ParseException
event - event, where parsed information should be storedline - line to be parsedpos - current parse position; all characters between current position and next digits
will be skippedParseException - parsing was not possibleprotected void setMemory(AbstractGCEvent<?> event, String line, ParseInformation pos) throws ParseException
ParseExceptionprotected double parsePause(String line, ParseInformation pos) throws ParseException
ParseExceptionprotected boolean hasNextDetail(String line, ParseInformation pos) throws ParseException
ParseExceptionprotected boolean nextCharIsBracket(String line, ParseInformation pos) throws ParseException
ParseExceptionprotected String parseTypeString(String line, ParseInformation pos) throws ParseException
ParseExceptionprotected AbstractGCEvent.ExtendedType parseType(String line, ParseInformation pos) throws ParseException
ParseExceptionprotected AbstractGCEvent.ExtendedType extractTypeFromParsedString(String typeName)
protected boolean nextIsTimestamp(String line, ParseInformation pos)
true, if next "token" is a timestamp.line - line to be parsedpos - current position in linetrue if next is timestamp, false otherwiseprotected double getTimestamp(String line, ParseInformation pos, ZonedDateTime datestamp) throws ParseException
line is a timestamp, it is parsed and returned. If there
is no timestamp present, the timestamp is calculatedline - current linepos - current parse posititiondatestamp - datestamp that may have been parsedParseException - it seemed to be a timestamp but still couldn't be parsedprotected abstract AbstractGCEvent<?> parseLine(String line, ParseInformation pos) throws ParseException
ParseExceptionprotected boolean startsWith(String line, List<String> lineStartStrings, boolean trimLine)
line starts with one of the strings in lineStartStrings.
If trimLine is true, then line is trimmed first.line - line to be checked againstlineStartStrings - list of strings to checktrimLine - if true then trim linetrue, if line starts with one of the strings in
lineStartStringscontains(String, List, boolean)protected boolean contains(String line, List<String> lineContainsStrings, boolean trimLine)
line starts with one of the strings in lineStartStrings.
If trimLine is true, then line is trimmed first.line - line to be checked againstlineContainsStrings - list of strings to checktrimLine - if true then trim linetrue, if line contains one of the strings in
lineContainsStringsstartsWith(String, List, boolean)protected ZonedDateTime parseDatestamp(String line, ParseInformation pos) throws ParseException
line at pos.line - current line.pos - current parse position.null otherwise.ParseException - if line could not be parsed.protected boolean nextIsDatestamp(String line, ParseInformation pos)
true if text at parsePosition is a datestamp.line - current linepos - current parse positiontrue if in current line at current parse position we have a datestampprotected void parseDetailEventsIfExist(String line, ParseInformation pos, GCEvent event) throws ParseException
pos in line.line - current linepos - current parse positionevent - enclosing eventParseException - some problem when parsing the detail eventprotected void skipLines(LineNumberReader in, ParseInformation pos, List<String> lineStartStrings) throws IOException
in - inputStream of the current log to be readpos - current parse positionlineStartStrings - lines starting with these strings should be ignoredIOException - problem with reading from the fileCopyright © 2019. All rights reserved.