tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: svn commit: r1140801 - in /tomcat/trunk: java/org/apache/catalina/ha/session/DeltaManager.java webapps/docs/changelog.xml
Date Wed, 29 Jun 2011 11:06:02 GMT
On 29/06/2011 11:36, Keiichi Fujino wrote:
> 2011/6/29  <markt@apache.org>:
>> Author: markt
>> Date: Tue Jun 28 19:32:39 2011
>> New Revision: 1140801
>>
>> URL: http://svn.apache.org/viewvc?rev=1140801&view=rev
>> Log:
>> Notifications of changes in session ID to other nodes in the cluster should be controlled
by notifySessionListenersOnReplication rather than notifyListenersOnReplication.

<snip/>

> A primary node never trigger a notification to any session listeners.
> It notifies container event listener now.
> Should non-primary node be same behavior as a primary node?

I think you are right. The session event should not be fired on primary
or backup nodes but the container event should be fired on the primary
and optionally on the backup.

> If it notifies not session listener but container event listener,
> I will add some changes below.
> 
> Comments?
> 
> ===
> Index: java/org/apache/catalina/ha/session/DeltaManager.java
> ===================================================================
> --- java/org/apache/catalina/ha/session/DeltaManager.java	(revision 1140984)
> +++ java/org/apache/catalina/ha/session/DeltaManager.java	(working copy)
> @@ -97,6 +97,7 @@
>      private boolean expireSessionsOnShutdown = false;
>      private boolean notifyListenersOnReplication = true;
>      private boolean notifySessionListenersOnReplication = true;
> +    private boolean notifyChangeSessionIDEventOnReplication = true;

Maybe call this notifyContainerListenersOnReplication to allow for
possible re-use for other events (not that I can think of any right now).

Mark

>      private volatile boolean stateTransfered = false ;
>      private int stateTransferTimeout = 60;
>      private boolean sendAllSessions = true;
> @@ -420,6 +421,14 @@
>          this.notifyListenersOnReplication = notifyListenersOnReplication;
>      }
> 
> +    public boolean isNotifyChangeSessionIDEventOnReplication() {
> +        return notifyChangeSessionIDEventOnReplication;
> +    }
> +
> +    public void setNotifyChangeSessionIDEventOnReplication(
> +            boolean notifyChangeSessionIDEventOnReplication) {
> +        this.notifyChangeSessionIDEventOnReplication =
> notifyChangeSessionIDEventOnReplication;
> +    }
> 
>     @Override
>  public CatalinaCluster getCluster() {
> @@ -1463,7 +1472,11 @@
>          if (session != null) {
>              String newSessionID = deserializeSessionId(msg.getSession());
>              session.setPrimarySession(false);
> -            session.setId(newSessionID, notifySessionListenersOnReplication);
> +            session.setId(newSessionID, false);
> +            if (notifyChangeSessionIDEventOnReplication) {
> +
> getContainer().fireContainerEvent(Context.CHANGE_SESSION_ID_EVENT,
> +                        new String[] {msg.getSessionID(), newSessionID});
> +            }
>          }
>      }
> 
> 
> ===
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message