title: Do I need to create a DocumentBuilderFactory everytime?
body: <p>I need to update the news feeds  for every 5 minutes from a RSS feed .</p>
  
  <p>I have written a TimerTask as shown below </p>
  
  <pre><code>public class TimerTaskForAllNews 
  {
      public static void main( String[] args )
      {
          TimerTask task = new AllNewsUpdatrUtility();
          Timer timer = new Timer();
          timer.schedule(task, 1000,60000);
      }
  }
  </code></pre>
  
  <p>This is my TimerTask implementation class </p>
  
  <pre><code>package com.util;
  import java.net.URL;
  public class AllNewsUpdatrUtility extends TimerTask {
        private static AllNewsUpdatrUtility instance = null;
         public AllNewsUpdatrUtility() {}
         public static AllNewsUpdatrUtility getInstance() {
            if (instance == null)
               instance = new AllNewsUpdatrUtility();
            return instance;
         }
      @Override
      public void run() {
           try {
               JSONArray latestnews = new JSONArray();
               JSONObject jsonobj_allnews = new JSONObject();
               DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
               URL url = new URL("http://www.rssmix.com/u/8160628/rss.xml");
               Document doc = builder.parse(url.openStream());
               NodeList items = doc.getElementsByTagName("item");
              for (int i = 0; i &lt; items.getLength(); i++) {
                  Element item = (Element) items.item(i);
                  String title = getValue(item, "title");
                  String link = getValue(item, "link");
                  String pub_date = getValue(item, "pubDate");
  
              } // for loop ends here 
  
            } catch (Exception e) {
               e.printStackTrace();
            }
      }
  
  
  }
  </code></pre>
  
  <p>Could you please let me know i can improve this program anyway ?</p>