I\'ve an object with a certain state. The object is passed around and it\'s state is temporarly altered. Something like:
public void doSomething(MyObject obj) {
Java 7 has try-with-resources and you can extend AutoCloseable class to make use of it.
For Java 6 you may want to see the related question: What is the best way to emulate try-with-resources in Java 6?