Ashish Vijay Joshi

Greenhorn
+ Follow
since Nov 27, 2006
Merit badge: grant badges
For More
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 Ashish Vijay Joshi

Yes same or higher priority is more appropriate.
Although dependent on particular VM threads implementation policy, largely the intention of yield() is to take currently running thread and give a chance from runnable pool to any thread with same priority as of thread being swaped from running.
Here once ThreadB is started at line 4 depending on VM either run inside new thread or synchronized block in main thread at line 6 will execute.
Suppose synchronized block in main executes it acquires a lock and immidiately calls wait() on this object, resulting in release of the acquired lock in line 6. Now if run method of ThreadB executes it gets lock on instance b and does the work and notifies on b which could invoke thread(here main)from blocked state to runnable. But the other way i.e if VM chooses to execute run inside ThreadB before synchronized block code in main could be hazardous. Hope this helps.

Ashish
Thanks for the insight.... Can you describe how can a reference variable point to an object of a class loaded by some other class loader..
as in

Will this call not try to load class C using current loader (if not already loaded) and create an object for it? How can I force that class C, loaded by loader2 should be used?
Got it!!! Thanks
Ashish
14 years ago
JSP
Thanks for reply.
Does it mean that separate class loaders are used for servlets and jsps.
Container might be running inside one VM having default embedded class loader which is used to load servlet class files,but in case of JSP custom class loaders are used is it what you mean. Moreover it chooses files to recompile
based on timestamps.
PS: If you can throw some light on what it means by precompilation of jsps.

Regards
Ashish
14 years ago
JSP
Hello,
I want to know why we need not restart apache/tomcat server if we make a change in jsp file. Just refreshing a browser will reflect my changes. On the other hand if i make a change in servlet(java file) i need to restart tomcat/apache to reflect those changes.

Regards
Ashish
14 years ago
JSP
1.Static field case is ok because static fields are meant for sharing among all instances of a class.

2.In method case:
void method(Demo d)
{
System.out.println(d.i);
}
But even if d has a referencce for object demo d2 but inside a method
d.i is actually accessing the variable i which is of object d2 only.
So again the question remains how d1 access d2's i.

Warm Regards
Ashish
16 years ago
I came across a question in this site only which says:

There are two objects of same class. A class has some private variables.
Can these two objects access these private variables of other.
EX:
class Demo
{
private int i;
}
in main()
{
Demo d1,d2;
}
now can d1 access i of d2 n vice-versa. If yes den how it could be done in coding.
16 years ago
Hello,
I am using tomcat5.5,jdk1.5.0_07 and sun application server 8. I have set the classpath as PATH environment variable as:

C:\Program Files\Java\jdk1.5.0_07\bin;
C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar;
C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\jsp-api.jar;
C:\ProgramFiles\Java\jdk1.5.0_07lib\tools.jar;C:\Sun\AppServer\lib\j2ee.jar;
Now from some folder in say D: drive i am trying to compile a program which is a servlet. But its giving error:
import javax.servlet;import javax.servlet.*; does not exist.
Unable to recognise the symbol HttpServletRequest;

Please give solution.
16 years ago