Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

InitExecutor may repeat "doInit"

Open xuyue531 opened this issue 8 years ago • 2 comments

InitExecutor#doInit() may be executed repeatedly.

we can do this to avoid repeat doInit.

private static AtomicBoolean initialized = new AtomicBoolean(false);
...
public static void doInit() {
  if (!initialized.compareAndSet(false, true)) {
       return;
  }
  ...
}

xuyue531 avatar Jul 24 '18 15:07 xuyue531

Thanks for reporting!

sczyh30 avatar Jul 24 '18 15:07 sczyh30

it only happen in staic { }. is it a NotThreadSafe ? It is ThreadSafe

CodeIngL avatar Jul 30 '18 10:07 CodeIngL