I have a method and inside this method I have a block:
public void method()
{
[block instructions]
}
But this method is called twice in
First of all, if you want to easy and quick way, use a simple boolean flag (just don't forget the concurrency issue and use @Marko Topolnik solution).
But if we already opened a theoretical discussion and talked about design pattern, rather than using the state-pattern like @Tomasz Nurkiewicz mention, I would suggest to think of singleton (some will say it's more anti design pattern) and how to achieve only one instance of this class, so if requesting an instance of this class, the constructor will be called only in the first call.
if you altentivly want more "outside the box" solution, you can use aop