Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

Srini Krishnan

Greenhorn
+ Follow
since Jul 08, 2005
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 Srini Krishnan

can another bean's methods and resource manager (like database) be accessed from ejbCreate() for a stateful session bean.Headfirst book (Chapter 4. Page:196)

1) can you please explain the bean things that can be done during ejbCreate(). For example, will ejbCreate() method have a transaction in CMT. If it doesnt have a transaction, then how is able to access another bean's reference and resource manager.
I will also join. I too have this book.
This is the error message i get while compiling.

Dog2.java:14: unreported exception java.lang.Exception; must be caught or declar
ed to be thrown
a.eat();
^
1 error

Thank you,
Srini
Hi,
The valid override says that the overriding method can throw fewer or no exception. However,the below is giving compiler error. As the eat() method is overridden in subclass,then the subclass version of the eat() should be called when we invoke a.eat().

class Animal
{
public void eat() throws Exception {
}
}

class Dog2 extends Animal
{
public void eat() {}
public static void main(String arg[]) {
Animal a=new Dog2();
Dog2 d=new Dog2();
d.eat();
a.eat(); //This line gives compilation error
}
}

Thank you,
Srini
I am trying to understand the lexical structure of JLS(3rd edition). I would like to know how,where,when the unicode representation is used in Java. Also if possible please direct me to some resources in the net.
16 years ago
I am trying to understand the lexical structure of JLS(3rd edition). I would like to know how,where,when the unicode representation is used in Java. Also if possible please direct me to some resources in the net.

Thank you,
Srini
Hi,
I am using weblogic 8.1 server. My web application is deployed as WAR file.When jsp is executing,jsp is converted into .java file which in turn compiled into .jsp file.
The jsp working directory is specified in weblogic.xml.
So whenever i request for a jsp file,it is either takes a compiled class file or compile .jsp to java and then into class and then it will executed.

As per my understanding,the jsp files are complied into jsp working directory. So whenever we request,the container will instantiate the class from jsp working directory(which is not part of WAR). If jsp working directory is part of WAR file,then when will the jsp file gets compiled?.

So if jsp working directory is part of WAR file,then it has to be compiled before making the WAR. If it needs to be compiled before making WAR,then how can we compile the jsp file?

Thanks in advance

Srini
16 years ago
JSP
Hi,

I understand the following three things from the discussion.
1.A static method and regular method can run concurrently and can access the same static variable on the class.So the static variable is not thread-safe.
2.For regular synchronized method,the lock will be obtained for the object on which the method is invoked.
3.For static synchronized method,the lock will be obtained for the java.lang.Class's object.It means that another static synchronized method cannot execute during.

If we use the synchonized keyword as below
void regularMethod() {
synchronized(One.class) {
}
}
What kind of lock will be obtained for the above synchronized block.What is the significance of the giving One.class.Does it mean a class level lock as the static synchronized method acquire even though this method is invoked using the object instance.


Also i couldnt understand Mr. C Lamont Gilbert's reply which is pasted below.

"You can see in class Three why I recommend never using 'this' or 'ClassName.class' as the lock object. You have exposed the 'key' to everyone holding the instance, and in case of the static method its even worse. The static monitor is accessible to any class that can see the classloader which for a typical application is every class in existence."

Could you please elaborate on this?

Thanks in advance..

Thanks
Srini
Hi,

If we specify a synchronized keyword for a method,then the lock for that object is grabbed and the operation is done.But how does synchronization works for static method?

Thanks in advance.

Thanks
Srini
Thanks for all.

This is my full requirement.

This is for java process(console based application).My requirement is to create a database manager
which actually creates the database connection and closes it. This is the only entry point for creating
and closing the connection.At any point of time,i should have only one instance of my manager class.

My class will have variables on which the database manager will work.

So,if i am right,singleton class would be the ideal candidate for this pattern.Also if the singleton class is candidate,
my database manager should not get garbage collected until my application goes away.

1.Could you please tell me which pattern to use for my manager class?

Earlier,i have static variables and static methods(which operates on the static variable) for database manager.
The static methods in the class will perform utility works like Math.abs(),Math.cos() etc. which will work independent
of the variables in the class(otherwise operate only with the arguments passed).

2.So if this is the case,when will the static variables be used?
16 years ago
Hi,

I would like to know when Singleton class get garbage collected.If i release any of the reference to the Singleton object(the static object which i have declared),will it get garbage collected as soon.

Thanks in advance!!!

Thanks
Srini
16 years ago