I guess I understand your intent and below might work for your requirement: LoggerContext context = new LoggerContext(); context.start(); context.addListener(new LoggerContextListener(){ @Override public void onReset(LoggerContext context){ //context.addListener(this); } @Override public boolean isResetResistant(){ return true;} @Override public void onStart(LoggerContext context){} @Override public void onStop(LoggerContext context){} @Override public void onLevelChange(Logger logger, Level level){} }); context.reset(); Changes include comment for context.addListener(this) and isResetResistant returning true. There are no two threads trying to act on a shared list, its the same thread trying to modify the list while it is iterated over. For the current need, I guess making it isResetResistant as true should add this into the listener list when a reset is performed. |