Surender Suri

Ranch Hand
+ Follow
since May 28, 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
1
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 Surender Suri

Thanks Martin,

I have looked at the code and it seems to be fine. Since it's using a connection object from pool, it is returning properly in the finally block.

After debugging more, i think i may have found where exactly it is happening.. but still can't figure out why .. basically there two prepared statement updates happening with in a transaction and it seems to be blocking while commit on connection object is called.

Both the updates are happening on two different tables, but are linked by foreign key. Also, this part of the code is executed all the time ... so not sure what is happening.

any idea?



Another very very strange thing, admin guys reported was .. earlier they used to take only thread dumps.. but since last week i have asked them to take heap dumps as well .. so earlier when the locking is happening .. they had to manually kill the spid to bring back the application to normal .. now since they started taking the heap dumps .. when ever they take heap dump.. the locking seems to go away by itself

We have been monitoring the logs for a while now and didn't had any luck with them so far. As far as upgrading the dbcp version, I need to prove that's what causing the issue before I can upgrade .. since it's a production. I guess I can try to simulate the issue with old and new versions in test env. if that can be simulated ..

We are not using any ORM .. it's standard JDBC.

Thanks,

Chris / Martin

Can you give some pointers .. where should I start looking ?

If two threads are sharing the same connection object, then isn't it some issue with the connection pooling ?

Thanks,

Hello,

We are seeing blocking threads quite often in our application , not able to identify what is causing the issue .. any help is appreciated. Below is the stack trace of the thread that is starting the blocking. we can see the locking on ms sql server and killing the spid to bring back the application to normal ..

is it with the connection pooling ? or sql driver ? or is it with the java version .. since it's actually happening at the socket level ?



Additional Info:

java 1.6.0.33 build
tomcat 7
dbcp 1.2.1 - connection pool
MS SQL server

Thanks
Hello,

I am not sure if this is the right section to ask this question. Anyway it is related partly with multi-threading.

We have a web application running on tomcat, using dbcp (1.2) for connection pooling. Our application is heavely multi-threaded and is working fine with no issues, but recently we added a new flow where we are using similar multi threading as in rest of our app and we started seeing below issue consistently.. It does not happen if the new request runs in single thread..

com.app.iqe.utils.ExceptionAdapterException: org.postgresql.util.PSQLException: This ResultSet is closed.
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkClosed(AbstractJdbc2ResultSet.java:2654)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.next(AbstractJdbc2ResultSet.java:1786)
at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:168)
at com.app.iqe.persistence.PersistentManager.processQuery(PersistentManager.java:862)

com.app.iqe.utils.ExceptionAdapterException: org.postgresql.util.PSQLException: This statement has been closed.
at org.postgresql.jdbc2.AbstractJdbc2Statement.checkClosed(AbstractJdbc2Statement.java:2512)
at org.postgresql.jdbc2.AbstractJdbc2Statement.getMaxRows(AbstractJdbc2Statement.java:607)
at org.postgresql.jdbc3.Jdbc3Statement.createResultSet(Jdbc3Statement.java:36)
at org.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHandler.handleResultRows(AbstractJdbc2Statement.java:211)
at org.postgresql.core.v3.QueryExecutorImpl$1.handleResultRows(QueryExecutorImpl.java:437)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1796)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
at com.app.iqe.persistence.PersistentManager.processQuery(PersistentManager.java:846)

Below is the sample code of processQuery method.



Nothing is changed with respect to configuration ect.. the rest of the app and flows works fine. I tried with updating the dbcp jar with latest version, but no effect.

Any idea's on what might be causing the issue? is it multi-threading or connection pooling related ?

Thanks,
Suri
Thanks Jeff.

After using the CountDownLatch, it is working as expected atleast with the initial test with no null exceptions. Is this the correct way to use CountDownLatch. Also, i see their is one more way to do this by using Semaphore, with the release() and acquire() , what is the difference between them ..

Secondly i don't understand how the Semaphore works at all , i mean where is the link which holds the threads to wait .. it say's it's just a counter adding the permits when release() is called



Thanks in advance.
Hi,

I am trying to learn multi-threading, as part of that i am trying to implement thread pool. In below main method i am passing runnable object to pool.execute() method to run that in a separate thread from pool , now how do i wait till all the threads are completed to start processing the result.


hope they don't appear on exam though :-) .. anyway thanks bert for the amazing book
Do these type of questions really appear on real exam ? this question is from K&B mock exam.. i have seen couple of then in K&B mocks and i did wrong most of the time :-( .. i don't know what they are trying to test here .. my observation skills ? it's more like an eye test :-)

since most of you are certified .. did any one seen these type of question in real exam ?



What is the result?
A. 1 1 1
B. 2 0 1
C. 2 0 2
D. 2 2 2
E. Compilation fails.
F. An exception is thrown at runtime.

E is correct. We had to throw at least one of these in here, sorry. The reverse() and sort() methods are in the Collections class, not the Collection class—ouch. Again, look for this kind of misdirection in the real exam! If the invocations had been Collections.reverse(desk) and Collections.sort(desk), the result would have been 2 0 1—remember, indexes are zero-based.
Hello Ranchers,

Need your suggestion on selecting the web framework and java based CMS. We have an existing java based web application, the front-end is a total mess .. using mvc 1 (basically no framework used) .. everything is in jsp. Now we are trying to enhance the web part and there are few things i need your suggestion on

1> Multiple url's(lets say a url for each affiliate in the company) pointing to same web application should be served different home pages ( will have different layouts customized for each affiliate )... can have different web flows. The core application will be same for all .. how to have a different webflow for each affiliate ?

2> each affiliate will have their own content .. is there any CMS which will support different content repository for each affiliate ? can the dynamic customizable home page be served from this CMS ?

3> should support different style sheets and languages

i know there are lot of dynamic things here :-) .. i see that spring has lot of these capabilities but i am not sure of CMS and how it will if any will be integrated ..

Thanks
11 years ago
Can you try with "text/xml" instead of "application/x-www-form-urlencoded" in below line.



Also, here is a nice article on these issue. Hope it helps : RESTful HTTP in practice
11 years ago
Not video, but here is the step by step web service tutorial using axis 2 Web services using Apache Axis 2
11 years ago
got it .. Boast(eye) calls the default no-arg constructor of Devil class .. i was thinking it will call Devil(eye) .. but that would require a explicit call to super(eye) ... humm.. what was i thinking :-) thanks gurpeet

this is what happens when you drink beer and take test :-)
Thanks gurpeet. One more Q.

how is the answer 1 here ? it should be "devil boast devil boast" right ? or i am missing something ..



1.) devil boast devil devil boast - Answer

2.) devil boast devil boast devil boast devil boast

3.) devil boast devil devil boast devil boast

4.) Runtime error

5.) None of the above