Re: [PATCH] JvmRoute changes

2002-01-17 Thread costinm

On Thu, 17 Jan 2002, Tom Drake wrote:

> Costin:
>
> I'm not sure where to make these changes. In particular, I don't
> know to which message(s) the jvmRoute information is attached
> or how to extract it from the payload.

The route is attached on each request. It could be sent only when the
connection is first established, but that's how ajp13 was designed (
and it's good for channels where you don't have a long-lived connection ).

It is extracted by the RequestHandler in BaseRequest.jvmRoute.

But don't spend too much time on this - we can do it later or in jk2,
for now you solved the main problem which is getting sticky session to
work.

Costin


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: [PATCH] JvmRoute changes

2002-01-17 Thread Tom Drake

Costin:

I'm not sure where to make these changes. In particular, I don't
know to which message(s) the jvmRoute information is attached
or how to extract it from the payload.

Tom


- Original Message -
From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
To: "Tomcat Developers List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 15, 2002 8:45 PM
Subject: Re: [PATCH] JvmRoute changes


|
|
| On Tue, 15 Jan 2002 [EMAIL PROTECTED] wrote:
|
| > Date: Tue, 15 Jan 2002 19:51:02 -0800 (PST)
| > From: [EMAIL PROTECTED]
| > Reply-To: Tomcat Developers List <[EMAIL PROTECTED]>
| > To: Tomcat Developers List <[EMAIL PROTECTED]>
| > Subject: Re: [PATCH] JvmRoute changes
| >
| > Hi Tom,
| >
| > Sorry for the late response, I didn't have email last few days.
| >
| > The patch is perfect, I hope Remy will be able to incorporate it
| > in 4.0.2.
| >
| > One extra thing we could try is to look in the jk connector
| > and see if it's possible to set the engine - we have
| > access to the Request and Container, so we should be able
| > to find the engine and set the vmroute automatically if
| > it's not set already.
| >
|
| If you can get to the relevant Context (which is probably the value of
| Container in your description above, but I haven't examined the code to
| make sure), you can find the associated Engine quite easily:
|
|   Container container = ... what you already have ...
|   Container engine = container;
|   while (!(engine instanceof Engine)) {
| engine = engine.getParent();
|   }
|   ... engine now contains the relevant Engine instance ...
|
| > Costin
| >
|
| Craig
|
|
| --
| To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
| For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
|
|
|


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: [PATCH] JvmRoute changes

2002-01-15 Thread Craig R. McClanahan



On Tue, 15 Jan 2002 [EMAIL PROTECTED] wrote:

> Date: Tue, 15 Jan 2002 19:51:02 -0800 (PST)
> From: [EMAIL PROTECTED]
> Reply-To: Tomcat Developers List <[EMAIL PROTECTED]>
> To: Tomcat Developers List <[EMAIL PROTECTED]>
> Subject: Re: [PATCH] JvmRoute changes
>
> Hi Tom,
>
> Sorry for the late response, I didn't have email last few days.
>
> The patch is perfect, I hope Remy will be able to incorporate it
> in 4.0.2.
>
> One extra thing we could try is to look in the jk connector
> and see if it's possible to set the engine - we have
> access to the Request and Container, so we should be able
> to find the engine and set the vmroute automatically if
> it's not set already.
>

If you can get to the relevant Context (which is probably the value of
Container in your description above, but I haven't examined the code to
make sure), you can find the associated Engine quite easily:

  Container container = ... what you already have ...
  Container engine = container;
  while (!(engine instanceof Engine)) {
engine = engine.getParent();
  }
  ... engine now contains the relevant Engine instance ...

> Costin
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: [PATCH] JvmRoute changes

2002-01-15 Thread costinm

Hi Tom,

Sorry for the late response, I didn't have email last few days.

The patch is perfect, I hope Remy will be able to incorporate it
in 4.0.2.

One extra thing we could try is to look in the jk connector
and see if it's possible to set the engine - we have
access to the Request and Container, so we should be able
to find the engine and set the vmroute automatically if
it's not set already.

