title: Are ANTLR parsers for Java thread safe?
body: <p>Is an ANTLR (v3.2) generated Java parser thread safe?</p>
  
  <p>For example, in a servlet request handler, can I reuse the same parser instance to parse a request body? The requests may come in on different threads, so parsing must be done in a thread safe manner. if instances are thread safe, I can reuse the same instance in each request; else I must pool them or create new instances. The <a href="http://www.antlr.org/wiki/display/ANTLR3/ANTLR+v3+FAQ" rel="noreferrer">ANTLRv3 FAQ</a> is silent on thread safety.</p>
  
  <p>There is an ancient (2000) <a href="http://www.jguru.com/faq/view.jsp?EID=93725" rel="noreferrer">jGuru question</a> about this, and the answer there,</p>
  
  <blockquote>
    <p>Typically this question is really asking, "can I make multiple
    instances of the same parser and parse multiple input streams at the
    same time?"</p>
  </blockquote>
  
  <p>makes the wrong assumption.</p>
  
  <p>Since it is not mentioned in the ANTLR FAQ, I assume parsers are <strong>not</strong> thread safe.</p>