Package org.htmlunit
Class WebClient.PooledCSS3Parser
- java.lang.Object
-
- org.htmlunit.cssparser.parser.AbstractCSSParser
-
- org.htmlunit.cssparser.parser.javacc.CSS3Parser
-
- org.htmlunit.WebClient.PooledCSS3Parser
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,org.htmlunit.cssparser.parser.javacc.CSS3ParserConstants
- Enclosing class:
- WebClient
public static class WebClient.PooledCSS3Parser extends org.htmlunit.cssparser.parser.javacc.CSS3Parser implements java.lang.AutoCloseable
This is a poolable CSS3Parser which can be reused automatically when closed. A regular CSS3Parser is not thread-safe, hence also our pooled parser is not thread-safe. INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
-
-
Field Summary
Fields Modifier and Type Field Description private WebClient.CSS3ParserPool
pool_
The pool we want to return us to.-
Fields inherited from class org.htmlunit.cssparser.parser.javacc.CSS3Parser
jj_nt, token, token_source
-
Fields inherited from interface org.htmlunit.cssparser.parser.javacc.CSS3ParserConstants
A_LETTER, AND, ANGLE_DEG, ANGLE_GRAD, ANGLE_RAD, ANGLE_TURN, ASTERISK, ATKEYWORD, C_LETTER, CDC, CDO, CH, CHARSET_SYM, COLON, COMMA, COMMENT, COMMENT_, CUSTOM_PROPERTY_NAME, D_LETTER, DASHMATCH, DEFAULT, DIMENSION, DOT, E_LETTER, EMS, EOF, EQUALS, ESCAPE, EXS, F_LETTER, FONT_FACE_SYM, FREQ_HZ, FREQ_KHZ, FUNCTION, FUNCTION_CALC, FUNCTION_HSL, FUNCTION_LANG, FUNCTION_NOT, FUNCTION_RGB, FUNCTION_VAR, G_LETTER, GREATER, H, H_LETTER, H_PLACEHOLDER, HASH, HNUM, I_LETTER, IDENT, IMPORT_SYM, IMPORTANT_SYM, INCLUDES, INHERIT, K_LETTER, L_LETTER, LBRACE, LENGTH_CM, LENGTH_IN, LENGTH_MM, LENGTH_PC, LENGTH_PT, LENGTH_PX, LENGTH_Q, LROUND, LSQUARE, M_LETTER, MEDIA_SYM, MINUS, N_LETTER, NAME, NL, NMCHAR, NMSTART, NONASCII, NOT, NUM, NUMBER, O_LETTER, ONLY, P_LETTER, PAGE_SYM, PERCENTAGE, PLUS, PREFIXMATCH, R_LETTER, RBRACE, REM, RESOLUTION_DPCM, RESOLUTION_DPI, RROUND, RSQUARE, S, S_LETTER, SEMICOLON, SLASH, STRING, STRING1, STRING2, SUBSTRINGMATCH, SUFFIXMATCH, T_LETTER, TILDE, TIME_MS, TIME_S, tokenImage, U_LETTER, UNICODE, UNICODE_RANGE, UNKNOWN, URI, URL, VH, VMAX, VMIN, VW, W, X_LETTER, Z_LETTER
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PooledCSS3Parser(WebClient.CSS3ParserPool pool)
Create a new poolable parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Implements the AutoClosable interface.protected WebClient.PooledCSS3Parser
markInUse(WebClient.CSS3ParserPool pool)
Resets the parser's pool state so it can be safely returned again.-
Methods inherited from class org.htmlunit.cssparser.parser.javacc.CSS3Parser
_class, attrib, calc, calcNumberProduct, calcNumberSum, calcNumberValue, calcProduct, calcSum, calcValue, charsetRule, combinator, declaration, dimension, disable_tracing, elementName, enable_tracing, expr, fontFaceRule, function, generateParseException, getGrammarUri, getNextToken, getParserVersion, getToken, hash, hexcolor, hslColor, importRule, mediaExpression, mediaList, mediaQuery, mediaRule, mediaRuleList, medium, number, operator, pageRule, pageSelector, pageSelectorList, parseSelectorsInternal, percentage, prio, property, pseudo, pseudoPage, ReInit, ReInit, rgbColor, selector, selectorList, simpleSelector, styleDeclaration, styleRule, styleSheet, styleSheetRuleList, styleSheetRuleSingle, term, trace_enabled, unaryOperator, unicodeRange, unknownAtRule, var
-
Methods inherited from class org.htmlunit.cssparser.parser.AbstractCSSParser
addEscapes, createLocator, createSkipWarning, doubleValue, functionInternal, getDocumentHandler, getErrorHandler, getInputSource, getLastNumPos, getParserMessage, handleCharset, handleEndDocument, handleEndFontFace, handleEndMedia, handleEndPage, handleEndSelector, handleIgnorableAtRule, handleImportStyle, handleProperty, handleStartDocument, handleStartFontFace, handleStartMedia, handleStartPage, handleStartSelector, hexColorInternal, hslColorInternal, intValue, normalizeAndValidatePagePseudoClass, parseMedia, parsePriority, parsePropertyValue, parseRule, parseSelectors, parseStyleDeclaration, parseStyleSheet, rgbColorInternal, setDocumentHandler, setErrorHandler, toCSSParseException, toCSSParseException, toCSSParseException, toCSSParseException, unescape
-
-
-
-
Field Detail
-
pool_
private WebClient.CSS3ParserPool pool_
The pool we want to return us to. Because multiple threads can use this, we have to ensure that we see the action here.
-
-
Constructor Detail
-
PooledCSS3Parser
protected PooledCSS3Parser(WebClient.CSS3ParserPool pool)
Create a new poolable parser.- Parameters:
pool
- the pool the parser should return to when it is closed
-
-
Method Detail
-
markInUse
protected WebClient.PooledCSS3Parser markInUse(WebClient.CSS3ParserPool pool)
Resets the parser's pool state so it can be safely returned again.- Parameters:
pool
- the pool the parser should return to when it is closed- Returns:
- this parser for fluid programming
-
close
public void close()
Implements the AutoClosable interface. The return method ensures that we are notified when we incorrectly close it twice which indicates a programming flow defect.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.IllegalStateException
- in case the parser is closed several times
-
-