#fixed code
                                public void send( SessionEvent event ) {
        if ( listeners != null && !listeners.isEmpty() ) {
            for( SessionEventListener sel : listeners ) {
                sel.onEvent( event );
            }
        }
    }
#vulnerable code 
                                public void send( SessionEvent event ) {
        synchronized( listeners ) {
            for( SessionEventListener sel : listeners ) {
                if ( event instanceof StartedSessionEvent) {
                    sel.sessionStarted( event );
                } else if ( event instanceof ExpiredSessionEvent) {
                    sel.sessionExpired( event );
                } else if ( event instanceof StoppedSessionEvent) {
                    sel.sessionStopped( event );
                } else {
                    String msg = "Received argument of type [" + event.getClass() + "].  This " +
                                 "implementation can only send event instances of types " +
                        StartedSessionEvent.class.getName() + ", " +
                        ExpiredSessionEvent.class.getName() + ", or " +
                        StoppedSessionEvent.class.getName();
                    throw new IllegalArgumentException( msg );
                }
            }
        }
    } 
                            #location 2 
                            #vulnerability type THREAD_SAFETY_VIOLATION