Ramnath Krishnan

Ranch Hand
+ Follow
since Feb 10, 1999
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ramnath Krishnan

Hi,
I had done some load testing using the following 2 approaches
1. Servlets - > Local Classes -> Database
2. Servlets -> EJB -> Local Classes -> Database
The Local Classes above are different and modified to suit each model.
My observation was that Model-1 was much faster(as expected)at about 65 users.
Q.1 Having said this, why should I go for Model 2, assuming that my application is not relying on heavy interaction in a distributed environment.
My Conclusions:
1. In Model 2, I can account for the overhead because of communication between Web Container and EJB container. Also, there is an extra bit of overhead using rmi.
2. No matter how many instances are available in the free pool, there may still be a requirement to instantiate new beans, which means some time spent in creating the objects.
3. Local Classes execute in the same container that it was initiated from. So in Model-1, local classes execute in the web container, and in the model-2 they execute in the EJB Container.
Am I right in this conclusion ?
Also, at runtime, the EJB instances are acquired from the free pool and shared across many clients, which requires passivation of the bean ( another added overhead)
Whereas, in the model-1 approach, new instances of the local classes are created as needed.
Q.2: Why use EJB instead of just helper classes/beans to perform tasks.
Q.3 Has anybody seen better performance in using Model-2 and how?
Thanks and appreciate any response.
Ah... Passed.
The exam was not difficult as some of the mock exams I had taken. Most of the question were on Threads, File I/O and language fundamentals.
This site is great. Both questions and solutions from this site helped me a lot. I found that answering questions on the forum and reviewing the solution posed there very useful.
Thanks you guys.
I'll hang around...
23 years ago
Congratulations.... good show..
BTW, how were you doing in your mock exams...

Good luck.
23 years ago
Here goes nothing... This is my take on the question
You are correct, the object determines which method to be called, but casting it forces the cast object's method to be called.
Notice the AWT event is only being handled, but in order to call the getKeyChar you have to cast it to a KeyEvent reference so that the correct method is called in the KeyEvent class. Same is true for the ActionEvent. getSource method is called for the ActionEvent class.
Do you agree ?
I suppose the reason for that would be:
1. evaluation of instance variables occurs after instantiation, hence j is set to zero first. So when value of i is calculated, j is zero.
After this line, j is set to 10.
Am I correct ?

Cool... nice one.
Here is what I found.
It has everthing to do with the modifier of the parent class.
In this instance the modifier for write() in super class is default.
At run time, the object refers to the sub class and therefore when write method is called within the constrcutor, the write method of the object it belongs to(sub class) is called, in this case being Thread.isInterrupted which returns false.
Note: If you change the super class write method to be private then, guess what... the Thread.activeThreadCount will be called.
It has to do with method being bound at compile time, private methods are bound but not public, default and protected.( I am not 100% sure about this)
This was a good question.
Hi,
Congratulation to everybody who passed SCJP exam.
I was wondering if anyone can give stats on thier results with
mock exam and the actual exam.
actual scored
like JExam scored 90%
and so on.
I am just trying to get an idea if I am ever gonna be ready for the certification.
Thanks and appreciate any guidance.
23 years ago
You are correct, variable can hold object references, but dont they have to be resolved at compile time, so when you declare a variable, the type of that variable should be at least an Object for the synchronized to work with it.
So int i = 0 with synchronized might not work, but
Object i = MyObject
synchronized(i){} will definitely work
Great .... Thanks;

First Question... You are correct answer C is the correct choice
Second Question.. Any buttons added are expanded by default by the Layout Manager to incorporate new buttons.
If rows are more they get added in the new row, if columns can expand they are added to the new column
Congratulations....
I have a question.
How were you faring in your mock exams any JQ or other mock exams
Some mock exams are tougher than others, so if you score above 75% in mock does that mean you have a good chance of scoring above 90 in the real exam.
please advise..
23 years ago
Terribly sorry.
Q2 does not compile and the previous example does not compile
The answer is correct, cannot put synchronized in front of a variable
only synchronize on an object.
so saying
String tmp = "Duh!!!" ;
synchronized(tmp){} is correct as tmp is a String object.
Sorry for the misunderstanding.
For Q2
try this
public class Test{
//inside main...
int i = 0;
synchronized(i){
System.out.println(i);
}
}
It works..
Here are the questions the answers to which baffled me based on what I learnt from other books plus the wording of the answers.
This from the JExam mock exam.
Here are the questions. (Ignore HTML Tags)
What is the output from the following piece of code:
loop1:

for(int i = 0; i < 3; i++){

loop2:

for(int j = 0; j < 3; j++){

if (i == j){

break loop2;

}

System.out.print("i = " + i + " j = " + j + " ");

}

}
There are several answers :-
1. Some number output
2. Some number output
3. Some number output
4. None of the above.
According to Bill Brogdens book, Java Cram, he says that a label cannot stand by itself, it has to be part of a statement, This turns out to be wrong. I successfully compiled and ran the above example.
Any comments ?
Q.2
Before which of the following can the keyword "synchronized" be placed, without causing a compile error.
Choices:
1. class methods
2. instance methods
3. variables
4. classes
My Choice ... 1,2,3 .... but the exam says choice 3 is not correct
I compiled and ran it works. Although choice 3 is not a sensible thing, but question says will it compile or not... it does.
Any comments.
Q.3. I dont have the exact one, but this is how it goes.
How many components can you add to a sector of a BorderLayout Container
Answer:
1.One
2.Any number of Components
3.Some other choice
The answer was: You can add only one Component to any sector, if you want to add more than one, then add the components to another container such as Panel and then add the panel to the sector.
This is the correct explaination, but the question is not how many components are displayed in a sector, the question is how many you can add. I can add as many as I want ( cant I) but only one will be displayed. example the CENTER.
I can go on adding, only the last one will be visible, but complier allows me to add.
Please advise, if I am wrong in reading the question correctly or its close to Friday and everthing is not fair in love and war.
Thanks in advance.

Hi,
I am trying to locate the documentation for an FTP API that Sun provides along with their other API's. I cannot locate the FTPClient in thier documentation. Can someone point me in the correct direction.
Thanks in Advance.
I extracted the sun.net.ftp.* and there are several FTP classes, but can anyone tell me if there is a javadoc associated with these classes.
Thanks,
23 years ago