April.Johnson

Ranch Hand
+ Follow
since May 02, 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 April.Johnson

Thanks, Sahil,
But I don't create the sequence. It's a pre-existing sequence that I just get the next number from. The increment value is set to one.
And actually, for clarification, I need to be able to get any number of nextval values from 2 to 4000. And it will vary from user to user and with each execution. I just used 1000 as an example.
I thought of doing something like the following pseudocode?

But (even if I could do this and I don't know I can), the problem with that would be that it wouldn't be thread-safe. If another thread grabbed sequence.nextval before it was set, there would be a conflict.
Thanks for making me think.
April
Hi,
I need to be able to get 1000 sequence.netval values from an Oracle database. Right now, the Java code loops through 1000 times and executes (by calling statement.executeQuery()) the following PreparedStatement 1000 times.

This takes about 1 minute and 15 seconds. I need to speed this up.
Is there a way I can send one statement to the database and get back 1000 values of nextval?
If I can't do that, any suggestion on how to speed it up any other ways?
This has to be threadsafe.
Thanks for any help.
April
Actually, the finalize() method is called when the JVM determines that an object is eligible for garbage collection. There is no guarantee that the gc is actually run at that time.
From the API:

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.


So the object may still be referenced by other objects waiting to finalize. Only after the JVM decides that there aren't any more references will the object be truly eligible for gc. Still doesn't guarantee when that process will run.
However, to answer my own question, I am using Weblogic as my server, so I put in the -verbosegc command in my startup script and so get information that way.
22 years ago
Hi,
Is there anyway to know when garbage collection is taking place?
I have an application that uses lots of objects and bogs down after a certain amount of calculations and I need to know if the time delay is on my end (the JVM) due to waiting for garbage collection or if it's in another part of the application (waiting for database, etc).
I can keep track of how many objects I have and how many are eligible for gc by using the finalize method and a static variable, but other than trying to guess if gc has or is taking place, is there a way to know for sure?
Thanks for any help.
April
22 years ago
I checked on my certification page that Sun provides to keep track of my certifications. And I confirmed that the requirement to take the Web Component Developer's exam is to have at least one of the following certifications:
Sun Certified Programmer for the Java 2 Platform
Sun Certified Programmer for the Java Platform (1.1) (310-022)
Sun Certified Programmer for the Java Platform (1.0.2) (310-020)

If you're curious about your own information, go to https://www.galton.com/~sun_s/login.html and log on. If you've never been there before, you'll need information from one of your Examination Score Report sheets to create a password and gain access.
April
[ January 11, 2002: Message edited by: April.Johnson ]
[ January 11, 2002: Message edited by: April.Johnson ]
From what I've heard, More Servlets and JSP is a better book. I'm planning on buying that one and using Core Servlets as a companion to help me sort things out that maybe aren't explained as fully in More Servlets.
I found a link last week that I think would be helpful. A lot of people were complaining about Marty Hall's Core Servlets and JSP book not covering the versions of Servlets and JSP that is necessary for the exam. Then another JavaRancher pointed out the next version named More Servlets and JavaServer Pages (http://www.moreservlets.com). Since Hall had already written one book on servlets and JSP, the rumor is that More Servlets refers to Core Servlets for more explaination on some topics.
So now you can look up those topics online. Core Servlets and JavaServer Pages is viewable as PDF files. Check it out. http://pdf.coreservlets.com/
April
[ January 07, 2002: Message edited by: April.Johnson ]
IF your instructor said that, I'd consider getting another instructor.
April

Originally posted by Cherry Sta. Romana:
Thanks to both of you. My friend was asking about this and I said that I don't think that it is possible. However, we both attended a training on Java and we both remember that our trainor said that it is possible using some form of super.super.. Anyway, we mis-understood it probably.
Thanks again.


I read the Objectives for the Sun Certified Programmer and didn't see any mention of JDBC or Sockets on the objectives. As for Graphics, the objectives only state to be familiar with the java.awt package, including event listeners.
http://suned.sun.com/US/images/certification_progj2se_07_01.pdf
April

Originally posted by Nils_Widmer:
70% + in JQPlus?
I bought the JQPlus, but hell I just got 31%, 37% and 46% in the tests I tried, I find that test awfully hard even if I program on job in java for over 7 months, plus there were no Sockets, Graphics or JDBC questions in JQPlus at all, dont they update JQPlus??


Check out the following code to see if it answers your question.

April
What Alex said is true.
In addition, you should change:
<br /> to<br />
That should produce the effect you want.
April
[This message has been edited by April.Johnson (edited July 30, 2001).]
I did run the code and just as we expected, it was a "Statement not reached" compiler error.
April
First of all, suspend() and resume() are deprecated as of Java 2, so they shouldn't show up on the exam.
Second: A suspended thread can only be resumed from another thread.
The reason the code doesn't print "Leaving run" is because the thread is never resumed and that SOP statement is never reached. For that matter, resume() is never reached because a thread can't resume itself. The control comes from outside the thread.
April

Originally posted by david hu:
Thanks. But is there a way not to use WindowListener interface? Since from the book Java exam cram, it's said that override processEvent is another way to tackle event?


You're right, David. From RHE, page 356:

The strategy of explicitly enabling events for a component can be summarized as follows:
1. Create a subclass of the component.
2. In the subclass constructor, call enableEvents(AWTEvent.XXX_EVENT_MASK).
3. Provide the subclass with a processXXXEvent() method; this method should call the superclass' version before returning.


You did 1 and 3, but forgot step 2. Add the following line in your constructor and you'll get the desired action.
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
April
[This message has been edited by April.Johnson (edited July 27, 2001).]
[This message has been edited by April.Johnson (edited July 27, 2001).]

Originally posted by payal sharma:

//When it break the loop and reach to point why it do not came again in
loop ?


Hi, Payal,
point is just a label for your for loop. It's not a label that you "goto" since Java doesn't allow gotos. When you say "break point;" you're telling the program to break out of the loop labeled as point. This is very handy when you have complex nested loops and want to break out of multiple layers of for loops at one time. You could also say "continue point;" In your example there's no need for the label as the label becomes useful with more than one block construct.
April