Arul Jose

Ranch Hand
+ Follow
since Jan 14, 2005
Merit badge: grant badges
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 Arul Jose

I could not get japanese characters displayed in my jsp. I have set content type as UTF 8.

<%@page contentType="text/html;charset=UTF-8"%>

I am not manipulating anything.

I am getting the japanese string in a request parameter and I am just printing it.

Any help would be great.

Thanks.

ARUL JOSE.
12 years ago
JSP
How bigger will this pool get? Any parameters which decide this? Any way to control this thru code?

Arul Jose.
15 years ago
While the following code is run in a loop, is there a possibility of memory leak? Has any of you come accross this before?

16 years ago
I am doing a system call using Runtime.execute() method. I am getting the following error. Has anyone of you come accross this error. What did you do to rectify?

java.io.IOException: java.io.IOException: Cannot allocate memory|
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)|
at java.lang.ProcessImpl.start(ProcessImpl.java:65)|
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)|
at java.lang.Runtime.exec(Runtime.java:591)|
at java.lang.Runtime.exec(Runtime.java:429)|
at java.lang.Runtime.exec(Runtime.java:326)|
at export.StudioRobot.runRobot(Unknown Source)|
at export.ImageExportScheduler.executeTask(Unknown Source)|
at taskengine.internal.SchedulerBean.executeTask(SchedulerBean.java:417)|
at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)|
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)|
at java.lang.reflect.Method.invoke(Method.java:585)|
at mfw.bean.BeanProxy.invoke(BeanProxy.java:119)|
at $Proxy3.executeTask(Unknown Source)|
at taskengine.internal.ScheduleExecutor.executeNextTask(ScheduleExecutor.java:115)|
at taskengine.internal.ScheduleExecutor.run(ScheduleExecutor.java:41)|
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)|
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)|
at java.lang.Thread.run(Thread.java:595)|
[ July 31, 2007: Message edited by: Arul Jose ]
16 years ago
I am creating two thread objects and making them print from 0 to 9. I am setting different priorities. But the priorities doesn't show up in the output at all. I would like to know why.



the output is always :


Call Order : 1 iteration : 0
Call Order : 2 iteration : 0
Call Order : 1 iteration : 1
Call Order : 2 iteration : 1
Call Order : 1 iteration : 2
Call Order : 2 iteration : 2
Call Order : 1 iteration : 3
Call Order : 2 iteration : 3
Call Order : 1 iteration : 4
Call Order : 2 iteration : 4
Call Order : 1 iteration : 5
Call Order : 2 iteration : 5
Call Order : 1 iteration : 6
Call Order : 2 iteration : 6
Call Order : 1 iteration : 7
Call Order : 2 iteration : 7
Call Order : 1 iteration : 8
Call Order : 2 iteration : 8
Call Order : 1 iteration : 9
Call Order : 2 iteration : 9



I expected something like the following

Call Order : 1 iteration : 0
Call Order : 2 iteration : 0
Call Order : 2 iteration : 1
Call Order : 1 iteration : 1
Call Order : 2 iteration : 2
Call Order : 2 iteration : 3
Call Order : 1 iteration : 2


that is i expected more priority for the second thread.
16 years ago
i think he says 'start with a lang like c or lisp then come to java'.

i have talked about it here.

[ March 01, 2007: Message edited by: Arul Jose ]
[ March 01, 2007: Message edited by: Arul Jose ]
16 years ago
Hi Ranchies,

Is there a way to keep the code for one class in multiple files?

say like having the code for Utils.java in Utils0.java, Utils1.java, Utils2.java etc.

arul jose
16 years ago
Dear Seema,

There are already very popular books for SCJP preparation. What have you done special to make your book stand out. Please tell.

Regards,
ARUL JOSE
First of all thanks for your answers.

wait() releases the lock so that some other thread can grab the lock, do whatever the original thread is waiting for



1. so, only when the current thread is waiting for some other thread's execution, the wait() method is called?

2. so the method wait() waits till the current thread gets a notification?

3. if it doesn't get notified, it will keep waiting?

4. when a thread says notify() there is no guarantee that the thread which we are expecting will get notified right? so if the original thread gets a notify from some other unexpected thread, the original thread may run before the 'other thread'(which it is waiting for to finish some operation) finishes operation right? so what is the point in saying wait()?

to explain thread A is saying wait() expecting B to say notify(). what if some other thread C says notify() before B says notify() and A gets notified?

ARUL JOSE
why should b release its lock before finishing operations?

in the given code, when the thread comes to line 9, it has already got the lock of b, why should it then wait for the lock of b?

It must be done correctly. And it must be used as it was intended.



Henry, do you mean, it is the responsibility of the 'coder' to be careful ?


We have two methods here one is synchronized and the other is not. When an object of this class is locked, only one thread can access method1() but any number of threads can access method2(). while method1() runs, method2() also can simultaneously change the value of i which is used by method1() (method1 will see a different value for i, since it was altered by method2), since it is accessible by any number of threads. Is this not making the purpose of 'synchronized' void?
[ July 19, 2006: Message edited by: Arul Jose ]
Kindly see the following code.


when the line "Waiting for b to complete ..." is printed, already the lock for b is gotten. Am I right? why should the current thread wait to get b? Only after getting the lock on b the synchronized(b) block can be entered isn't? Why after getting b's lock, the thread should wait?
I could not come to a conclusion why the class TestInterfaceMember is not compiling. Please see if you can help.

[aruljose@aruljose javatry]$ javac -classpath ./classes:. TestInterfaceMember.java
TestInterfaceMember.java:2: cannot find symbol
symbol : class pkg
location: class test
class TestInterfaceMember implements test.pkg.I
^
TestInterfaceMember.java:2: interface expected here
class TestInterfaceMember implements test.pkg.I
^
TestInterfaceMember.java:6: cannot find symbol
symbol : variable i
location: class TestInterfaceMember
System.out.println(i);
^
3 errors
[aruljose@aruljose javatry]$ ls classes
test/
[aruljose@aruljose javatry]$ ls classes/test/
pkg/
[aruljose@aruljose javatry]$ ls classes/test/pkg/
I.class

TestInterfaceMember.java


classes/test/pkg/I.java
17 years ago