Tristan Van Poucke

Ranch Hand
+ Follow
since Jun 30, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tristan Van Poucke


I have no real performance issues, so I will leave it as it is.

Thanks for clearing that up for me.
10 years ago

I have a lot of persistence classes without private or public variables, ...
The methods only differ with the parameters passed to them.

So I thought I could save some memory making them all static methods.

Is this the way to go, or should I make them singletons or something?
10 years ago

I found the solution,

apparently the parameter name should be uppercase.

Although almost every search I did, I came across jsessionid in Lowercase.

Stupid mistake I guess

Thank you for the help.
10 years ago

I have made some progress.

It seems that the servlet recieves the jsession cookie from the applet correctly.
But it just ignores it.

Could this have something to do with tomcat?
10 years ago
Hmmm strange

I can't think of anything I do to change the default behaviour of the applet.

And it still uses another session...

Or could it be that the servlets, I call from the applet use a different session?

10 years ago

So when I do that i can add "jsessionid=..." to the urls of every servlet I call in the applet atleast for the GET methods.
How can I do this for PostMethod? This is what I have been trying, but it still uses a different session

Or is there a way of changing the session of the applet all together?
10 years ago
I need to pass the session to my applet.
Can I just put it in the code I use to call the applet?
Like this:

Or is that not safe enough?
10 years ago

I'm using a SessionListener to check if a user is online or not.
It basically keeps a List of all online users.
Too check if one is online or not I use "contains()".

If there were say a few 1000 users online it would take a while to perform "contains()".
That's why I thought of splitting up the lists in a few lists identified by the first 3 chars or so of the users id.

Is this the way to go, or are there other, better ways of doing this?

10 years ago
I have been thinking about prepared statements, and I have a question
In following example(psuedo, well sortoff) I have a method executing a query.

In that method i prepare a statement:

If I call this method several times, will the statement be prepared over and over again?
Thus leaving me only with the security side of the benefits of prepared statements.
I found my mistake.

Apparently in some persistence method's I called other persistence methods.
That tried to get a connection from the connectionpool, and then close it.
The first persistence method will try to close that connection again.

Thanks for the help
Okay, I have done this.
I opened the connection and closed it once per page because when working without a connection pool this method seemed faster.
But now with the connectionpool I open it just before the query and close it afterward, because the connection does not really get opened and closed, this works
at about the same speed.

Only problem now is that I get a "connection is closed" SQLException on every method I try to close the connection
Okay, thank you very much.

Now I started with apache dbcp, but I don't understand completely.

I have a singleton class wich gets properties from a property file and uses them to open connections and store them in the connectionpool.

Like this (snipped code)

Then I have this method "checkout" wich should give a connection to the user, this is being called whenever a user loads a page.

But with my previous way of connecting, I closed the connection everytime the requested page was done loading.
I used a method "checkIn()", I don't understand how i could return the method in the connection pool...
Any suggestions?

I started on writing my own connection pool, and I something is wrong.
If i test my site with testing software it runs ok. But if I combine that with me clicking on random links in the website, I start loosing connections
And eventually I run out of connection wich leads to null pointer exceptions.

this is my code:

Am I doing something wrong ?
Yesterday I tested my webapp with selenium ide.

I made selenium upload a picture to the server and a name and a description of it to the database, about 150 times.
What happened was, when I tested some pages myself while the selenium test was running. Those pages didn't load completely 90% of the times i refreshed.
What could my problem be?

I wouldn't think too much concurrent connections, since there was only 1 connection at a time.
But then again I do not have connection pooling yet.

I was running my webapp on my localhost tomcat 6(together with winamp and netbeans offcourse) and using a remote mysql database.
The selenium test was running on another computer in my network.
11 years ago