Costin


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: [PATCH] JvmRoute changes w/attachments

2002-01-15 Thread Tom Drake

Clearly, the jvmRoute must uniquely identify each TC instance in a cluster.
The fact that it is an 'attribute' of the Engine object means that it may be
specified in server.xml (as an attribute of the Engine tag). However,
there is no reason it couldn't be assigned in a different, more automatic,
way.

It's conceivable that Apache / mod_webapp could assign this value
(a sequential number) to each worker that it knows about. The
mod_webapp protocol would need to support this.


Having said that, it would be nice if we could dynamically add new
tc instances to an Apache managed cluster. The fail-over session
management code I've written already does this, but Apache needs
to know about new workers too.

This means that when you add a new tc instance (session repository)
to the cluster, it will discover the other tc's, announce it's arrival,
and request a copy of all known sessions, all tc's will begin sending
it new / updated sessions. However, if Apache doesn't know about
the new worker, it will never send it any web traffic.

Tom


- Original Message -
From: "Remy Maucherat" <[EMAIL PROTECTED]>
To: "Tomcat Developers List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 15, 2002 3:08 AM
Subject: Re: [PATCH] JvmRoute changes w/attachments


| > Couldn't we have an automatic jvmRoute generated from
| > misc entropy if the entry is not present in server.xml ?
| > for example just the server hostname or ip address ?
| >
| > Adding the hostname/adress should be fine for the majority of case
| > where only one JVM will be make run TC 4.x by system.
| >
| > Or may be just the md5 of the hostname which could be pretty
| > long.
| >
| > The goal is to avoid touching server.xml when you deploy
| > TC 4.x on many boxes and you don't want admin to touch ALL
| > server.xml
| >
| > And since you keep the server.xml setting you could tune
| > easily specific case (ie, many TC 4.x on the same machine)
|
| Or maybe we can just use the engine name, if we state that in that case it
| should be uinque inside the cluster.
| Notice that I didn't port the patch to the 4.0 branch yet; I just wanted
to
| get some comments here :)
|
| Remy
|
|
| --
| To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
| For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
|
|
|


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: [PATCH] JvmRoute changes w/attachments

2002-01-15 Thread jean-frederic clere

Remy Maucherat wrote:
> 
> > Couldn't we have an automatic jvmRoute generated from
> > misc entropy if the entry is not present in server.xml ?
> > for example just the server hostname or ip address ?
> >
> > Adding the hostname/adress should be fine for the majority of case
> > where only one JVM will be make run TC 4.x by system.
> >
> > Or may be just the md5 of the hostname which could be pretty
> > long.
> >
> > The goal is to avoid touching server.xml when you deploy
> > TC 4.x on many boxes and you don't want admin to touch ALL
> > server.xml
> >
> > And since you keep the server.xml setting you could tune
> > easily specific case (ie, many TC 4.x on the same machine)
> 
> Or maybe we can just use the engine name, if we state that in that case it
> should be uinque inside the cluster.
> Notice that I didn't port the patch to the 4.0 branch yet; I just wanted to
> get some comments here :)

I really like the patch because I have to use something like
engine.setJvmRoute(getpid()).

> 
> Remy
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: [PATCH] JvmRoute changes w/attachments

2002-01-15 Thread Remy Maucherat

> Couldn't we have an automatic jvmRoute generated from
> misc entropy if the entry is not present in server.xml ?
> for example just the server hostname or ip address ?
>
> Adding the hostname/adress should be fine for the majority of case
> where only one JVM will be make run TC 4.x by system.
>
> Or may be just the md5 of the hostname which could be pretty
> long.
>
> The goal is to avoid touching server.xml when you deploy
> TC 4.x on many boxes and you don't want admin to touch ALL
> server.xml
>
> And since you keep the server.xml setting you could tune
> easily specific case (ie, many TC 4.x on the same machine)

