I have this method:
public void start()
{
if(!isAclone())
{
...
this.thread.start()
}
else
{
...
this.thread.start()
}
I would execute one my method inside only if-block
.wherever I put my method in start()
method, it is execute twice.how can I achieve this problem?
EDIT
private final AtomicBoolean hasRun = new AtomicBoolean();
...
initializeLogger();
if(!hasRun.getAndSet(true))
{
activateMonitoring();
}
....