Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!

David King

Greenhorn
+ Follow
since Apr 10, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by David King

Thanks,
I found another design that does the trick. I persist the session id on a db. When the user logs out the system logs removes the session id from the db. Otherwise, if the session expires and listener removes that sessoin id from the db.
20 years ago
Jakarta 4.0 provides a nice method from javax.servlet.http.HttpSessionContext called getSession(String) that takes the sessionID, but it has been deprecated for security reasons. I can see why. But, I still need to invalidate a session from another session. Any ideas?
I am writing a security piece for a web application that allows a user to login on another user's session and take it over. The other user is logged out and would have to log in again (hopefully under another id.)
20 years ago
Anyone know how, using only the session object, to print out all the variables that are stored on that object from html?
Your help is appreciated
------------------
"It's alive, it's alive!" -Young Frankenstien (We all are mad scientists when it comes to getting things to execute perfectly.)
21 years ago
JSP
That was it. Thanks-
------------------
"It's alive, it's alive!" -Young Frankenstien (We all are mad scientists when it comes to getting things to execute perfectly.)
21 years ago
I have an app that displays the result set for a given oracle query. I can successfully set the font for everything in the app except for the column headings. Has anyone have this issue before? Thanks-
------------------
"It's alive, it's alive!" -Young Frankenstien (We all are mad scientists when it comes to getting things to execute perfectly.)
21 years ago
1 no, but you can suggest that it be ran.
2 The finalizer is called on your object just before the memory that it occupied is reclaimed.

In a nutshell there are 3 things you can do to facilitate garbage collection:
1. When you�re done with a reference to an object, set it to null. This way that object is marked for garbage collection.
2. Implement the finalize method for your complex objects. Here you could set all object references that this object used to null. The finalizer is the last thing that is called before the garbage collector reclaims the memory for the object. By the way, when one implements a finalize method, one is overriding the finalize method from the superclass Object.
3. You can suggest that the gc be ran with: System.gc() or Runtime.getRuntime.gc(). Java does not guarantee which object's finalizer will execute first. Garbage collection can be CPU intensive.
Hope this helps. Let me know if you have more questions.
Additional information:
Garbage collector is a low priority daemon thread (one that runs for the benefit of other threads.) The java language specification strangely, doesn't lay down the law on how garbage is to be collected. This way every implementer of a JVM is allowed to pursue the optimal method of gc.
I recently unstalled jdk 1.3 and installed 1.2.2 for a project (bluemartini 3.2). Yesterday I reinstalled 1.3 with no apparent issues. Are there? Does setting the classpath fix this? Do the installations set any registry values? Are there any other locations that files are written other than c:\jdk1.3 or d:\jdk1.2.2? Thanks-
21 years ago
In a nutshell there are 3 things you can do to facilitate garbage collection:
1. When you�re done with a reference to an object, set it to null. This way that object is marked for garbage collection.
2. Implement the finalize method for your complex objects. Here you could set all object references that this object used to null. The finalizer is the last thing that is called before the garbage collector reclaims the memory for the object. By the way, when one implements a finalize method, one is overriding the finalize method from the superclass Object.

3. You can suggest that the gc be ran with: System.gc() or Runtime.getRuntime.gc(). Java does not guarantee which object's finalizer will execute first. Garbage collection can be CPU intensive.
Hope this helps. Let me know if you have more questions.

Additional information:

Garbage collector is a low priority daemon thread (one that runs for the benefit of other threads.) The java language specification strangely, doesn't lay down the law on how garbage is to be collected. This way every implementer of a JVM is allowed to pursue the optimal method of gc.
Hope this helps.

Originally posted by Alex Guo:
I am wondering what I shall do if I want to collect garbage on time so that the application won't run out of memory. I think it's very important for a software product to sustain stress test.
In the methods, do I need to set variables to null before leaving? or those variables are automatically discarded and the corresponding referenced objects will be garbage collected(later)? Is there any other thing I shall do for this?
Thanks!


21 years ago