Or maybe we can just use the engine name, if we state that in that case it
should be uinque inside the cluster.
Notice that I didn't port the patch to the 4.0 branch yet; I just wanted to
get some comments here :)

Remy


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: [PATCH] JvmRoute changes w/attachments

2002-01-15 Thread GOMEZ Henri

Couldn't we have an automatic jvmRoute generated from
misc entropy if the entry is not present in server.xml ?
for example just the server hostname or ip address ?

Adding the hostname/adress should be fine for the majority of case 
where only one JVM will be make run TC 4.x by system.

Or may be just the md5 of the hostname which could be pretty
long.

The goal is to avoid touching server.xml when you deploy
TC 4.x on many boxes and you don't want admin to touch ALL
server.xml

And since you keep the server.xml setting you could tune
easily specific case (ie, many TC 4.x on the same machine)

Regards

-
Henri Gomez ___[_]
EMAIL : [EMAIL PROTECTED](. .) 
PGP KEY : 697ECEDD...oOOo..(_)..oOOo...
PGP Fingerprint : 9DF8 1EA8 ED53 2F39 DC9B 904A 364F 80E6 



>-Original Message-
>From: Tom Drake [mailto:[EMAIL PROTECTED]]
>Sent: Monday, January 14, 2002 3:33 PM
>To: Tomcat Developers List
>Cc: [EMAIL PROTECTED]
>Subject: [PATCH] JvmRoute changes w/attachments
>
>
>Costin:
>
>I noticed that my patch email got line-wrapped. So, I'm 
>sending them as an
>attachment.
>
>Tom
>- Original Message -
>From: "Tom Drake" <[EMAIL PROTECTED]>
>To: "Tomcat Developers List" <[EMAIL PROTECTED]>
>Cc: <[EMAIL PROTECTED]>
>Sent: Monday, January 14, 2002 6:19 AM
>Subject: [PATCH] JvmRoute changes
>
>
>| Costin:
>|
>| Sorry for the late response, but here are the patches you 
>requested for
>| JvmRoute.
>| This tests out using the session example servlet.
>|
>| After inclusion of these patches, adding the following 
>attribute to the
>| 
>| tag in server.xml
>|
>| jvmRoute="fubar"
>|
>| Causes ".fubar" to be appended to the end of all session 
>id's (generated
>| by ManagerBase) as follows:
>|
>| 70AB699891C12D3748248D026012F815.fubar
>|
>| Tom
>|
>| P.S. Having never submitted a patch before, I wasn't sure whether you
>wanted
>| them all strung together like I've done here, or as attachments.
>|
>|
>| Index: Engine.java
>| ===
>| RCS file:
>|
>/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apach
>e/catalina/En
>| gine.java,v
>| retrieving revision 1.7
>| diff -u -r1.7 Engine.java
>| --- Engine.java 16 Oct 2001 23:14:13 - 1.7
>| +++ Engine.java 14 Jan 2002 13:48:07 -
>| @@ -132,6 +132,18 @@
>|   */
>|  public void addDefaultContext(DefaultContext defaultContext);
>|
>| +/**
>| + * Set the JvmRouteId for this engine.
>| + *
>| + * @param jvmRouteId the (new) JVM Route ID. Each 
>Engine within a
>| cluster
>| + *must have the same JVM Route ID.
>| + */
>| +public void setJvmRoute(String jvmRouteId);
>| +
>| +/**
>| + * Retrieve the JvmRouteId for this engine.
>| + */
>| +public String getJvmRoute();
>|
>|  // 
>- Public
>| Methods
>|
>|
>|
>| Index: StandardEngine.java
>| ===
>| RCS file:
>|
>/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apach
>e/catalina/co
>| re/StandardEngine.java,v
>| retrieving revision 1.12
>| diff -u -r1.12 StandardEngine.java
>| --- StandardEngine.java 21 Dec 2001 21:15:45 - 1.12
>| +++ StandardEngine.java 14 Jan 2002 13:55:03 -
>| @@ -143,6 +143,11 @@
>|   */
>|  private DefaultContext defaultContext;
>|
>| +/**
>| + * The JVM Route ID for this Tomcat instance. All Route 
>ID's must be
>| unique
>| + * across the cluster.
>| + */
>| +private String jvmRouteId;
>|
>|  // -
>| Properties
>|
>| @@ -278,6 +283,24 @@
>|
>|  }
>|
>| +/**
>| + * Set the cluster-wide unique identifier for this Engine.
>| + * This value is only useful in a load-balancing scenario.
>| + * 
>| + * This property should not be changed once it is set.
>| + */
>| +public void setJvmRoute(String routeId) {
>| +  this.log("StandardEngine.setJvmRoute="+routeId);
>| +  jvmRouteId = routeId;
>| +}
>| +
>| +/**
>| + * Retrieve the cluster-wide unique identifier for this Engine.
>| + * This value is only useful in a load-balancing scenario.
>| + */
>| +public String getJvmRoute() {
>| +  return jvmRouteId;
>| +}
>|
>|  /**
>|   * Disallow any attempt to set a parent for this 
>Container, since an
>|
>

Re: [PATCH] JvmRoute changes

2002-01-14 Thread Daniel Rall

Daniel Rall <[EMAIL PROTECTED]> writes:

> Hey Tom, when sending patches inline, you need to instruct your email
> client to not line wrap at 76 columns (what's good for the humans
> isn't good for the machines :-).

Look like you already noticed.  :-)

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: [PATCH] JvmRoute changes

2002-01-14 Thread Daniel Rall

Hey Tom, when sending patches inline, you need to instruct your email
client to not line wrap at 76 columns (what's good for the humans
isn't good for the machines :-).

Dan

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: [PATCH] JvmRoute changes w/attachments

2002-01-14 Thread jean-frederic clere

Tom Drake wrote:
> 
> Costin:
> 
> I noticed that my patch email got line-wrapped. So, I'm sending them as an
> attachment.

Yep, I like the patch ;-)

> 
> Tom
> - Original Message -
> From: "Tom Drake" <[EMAIL PROTECTED]>
> To: "Tomcat Developers List" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, January 14, 2002 6:19 AM
> Subject: [PATCH] JvmRoute changes
> 
> | Costin:
> |
> | Sorry for the late response, but here are the patches you requested for
> | JvmRoute.
> | This tests out using the session example servlet.
> |
> | After inclusion of these patches, adding the following attribute to the
> | 
> | tag in server.xml
> |
> | jvmRoute="fubar"
> |
> | Causes ".fubar" to be appended to the end of all session id's (generated
> | by ManagerBase) as follows:
> |
> | 70AB699891C12D3748248D026012F815.fubar
> |
> | Tom
> |
> | P.S. Having never submitted a patch before, I wasn't sure whether you
> wanted
> | them all strung together like I've done here, or as attachments.
> |
> |
> | Index: Engine.java
> | ===
> | RCS file:
> |
> /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/En
> | gine.java,v
> | retrieving revision 1.7
> | diff -u -r1.7 Engine.java
> | --- Engine.java 16 Oct 2001 23:14:13 - 1.7
> | +++ Engine.java 14 Jan 2002 13:48:07 -
> | @@ -132,6 +132,18 @@
> |   */
> |  public void addDefaultContext(DefaultContext defaultContext);
> |
> | +/**
> | + * Set the JvmRouteId for this engine.
> | + *
> | + * @param jvmRouteId the (new) JVM Route ID. Each Engine within a
> | cluster
> | + *must have the same JVM Route ID.
> | + */
> | +public void setJvmRoute(String jvmRouteId);
> | +
> | +/**
> | + * Retrieve the JvmRouteId for this engine.
> | + */
> | +public String getJvmRoute();
> |
> |  // - Public
> | Methods
> |
> |
> |
> | Index: StandardEngine.java
> | ===
> | RCS file:
> |
> /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/co
> | re/StandardEngine.java,v
> | retrieving revision 1.12
> | diff -u -r1.12 StandardEngine.java
> | --- StandardEngine.java 21 Dec 2001 21:15:45 - 1.12
> | +++ StandardEngine.java 14 Jan 2002 13:55:03 -
> | @@ -143,6 +143,11 @@
> |   */
> |  private DefaultContext defaultContext;
> |
> | +/**
> | + * The JVM Route ID for this Tomcat instance. All Route ID's must be
> | unique
> | + * across the cluster.
> | + */
> | +private String jvmRouteId;
> |
> |  // -
> | Properties
> |
> | @@ -278,6 +283,24 @@
> |
> |  }
> |
> | +/**
> | + * Set the cluster-wide unique identifier for this Engine.
> | + * This value is only useful in a load-balancing scenario.
> | + * 
> | + * This property should not be changed once it is set.
> | + */
> | +public void setJvmRoute(String routeId) {
> | +  this.log("StandardEngine.setJvmRoute="+routeId);
> | +  jvmRouteId = routeId;
> | +}
> | +
> | +/**
> | + * Retrieve the cluster-wide unique identifier for this Engine.
> | + * This value is only useful in a load-balancing scenario.
> | + */
> | +public String getJvmRoute() {
> | +  return jvmRouteId;
> | +}
> |
> |  /**
> |   * Disallow any attempt to set a parent for this Container, since an
> |
> | Index: ManagerBase.java
> | ===
> | RCS file:
> |
> /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/se
> | ssion/ManagerBase.java,v
> | retrieving revision 1.10
> | diff -u -r1.10 ManagerBase.java
> | --- ManagerBase.java 10 Dec 2001 01:24:41 - 1.10
> | +++ ManagerBase.java 14 Jan 2002 14:06:45 -
> | @@ -74,6 +74,7 @@
> |  import java.util.HashMap;
> |  import java.util.Random;
> |  import org.apache.catalina.Container;
> | +import org.apache.catalina.Engine;
> |  import org.apache.catalina.Logger;
> |  import org.apache.catalina.Manager;
> |  import org.apache.catalina.Session;
> | @@ -516,6 +517,30 @@
> |
> |
> |  /**
> | + * Retrieve the enclosing Engine for this Manager.
> | + *
> | + * @return an Engine object (or null).
> | + */
> | + 

