tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Connection.close() has already been called during login
Date Mon, 23 Jan 2012 22:42:50 GMT
Hash: SHA1

To whom it may concern,

On 1/23/12 4:20 PM, wrote:
> My code does not talk to another cluster as I have a single Tomcat 
> only, but just wondering how one would scale.

Me too.

> Maybe the strategy to handle clusters is to write information, such
>  as the list of the users to the number of times they have logged
> in in the last hour, into a location shared by all machines.

That sounds fairly straightforward.

> In my code below the code is stored in failedAttempts which is a
> Map<String /*username/*, FailedAttempt> where FailedAttempt
> represents the number of times the user has logged in in the last
> hour or whatever. It is in-memory, which is fine for one Tomcat.

Right. This is how Tomcat does things in its own LockOutRealm. Take a
look at the code. It works with all realm types (see the code for the
different authenticate() methods it implements).

> But we could move this Map into a file that is on a mounted drive 
> available from all Tomcat machines, or we could store it in the 
> database. Either way we have to synchronize writes to the file or 
> database, and I think database does this automatically, and maybe 
> FileLock will do the job for the files. But anyway, it sounds
> complicated.

memcached. Cassandra. Whatever.

> As for my my authenticate it was as follows, although I don't see 
> this should cause the failure in the subject of this email -- 
> "Connection.close() has already been called during login":

Yup, it certainly doesn't look like your code does anything with the
superclass's Connection.

> public Principal authenticate(String username, String credentials) 
> { threadUserLockedOut.remove();

Why in the world are you using a ThreadLocal in here?

It makes me wonder what other odd things you are doing in your Realm
(or anywhere else for that matter).

- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Mozilla -


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

View raw message