Raghavan Chockalingam

Ranch Hand
+ Follow
since Dec 20, 2005
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 Raghavan Chockalingam

Preparation material:
SCJP 6 book from Bert Bates & Kathy Sierra
Mock exams that came along with the CD in the book
Few quizzes from Whiz labs; I did not use Whiz labs much but I believe it should be very helpful for your preparations

All the best for rest of you guys!
10 years ago
sorry, i did actually mean stopping a Callable running in one of the threads in the ThreadPool.

Suppose if we want the Callable task to perform some log operations when it is terminated, is it possible to accomplish that? When interrupting a thread stopping not running in a ThreadPool in sleep mode, it throws InterruptedException and we could do log operations inside the catch block of InterruptedException. Also we had more control by invoking sleep() only at the point we needed. but now terminating a Callable in ThreadPool, just abruptly terminates at some point which we have no control of.
the solution suggested works. thanks very much. i hope this is the standard approach to stop a thread when run using a pool executor.
i think the answer is correct as the line1 itself is invalid. you cannot assign an object of base class to its child class.

casting: allowed only subclass to parent class, i.e. up the hierarchy
every single code in Java lies in some class. you need to group the first few lines for the start of an application somewhere inside a class probably a method. so you try to put them in main() method of some class and make it static so that you can call it without making an instance of that class.

let us say i have a runnable to execute and i want the ability to stop in the middle.

i execute the runnable using

inside the search runnable, there is code to wait() and look for any interrupts implementing like below..

I am not sure how to stop this Runnable. remove() on the thread pool using a Runnable only removes it from the queue. The shutDownNow() stops Runnable successfully but that does not end gracefully as I wanted to handle interruptions.

I did find a way to stop threads in this approach but not sure when it runs in ThreadPool.

Summarizing: My question is how to stop a Runnable when running in ThreadPoolExecutor?

thank you

[ May 02, 2008: Message edited by: Raghavan Chockalingam ]
[ May 02, 2008: Message edited by: Raghavan Chockalingam ]
Hello Craig,

Thanks for your reply and revised code.

I am not sure whether you checked the display of the applet as it is not displayed properly. The problems are
1. text area does not expand
2. text field does not expand properly in width

I have also a few questions for you
1. why did you prefer to put the code in init() as I have put it in start(). Do you think it makes it a bit faster to load?

2. Why have you used a scroll pane for text field and not used for a text area?


Originally posted by Craig Wood:

i understand grid width specifies the number of cells a component can occupy. i wanted tagLabel and descriptionLabel to span one cell each and wanted Tag and Description to span two grid cells each. I also understood that weightx and weighty specifies how much of space relatively a component should acquire when its container is stretched. What did you actually meant in youur comments?
13 years ago
i have attached below an applet i am trying to create. I am a beginner with Swing so please explain me if you find any problems below.

this applet just features a normal form.
the problems i have identified are:
1. i have labels for fields tag & description. They are not getting aligned to left
2. The text field and text area fields are not getting displayed properly.
3. i want the submit button to expland to the entire grid width, in my case it is 2.

i have tried to do the above but does not work? can any one tell me why? Thanks for your help.

Applet Code:
13 years ago
I am unable to drop users from root account

[ January 16, 2006: Message edited by: Raghavan Chockalingam ]
I have run queries at the end of the output to show you that no locks exist. I want to know how to do two things...
1. Find and list the entries in the table where indexes are stored
2. How to list all the tables created by an user?
1. You can see the error coming up when I try to delete the column which is a primary key.

2. I am not able to add foreign key after creating table

I am posting all the problems in a single topic because all are related
Problem 3: Unable to drop a foreign key on a table

You are right!!!,,,it was returning null, I jus noticed that I have put 'Id' instead of 'id' which should be in place when you said it might be returning null
14 years ago
It's good to know that PreparedStatements automatically escape strings...
The common package has functions I need but I never have used commons.lang package.

is this package already available with default JDK installation?
do I have to install any other package to make these classes available?
do I have to set classpath as well?
how do I refer these classes in my programs...say Commmons.lang.StringEscapeUtils.escapeJava(String)
14 years ago
I have a session object which has to be converted in to 'int'. I am trying to convert lang.Object to lang.String and then to int....I am able to convert lang.Object to lang.String but not able to do lang.String to int.
code that gives error...

error reported...

[ January 06, 2006: Message edited by: Raghavan Chockalingam ]
14 years ago
Sameer was right, I was trying to store a return int variable in a String variable which I recognized now...
earlier, it was...

Thanks to all of your help guys...
14 years ago