LinkedList eventsToDeliver; synchronized (this.eventMutex) {  while (pendingEvents.isEmpty()) {    if (this.isStopped) { if (sipStack.isLoggingEnabled()) sipStack.getLogWriter().logDebug( "Stopped event scanner!!"); return;
LinkedList eventsToDeliver; synchronized (this.eventMutex) {  while (pendingEvents.isEmpty()) {    if (this.isStopped) { if (sipStack.isLoggingEnabled()) sipStack.getLogWriter().logDebug( "Stopped event scanner!!"); return; }    try { eventMutex.wait(); } catch (InterruptedException ex) {  sipStack.getLogWriter().logDebug("Interrupted!"); return; }
	public void run() {		while (true) {			EventWrapper eventWrapper = null;			LinkedList eventsToDeliver;			synchronized (this.eventMutex) {				// First, wait for some events to become available.				while (pendingEvents.isEmpty()) {					// There's nothing in the list, check to make sure we					// haven't					// been stopped. If we have, then let the thread die.					if (this.isStopped) {						if (sipStack.isLoggingEnabled())							sipStack.getLogWriter().logDebug(									"Stopped event scanner!!");						return;					}					// We haven't been stopped, and the event list is indeed					// rather empty. Wait for some events to come along.					try {						eventMutex.wait();					} catch (InterruptedException ex) {						// Let the thread die a normal death						sipStack.getLogWriter().logDebug("Interrupted!");						return;					}				}				// There are events in the 'pending events list' that need				// processing. Hold onto the old 'pending Events' list, but				// make a new one for the other methods to operate on. This				// tap-dancing is to avoid deadlocks and also to ensure that				// the list is not modified while we are iterating over it.				eventsToDeliver = pendingEvents;				pendingEvents = new LinkedList();			}			ListIterator iterator = eventsToDeliver.listIterator();			while (iterator.hasNext()) {				eventWrapper = (EventWrapper) iterator.next();				if (sipStack.isLoggingEnabled()) {					sipStack.getLogWriter().logDebug(							"Processing " + eventWrapper + "nevents "									+ eventsToDeliver.size());				}				deliverEvent(eventWrapper);			}		} // end While	}