Shanel Jacob

Ranch Hand
+ Follow
since Jun 18, 2006
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 Shanel Jacob

Hello all, Approximately how many questions are based on the drag-&-drop format? And what is it about drag-&-drop answers being reset when you do a review? How does that happen? Can anyone tell me?
Thanks for the tip Rajan. I've not gotten that far in the book yet but I hope to cover them this weekend.

One point though, in the sequence you've listed, afterBegin() was left out.

-Business method() (because of a call to this the bean is activated)

From the book, it says that afterBegin() runs BEFORE the business method and transaction commits BEFORE afterCompletion().

So I will update the sequence you've given, do let me know if it makes any sense.

Sequence 1 - ejbActivate()
Sequence 2 - afterBegin()
Sequence 3 - Business method
Sequence 4 - beforeCompletion()
Sequence 5 - Commits transaction
Sequence 6 - afterCompletion()

All these methods are callback methods.You do not call them.Container calls them due to various events that occur

Hi, Page 309 of HFEJB states "The Container calls the bean's ejbActivate() method ... The bean runs ejbActivate() before it runs the business method that triggered the activation." So for a passivated session bean that implements SessionSynchronization interface, the order of events will be:

1) ejbActivate runs, followed by afterBegin, beforeCompletion and lastly, afterCompletion.

OR is ejbActivate the last one to run?

2) afterBegin runs, followed by beforeCompletion, afterCompletion and lastly ejbActivate.

Thank you.
Hello, Is ejbActivate() called followed by afterBegin() or you can call ejbActivate() when afterCompletion() finishes?
Kavitha, Here are the requested information, although preparation style and preferences might vary from person to person.

1) Info. regarding 2nd book I used:

Title: A Programmer's Guide to Java Certification, 2nd Edition.
Authors: Khalid A. Mughal & Rolf W. Rasmussen
ISBN: 0-201-72828-1

2) Dan's Mock:

3) Enthuware's Mock:
14 years ago
Hi all, I finished my exam today and am happy with my score. Woot! Some tips I'd like to share with you:

1) K&B book is a must.

2) Khalid's book. I find reading Chapter 11 on Collections and Maps (e.g. Page 430 & 431) together with K&B book helpful.

3) Dan's Mock when learning each chapters. My usual practise is to read a new chapter and then practise Dan's Mock to reinforce the concepts.

4) Type out some code examples, pepper the code with System.out.println() where appropriate to help you better understand some concepts.

5) Enthuware's Mock just before you take the SCJP exam. IMO, if you study pretty thoroughly, you should get a score above 80%. But to help make it easier to score in the 90-100% range, practise more mock exams.

6) Last but not least, this website. =) When all else fails, when sometimes you entertain thoughts of giving up ... FTW!

Special thanks to Barry Gaunt, Gowher Amin Naik and Keith Lynn for always being so helpful. Thank you so much to those who joined in the discussions (in alphabetical order). Sorry if I leave anyone out.:

Andy Morris
Ankur Sharma
Anthony Karta
Ashwini Ghamandi
Barry Gaunt
Daniel Bryant
Ernest Friedman-Hill
Finner Jones
Gowher Amin Naik
Ivan Rebrov
Jerry Sharma
Joshua Antony
Kalaivanan D
Keith Lynn
Kevin Crays
Marc Weber
Naseem Khan
Naveen Klon
Neelesh Bodas
Peter MacMillan
Prarthana Reddy
Ravi Reddy
S Thiyanesh
Saumya Tangeda
Suhas Wadadekar
Swapnil Trivedi
Swarupa Patil
Vladimir Scheglov
14 years ago
Hi all, during the exam, do the questions actually tell you if assertion is enabled or disabled (since the "right" answer varies with assumption).
Based on the reply/comment below:

Originally posted by Gagan Indus:

3) Blocks synchronized on this object-reference, and synchronized methods share da same instance lock .
( like saying
<font color="red">
public void run()
//do losta work
<font color="red">
synchronized public void run()
//do losta work
is one n da same thing( as long as there is no statement outside da sync block ! )

That means the only way we can synchronize 2 different threads is to use:

Is this correct? The question above is quite similar to the mock question from JQ+ which really confuses me:

So if you want to synchronize 2 threads AND ensure that "x" and "y" are always equal. You need to "synchronized (MyThread1.class)" because "synchronized(this)" or "synchronized public void run()" is redundant therefore not going to do the work.
public void methodOverload (int var1, int var2, float var3)
m1 = var1; m2 = var2; m3 = var3;

** Choose ONE only. Which one overload methodOverload()?

I think what confuses me is "initializes the instance variables".

If it is "new" that "initializes the instance variables", then the 2nd statement would be false.

What do you guys think?
Which is true?

K&B1.4 page 334 has the following statement.

1) The default constructor is a no-arg constructor with a no-arg call to super().

2) Instance methods and variables are only accessible after the super constructor runs.
Is it ok to summarize the levels of synchronization as follow:

public synchronized void run()
any of the 2 threads can access, x and y might NOT be equal

synchronized (this)
any of the 2 threads can access, x and y will always be equal

synchronized (Test1.class)
only 1 thread can access, x and y will always be equal
Still need to clarify the concepts. So we have 2 thread objects and even if the run() is synchronized, it doesn't matter because each thread object calls its own run method? In this scenario, x and y may not be the same.

Now suppose I synchronized by object instead. That means both thread objects (we cannot know which thread) will take turn incrementing x and y, so x and y will always have same values.

This question is quite similar to the one I posted here:

Tried to compile and run the code to understand the concepts but I got even more confused as the results seem to contradict my thoughts.

I tried running the code and it shows this (below) which really doesn't agree with the explanation given (above). The synchronized method does seem to work.:

[ August 08, 2006: Message edited by: Shanel Jacob ]
Hi all, this is from JQ+ Mock Question ID: 988384270281

The answer given is: Here, there are two threads. But when one thread enters run(), it accquires lock on obj and enters into infinite loop. Now, the second thread also enters run but has to wait as it is also trying to accquire the same lock (obj is a static field). So, in affect, only the thread that gets the lock first, keeps on running. The second thread never gets a chance. so the values printed are sequencial, x and y are always printed as equal and they get incremented by 1 on each line.

However, when I tried removing the "static" on line 04, I could see that both threads are shown in the println on line 13. why is it that "x" and "y" are still incrementing by 1 on each line (which suggests to me that syncronization still works) but both threads are shown eventhough we have an infinite loop (which suggests to me that syncronization doesn't seem to work). The screen output I got is:

instead of:

[ August 07, 2006: Message edited by: Shanel Jacob ]