title: Java Disposable pattern
body: <p>C# supports disposable pattern for deterministic garbage collection using the <a href="https://msdn.microsoft.com/en-us/library/b1yfkh5e(v=vs.110).aspx" rel="noreferrer">dispose pattern</a>. </p>
  
  <p>Is there such pattern for java?</p>
  
  <p>Java 7 has <a href="http://download.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html" rel="noreferrer"><code>autoclosable</code></a>, which you can use with try finally blocks to invoke the <code>close</code> method.</p>
  
  <p>What about versions prior to 7?</p>
  
  <p>Is there a disposable pattern (deterministic garbage collection) for Java 5 or 6?</p>