priti manas duddilla

+ Follow
since Jul 17, 2007
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 priti manas duddilla

Deadlocks happen when there are two objects having synchronized blocks and two different threads trying to run the synchronized blocks while each one is holding onto a lock that the other needs.
Well, why can't a scheduler make sure that a thread won't go to sleep while it enters a synchronized block/method. In other words, why does a scheduler kick a thread away from running state while it is holding a key. Why can't it make sure that the thread releases a lock before it can be kicked out from running state or is put to sleep ?

Could that be a solution to fix potential deadlocks ?

Thank you Kumar.
I have researched on Quartz, but i am not supposed to use it as, it is a open source software.

Thank you Ulf,It certainly helps.

This is what i have done so far...

public class LoadSchedulerService extends TimerTask {

Long delay = 5000; // delay for 5 sec.
Long period = 43200000; // repeat every 12 hours.
Timer timer = new Timer();

timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
//Establishing connection with UDB Database
//Extract Data from UDB Database
//Modify Data
//Establishing connection with MainFrame Start
//Updating the Mainframe DB2 Tables }
}, delay, period);

Can you please let me know, where i have to configure this java file, so that it loads on server startup and runs every day. (Should it be a servlet which extends TimerTask ? just a thought).
13 years ago
I am working on a J2EE Web Application.
One of my requirements is: I need to write a scheduler and configure it (in Web.xml, DD ?). This scheduler will run twice every day, and it should kick off a java job.
The job is, it should get a JDBC connection with UDB DB2 table and extract data, and should push the extracted data (after modifying as per requirements) to Mainframe DB2 tables.
I very much appreciate, if some one help me with the above requirement.
May be a code snippet or a link could help.

Thanks in advance.
13 years ago

What is the result?
A. Cat
B. Dog
C. Compilation fails.
D. The code runs with no output.
E. An exception is thrown at runtime.

Answer: B
Can some one please clarify,
Runnable is the job and Thread is the worker(a line directly quoted from K&B).
So in the above example, i have given a job(runnable) to thread(worker), then doesn't the thread execute runnable's run method?
Oh thats nice explanation over there!

But is it the case with checked exceptions too?
I think they propagate no matter what, even after being handled right?

Please clarify.

What is the result?
A. test end
B. Compilation fails.
C. test runtime end
D. test exception end
E. A Throwable is thrown by main at runtime.
Answer: D

Why doestn't the Catch block in Main() execute?
and how come System.out.print(�end �); executed?
Oh ok...
That answers my question.Thank you!
According to the K&B book,Page 236, chapter 3,
"In order to save some memory, two instances of the following wrapper classes will be equal when there primitive values are same.

Short and Integer(-128 to 127)
Character (/u0000 to /u007f)

So according to the above notes,shouldn't
Boolean b1 = new Boolean("true");
Boolean b2 = new Boolean("true");
(b1==b2) return true?

Please clarify.
So that means,
Locking on a class has no effect on locking on the object belonging to same class.Both are two different locks.
Can some one please explian the below sentence with a clear example?

A Static synchronized method (Locks on class instance) and a non-static suynchronised method (Locks on this instance) never block each other.

Thanks in advance.
"You cannot appreciate Day unless you have suffered a long chilly night"

You cannot appreciate the beauty of JSP's unless you know the problems of writing code (java and GUI related combined) in servlets.
You cannot appreciate the usefulness of EJB's unless you know the problems of mixing up Presentation logic (generally JSP's(servlets)) and Business Logic(generally EJB'b).

Please donot think about just this present project in hand.As you are already prepared for SCJP5, go ahead n pass the test, then you can study Servlets and JSP's while working on EJB's concurrenly, which will in fact make you undersatnd EJB's much more better.
Do all the questions carry equal marks?
Or do marks vary depending on the difficulty of the question (Something like GRE)
Do Drag and drop questions also carry same marks?
Choice E: public void run() {synchronized (Letters.class) { write();} }

By saying synchronised(Letters.class) you are getting the lock of the class Letters (Remember there is one and only 1 lock for any class)

So when you say new Letters("X").start();
The above run() method will be automaticall invoked, and obtain the lock of class "Letters" and this thread will only release the lock after completing the write() method, which guarantees printing XX or YY depending on the thread invoking, but never XY.

Correct me if i am wrong.
Is there any waitage or percentage for topics in the exam.
Atleast if there is any abstract understanding about this waitage, please
let me know.

For Eg:-
Threads 4 to 7 questions (or say 10%)
Generics and collestions 4 to 6 questions (15 %)
inner classes 1 question.(2%)

this might help me analize the position i am right now in, because, i am
good in some topics and week in some like threads.