Gireesh Giri

Greenhorn
+ Follow
since Apr 23, 2010
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 Gireesh Giri

Hi Jayesh,
I am using jndi (JNDILookup.getObject("DATASOURCE_JNDI_NAME")) connection pooling not spring jdbc templates or jpa.

Just picking the connection from pool, and closing once my DB operation is done (connection.close()).
10 years ago
Hi Jayesh,

Thanks for your replay. My webservice class looks like, Business class method i used synchronized to avoid connection problem

TestService.java
--------------------
{
private Business business;

public Business getbusiness() {
return business;
}

public void setbusiness(Business business) {
this.business= business;
}

business.validateMember() // business is the object wich i created using spring ioc, which is singleton false, below mentined the code snippet.
}

Business Class
--------------------
Business.java
--------------------

{

synchronized validateMember()

{

// java code.

}
}


application-context.xml

-------------------------------------

<bean id="business" class="org.core.Business" singleton="false">

<bean id="testService" class="org.core.TestService" singleton="false">

<property name="business"><ref bean="business"/></property>

</bean>
10 years ago
Hi All,
1. I have implemented a web service with connection pooling(oracle-ds.xml) with JBoss server. In My business class, i am getting connection from pool and performing 4 to 5 DB operations, at last closing connection, statements and result set. It is working fine for one request.
2.If i tried for concurrent requests (Consider 5) only 1 or 2 processed, remaining failed with several reasons like (connection closed, statement closed, unusable connection, result set closed etc).
3.If i keep business class method as "synchronized" it is working fine. But it is serving only one request at a time (for concurrent request also). - This is slow downs my response time.

I came to know, This is connections problem, if one thread is doing DB operation, other thread is closing the connection or statement or result set.

Can any one help and tell me how to handle concurrent requests with out synchronized keyword.

Thanks in Advance.
10 years ago
Thanks Saif Asif. :)
10 years ago
Thanks All for Reply,
My doubt is, any functionality difference between these below two lines of code in java6 other than warning message at first syntax
ArrayList<Integer> al= new ArrayList(); // having generics on declaration not on object creation
ArrayList<Integer> al= new ArrayList<Integer>();

Thanks and Regards,
Gireesh
10 years ago
Hi All,
Have a small doubt in usage of Generics.

ArrayList<Integer> al= new ArrayList();
ArrayList<Integer> al= new ArrayList<Integer>();

Can any one please tell me what is the difference between above two lines of code in detail.

My Observation:
1. In first line of code i can see the warning message (Type safety: The expression of type ArrayList needs unchecked conversion to conform to ArrayList<Integer>) in eclipse.


11 years ago
Hi All,
1. I have implemented a web service with connection pooling(oracle-ds.xml) with JBoss server. In My business class, i am getting connection from pool and performing 4 to 5 DB operations, at last closing connection, statements and result set. It is working fine for one request.
2.If i tried for concurrent requests (Consider 5) only 1 or 2 processed, remaining failed with several reasons like (connection closed, statement closed, unusable connection, result set closed etc).
3.If i keep business class method as "synchronized" it is working fine. But it is serving only one request at a time (for concurrent request also). - This is slow downs my response time.

I came to know, This is connections problem, if one thread is doing DB operation, other thread is closing the connection or statement or result set.

Can any one help and tell me how to handle concurrent requests with out synchronized keyword.

Thanks in Advance.

11 years ago
Thanks Jain it helps me a lot :) .
11 years ago
Hi Jain,
If my understanding is correct. it means, if i am using + operator or conCat method. The new String object which it will get create, is similar to new String("Hello");.
Please correct me if i am wrong.
11 years ago
Hi Jain,
Can you explain me the following two programs out put

1. public class StringTest1 {

public static void main(String[] args) {

String str1= "a";
String str2 = "a";


System.out.println(str1);
System.out.println(str2);

if(str1 == str2)
System.out.println("equal");
else
System.out.println("not equal");


if(str1.equals(str2))
System.out.println("equal");
else
System.out.println("not equal");

}
}

/* out put:
a
a
equal
equal
*/



2.
public class StringTest1 {

public static void main(String[] args) {

String str1= "a";
String str2 = "a";

System.out.println(str1);
System.out.println(str2);

str1 = str1+"b";
str2 = str2+"b";

System.out.println(str1);
System.out.println(str2);

if(str1 == str2)
System.out.println("equal");
else
System.out.println("not equal");


if(str1.equals(str2))
System.out.println("equal");
else
System.out.println("not equal");

}
}

/* out put:
a
a
ab
ab
not equal
equal
*/
11 years ago
Hi All,
Can any one explain, why i am getting the below mentioned output for the following program:

public class StringTest1 {

public static void main(String[] args) {

String str1= "a";
String str2 = str1;

System.out.println(str1);
System.out.println(str2);

str1 = str1+"b";
str2 = str2+"b";

System.out.println(str1);
System.out.println(str2);

if(str1 == str2)
System.out.println("equal");
else
System.out.println("not equal");


if(str1.equals(str2))
System.out.println("equal");
else
System.out.println("not equal");

}
}

/* out put:
a
a
ab
ab
not equal
equal
*/

NOTE: i am expecting not not equal also "equal" as per the String Constant pool mechanism.

Thanks & Regards,
Gireesh

11 years ago
Thanks Winston Gutkowski & Stuart A. Burkett,

Could any one please explain me what it means of "class loading".

I tried [5. Class.forName(String). ] this, it is allocated the memory for my static variables and static block executed successfully (If my understanding is correct ,this it will not create the object, only it load the class).
11 years ago
Hi All,
For static data members, memory will allocate and initialize with default values by JVM, while class loading time. I would like to know what all are the ways i can load a class other than(<class-name> <variable-name> = new <class-name>();) by creating the object.

Thanks in advance.
11 years ago
Thanks Seetharaman Venkatasamy.
But, could you please explain what it means of "compile time constant"
11 years ago
Hi All,
1. I have two java files A.java and B.java (B class referring some public static final variables of A class), i compiled and build jar file.
2. Due to some gap, I replaced a A.class file in existing .jar file. But the changes are not reflecting.
3. If I replaced the jar with A.class and B.class the changes are reflecting.
4. My doubt is is it really required to compile all the dependent java classes. If yes could you please explain why it is?

Thanks in Advance.
11 years ago