boolean () { Thread thread = getBackgroundThread(); if (thread == null) { background = null; // the background thread is not allowed after the first access from the EDT return true; // the EDT is always allowed } if (thread == background) { return true; // the background thread is allowed only before the first access from the EDT } LOG.debug(new IllegalStateException("unexpected thread: " + thread)); return false; // a background thread is not allowed to handle Swing components }