[PATCH] JvmRoute changes w/attachments

2002-01-14 Thread Tom Drake

Costin:

I noticed that my patch email got line-wrapped. So, I'm sending them as an
attachment.

Tom
- Original Message -
From: "Tom Drake" <[EMAIL PROTECTED]>
To: "Tomcat Developers List" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, January 14, 2002 6:19 AM
Subject: [PATCH] JvmRoute changes


| Costin:
|
| Sorry for the late response, but here are the patches you requested for
| JvmRoute.
| This tests out using the session example servlet.
|
| After inclusion of these patches, adding the following attribute to the
| 
| tag in server.xml
|
| jvmRoute="fubar"
|
| Causes ".fubar" to be appended to the end of all session id's (generated
| by ManagerBase) as follows:
|
| 70AB699891C12D3748248D026012F815.fubar
|
| Tom
|
| P.S. Having never submitted a patch before, I wasn't sure whether you
wanted
| them all strung together like I've done here, or as attachments.
|
|
| Index: Engine.java
| ===
| RCS file:
|
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/En
| gine.java,v
| retrieving revision 1.7
| diff -u -r1.7 Engine.java
| --- Engine.java 16 Oct 2001 23:14:13 - 1.7
| +++ Engine.java 14 Jan 2002 13:48:07 -
| @@ -132,6 +132,18 @@
|   */
|  public void addDefaultContext(DefaultContext defaultContext);
|
| +/**
| + * Set the JvmRouteId for this engine.
| + *
| + * @param jvmRouteId the (new) JVM Route ID. Each Engine within a
| cluster
| + *must have the same JVM Route ID.
| + */
| +public void setJvmRoute(String jvmRouteId);
| +
| +/**
| + * Retrieve the JvmRouteId for this engine.
| + */
| +public String getJvmRoute();
|
|  // - Public
| Methods
|
|
|
| Index: StandardEngine.java
| ===
| RCS file:
|
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/co
| re/StandardEngine.java,v
| retrieving revision 1.12
| diff -u -r1.12 StandardEngine.java
| --- StandardEngine.java 21 Dec 2001 21:15:45 - 1.12
| +++ StandardEngine.java 14 Jan 2002 13:55:03 -
| @@ -143,6 +143,11 @@
|   */
|  private DefaultContext defaultContext;
|
| +/**
| + * The JVM Route ID for this Tomcat instance. All Route ID's must be
| unique
| + * across the cluster.
| + */
| +private String jvmRouteId;
|
|  // -
| Properties
|
| @@ -278,6 +283,24 @@
|
|  }
|
| +/**
| + * Set the cluster-wide unique identifier for this Engine.
| + * This value is only useful in a load-balancing scenario.
| + * 
| + * This property should not be changed once it is set.
| + */
| +public void setJvmRoute(String routeId) {
| +  this.log("StandardEngine.setJvmRoute="+routeId);
| +  jvmRouteId = routeId;
| +}
| +
| +/**
| + * Retrieve the cluster-wide unique identifier for this Engine.
| + * This value is only useful in a load-balancing scenario.
| + */
| +public String getJvmRoute() {
| +  return jvmRouteId;
| +}
|
|  /**
|   * Disallow any attempt to set a parent for this Container, since an
|
| Index: ManagerBase.java
| ===
| RCS file:
|
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/se
| ssion/ManagerBase.java,v
| retrieving revision 1.10
| diff -u -r1.10 ManagerBase.java
| --- ManagerBase.java 10 Dec 2001 01:24:41 - 1.10
| +++ ManagerBase.java 14 Jan 2002 14:06:45 -
| @@ -74,6 +74,7 @@
|  import java.util.HashMap;
|  import java.util.Random;
|  import org.apache.catalina.Container;
| +import org.apache.catalina.Engine;
|  import org.apache.catalina.Logger;
|  import org.apache.catalina.Manager;
|  import org.apache.catalina.Session;
| @@ -516,6 +517,30 @@
|
|
|  /**
| + * Retrieve the enclosing Engine for this Manager.
| + *
| + * @return an Engine object (or null).
| + */
| +public Engine getEngine() {
| +  Engine e = null;
| +  for (Container c=getContainer(); e == null && c != null ;c =
| c.getParent()) {
| +if (c != null && c instanceof Engine) {
| +  e = (Engine)c;
| +}
| +  }
| +  return e;
| +}
| +
| +/**
| + * Retrieve the JvmRoute for the enclosing Engine.
| + * @return the JvmRoute or null.
| + */
| +public String getJvmRoute() {
| +  Engine e = getEngine();
| +  return e == null ? null : e.getJvmRoute();
| +}
| +
| +/**
|   * Construct and return a new session object, based on the default
|   * settings specified by this Manager's properties.  The session
|   * id will be assigned by this method

[PATCH] JvmRoute changes

2002-01-14 Thread Tom Drake

Costin:

Sorry for the late response, but here are the patches you requested for
JvmRoute.
This tests out using the session example servlet.

After inclusion of these patches, adding the following attribute to the

tag in server.xml

jvmRoute="fubar"

Causes ".fubar" to be appended to the end of all session id's (generated
by ManagerBase) as follows:

70AB699891C12D3748248D026012F815.fubar

Tom

P.S. Having never submitted a patch before, I wasn't sure whether you wanted
them all strung together like I've done here, or as attachments.


Index: Engine.java
===
RCS file:
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/En
gine.java,v
retrieving revision 1.7
diff -u -r1.7 Engine.java
--- Engine.java 16 Oct 2001 23:14:13 - 1.7
+++ Engine.java 14 Jan 2002 13:48:07 -
@@ -132,6 +132,18 @@
  */
 public void addDefaultContext(DefaultContext defaultContext);

