tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michiel Bakker" ...@nose.demon.nl>
Subject Re: Tomcat and multi-processor support
Date Wed, 30 Apr 2003 17:57:12 GMT
My code for logging in is done in a jsp (logincheck.jsp) and looks like
this:

...
<jsp:useBean id="lgb" scope="page" class="something.login.Login" />
<jsp:useBean id="monitor" scope="application" class="java.util.HashMap" />
...
Webuser webuser = lgb.authenticate(usr, psw); // lgb is the login class for
authentication, webuser is a bean in which each user settings are stored in
...
try {
    if(monitor.containsKey(webuser)) {
       HttpSession oldsession = (HttpSession)monitor.get(webuser);
       oldsession.invalidate();
    }
}
catch (Exception e) {
    // log error
}
...
try {
   session = request.getSession();
   session.setAttribute("webUserId", webuser);
   monitor.put(webuser, session);
   session.setMaxInactiveInterval(3600);
}
catch (Exception e) {
   // log error
}

Then when a user is logged in, the following code is always performed on
each jsp when a user wants to access one:

Webuser webuser = (Webuser)session.getAttribute("webUserId");

if(webuser != null) {
   // do something
}
else {
   // webuser == null
}


The webapp was made with a few knowledge of Java. So if someone can help me
on this one, please let me know. As I know now, it has nothing to do with
Tomcat, but a few suggestions would be helpfull.

Thanks,

Michiel.


----- Original Message -----
From: "Halstead, Chris" <Chris.Halstead@delta.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Wednesday, April 30, 2003 5:23 PM
Subject: RE: Tomcat and multi-processor support


The behaviour of your app _shouldn't_ differ between machines with differing
numbers of CPUs.  Java is multithreaded by nature so I would wager that the
issue lies somewhere in your code, possibly a thread synchronization issue
that does not manifest in single-cpu environments.  Without seeing your code
or having a more detailed explanation of its' flow it is very difficult to
diagnose what may be wrong.  From your description it sounds like you're
storing each users' session object in a static HashMap?

There are not different versions of Tomcat for single vs. multi-processor
(CPU) use.  There are also not different versions of Apache in this regard,
but there are different _processing_ modules available (at least with Apache
2.x) - a threaded process module (each process handling numerous requests
via threading) and a multi-process module (one process per concurrent
request).

Hope this helps,

-chris

>
> Hi,
>
> I'm currently testing a webapp which runs on Tomcat 4.0.6 on
> a W2K multi-processor (dual xeon) platform. The JDK installed
> is veriosn 1.3.0 from Sun. The webapp runs fine under NT 4
> server and W2K, server both single processor architecture.
> The webapp consists of a login module for user
> authenticartion. When a user is logged in he/she can access
> jsp's. On each jsp a authorization check is made. Here's
> where the problem occurs. When a user logs in a hasmap is
> created in which a webuser object is put in together with a
> session object. This way, each user that is logged in can be
> verified. So, when the authorization check on a jsp is made
> on the webuser object, the webuser object seems to be null.
> Is this a multi-processor issue with Tomcat? As I was told
> there seem to be 2 different versions of the Apache httpd
> server, single- and multi-processor.
>
> With kind regards,
>
> Michiel.
>

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



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


Mime
View raw message