title: Single instance of a variable across entire application in multi-threading environment
body: <p>I have this below code. </p>
  
  <pre><code>private static volatile Properties props = null;
      private static volatile StanfordCoreNLP pipeline = null;
      /**
       * 
       * @return
       */
      static {
          if (props == null) {
              props = new Properties();
              props.setProperty("annotators", "tokenize, ssplit, parse, sentiment");
          }
          if (pipeline == null) {
              pipeline = new StanfordCoreNLP(props);
          }
      } 
  </code></pre>
  
  <p><strong>I want to have a single instance of variable <code>props</code> and <code>pipeline</code> across my entire application which is multithreaded</strong>. </p>
  
  <p>Is my code right or I am missing something?</p>
  
  <p>Thanks.</p>