+/**
+ * Set the JvmRouteId for this engine.
+ *
+ * @param jvmRouteId the (new) JVM Route ID. Each Engine within a
cluster
+ *must have the same JVM Route ID.
+ */
+public void setJvmRoute(String jvmRouteId);
+
+/**
+ * Retrieve the JvmRouteId for this engine.
+ */
+public String getJvmRoute();

 // - Public
Methods



Index: StandardEngine.java
===
RCS file:
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/co
re/StandardEngine.java,v
retrieving revision 1.12
diff -u -r1.12 StandardEngine.java
--- StandardEngine.java 21 Dec 2001 21:15:45 - 1.12
+++ StandardEngine.java 14 Jan 2002 13:55:03 -
@@ -143,6 +143,11 @@
  */
 private DefaultContext defaultContext;

+/**
+ * The JVM Route ID for this Tomcat instance. All Route ID's must be
unique
+ * across the cluster.
+ */
+private String jvmRouteId;

 // -
Properties

@@ -278,6 +283,24 @@

 }

+/**
+ * Set the cluster-wide unique identifier for this Engine.
+ * This value is only useful in a load-balancing scenario.
+ * 
+ * This property should not be changed once it is set.
+ */
+public void setJvmRoute(String routeId) {
+  this.log("StandardEngine.setJvmRoute="+routeId);
+  jvmRouteId = routeId;
+}
+
+/**
+ * Retrieve the cluster-wide unique identifier for this Engine.
+ * This value is only useful in a load-balancing scenario.
+ */
+public String getJvmRoute() {
+  return jvmRouteId;
+}

 /**
  * Disallow any attempt to set a parent for this Container, since an

Index: ManagerBase.java
===
RCS file:
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/se
ssion/ManagerBase.java,v
retrieving revision 1.10
diff -u -r1.10 ManagerBase.java
--- ManagerBase.java 10 Dec 2001 01:24:41 - 1.10
+++ ManagerBase.java 14 Jan 2002 14:06:45 -
@@ -74,6 +74,7 @@
 import java.util.HashMap;
 import java.util.Random;
 import org.apache.catalina.Container;
+import org.apache.catalina.Engine;
 import org.apache.catalina.Logger;
 import org.apache.catalina.Manager;
 import org.apache.catalina.Session;
@@ -516,6 +517,30 @@


 /**
+ * Retrieve the enclosing Engine for this Manager.
+ *
+ * @return an Engine object (or null).
+ */
+public Engine getEngine() {
+  Engine e = null;
+  for (Container c=getContainer(); e == null && c != null ;c =
c.getParent()) {
+if (c != null && c instanceof Engine) {
+  e = (Engine)c;
+}
+  }
+  return e;
+}
+
+/**
+ * Retrieve the JvmRoute for the enclosing Engine.
+ * @return the JvmRoute or null.
+ */
+public String getJvmRoute() {
+  Engine e = getEngine();
+  return e == null ? null : e.getJvmRoute();
+}
+
+/**
  * Construct and return a new session object, based on the default
  * settings specified by this Manager's properties.  The session
  * id will be assigned by this method, and available via the getId()
@@ -547,6 +572,12 @@
 session.setCreationTime(System.currentTimeMillis());
 session.setMaxInactiveInterval(this.maxInactiveInterval);
 String sessionId = generateSessionId();
+String jvmRoute = getJvmRoute();
+// @todo Move appending of jvmRoute generateSessionId()???
+if (jvmRoute != null) {
+  sessionId += '.' + jvmRoute;
+  session.setId(sessionId);
+}
 /*
 synchronized (sessions) {
 while (sessions.get(sessionId) != null)// Guarantee
uniqueness




- Original Message -
From: <[EMAIL PROTECTED]>
To: "Tomcat Developers List" <[EMAIL PROTECTED]>
Sent: Thursday, January 10, 2002 8:44 AM
Subjec