Leon Rosenberg wrote:
Hi,

 was just browsing through tomcat code, and the following is just a
mystery to me ->StandardSession.fireSessionsEvent(type,data):

   public void fireSessionEvent(String type, Object data) {
        if (listeners.size() < 1)
            return;
        SessionEvent event = new SessionEvent(this, type, data);
        SessionListener list[] = new SessionListener[0];
--------> WHY synchronized?
probably someone reported a concurrent modification exception,

   synchronized (listeners) {
            list = (SessionListener[]) listeners.toArray(list);
        }

        for (int i = 0; i < list.length; i++){
            ((SessionListener) list[i]).sessionEvent(event);
        }

    }


can someone enlighten me? :-)


Another question, are there any plans to bring generics into tomcat
code?     /**
     * The session event listeners for this Session.
     */
    protected transient ArrayList<SessionListener> listeners = new
ArrayList<SessionListener>();
could make the code easier to understand, i would volunteer the work force.
its done here and there as we change code

FIlip
regards
Leon

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to