Viji Venkatraman

Greenhorn
+ Follow
since Jul 08, 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 Viji Venkatraman

Hi

This is what I have been trying to do:

My aim is to generate a 3D kind of grid. Here the horizontal rows are equally spaced whereas the vertical lines will be at some angle to the horizontal so that the appearance is like some 3D floor. (I have pasted my code below)


Other data:
I have is finite(pre-defined) number of rows and columns.
The points x1,y1 and x2,y2 denote the bottom-most horizontal line.
The angle the left-most vertical line makes with the x-axis is theta and is assumed to be 60 degrees.
The length of the top-most horizontal line is 1/4th the length of the bottom-most horizontal line.

Using the above data/assumptions and based on proportionality theorem and some straight line formula I have generated this pattern.

My next work is to determine the intersection points for each row and column. For this I have done the following:

- I determined the perpendicular distance between each row and say this is some 'd'.
- Let the first point in the first row be some (x,y)
- Now the actual distance(non-perpendicular) between 2 rows can be deduced based on each column angle (say some theta)
- So the actual distance 'radius' will be = d/Sin(theta)
- Then I used the polar form of line equation to get the actual x,y co-ordinates as '(x+radius*Cos(theta), y-radius*Sin(theta))'

I suppose the method of determination is mathematically correct. But for the sake of verification, when I connected the intersection points and the origin,I find them to be non-accurate. There seems to be some error. Can somebody please help out on this??

P.S: Please try running the code pasted below to see what happens.(check out the method findPoints())

12 years ago
Hi Rahul

This happens every time i start the application.
Hi

My application uses hibernate for persistence and c3p0 as connection pool. The following is the configuration I have:

<property name="hibernate.c3p0.min_size">6</property>
<property name="hibernate.c3p0.max_size">35</property>
<property name="nontransaction.connection">15</property>
<property name="hibernate.connection.autocommit">true</property>

My connection pool size is low and I am not working under high load. I see the following exception:

org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at com.adventnet.management.transaction.TransactionAPI.beginHbnTxn(TransactionAPI.java:923)
at com.adventnet.management.transaction.TransactionAPI.beginTxn(TransactionAPI.java:856)
at com.adventnet.management.transaction.TransactionAPI.begin(TransactionAPI.java:314)
at com.adventnet.nms.store.relational.RelationalObject.beginTxn(RelationalObject.java:2298)
at com.adventnet.nms.store.relational.RelationalObject.init(RelationalObject.java:208)
at com.adventnet.nms.store.relational.RelationalPolicyObject.init(RelationalPolicyObject.java:39)
at com.adventnet.nms.store.relational.CommonPolicyToRelational.initForClass(CommonPolicyToRelational.java:145)
at com.adventnet.nms.store.relational.CommonPolicyToRelational.<init>(CommonPolicyToRelational.java:76)
at com.adventnet.management.policydb.CommonPolicyAPI.setPersistenceAPI(CommonPolicyAPI.java:63)
at com.adventnet.management.policydb.CommonPolicyAPI.<init>(CommonPolicyAPI.java:43)
at com.adventnet.management.policydb.NmsPolicyMgr.initialize(NmsPolicyMgr.java:115)
at com.adventnet.management.policydb.NmsPolicyMgr.callMain(NmsPolicyMgr.java:99)
at com.adventnet.nms.util.RunProcessSmall.runCommand(RunProcessSmall.java:97)
at com.adventnet.nms.util.RunCmd.run(RunCmd.java:100)
Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:527)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:56)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
... 18 more
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@869113 -- timeout at awaitAvailable()
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1317)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)


When I did some debugging from my side, I figured out that the number of non-transaction connections taken from the connection pool are 10 and non transaction connections are 3. At this point this issue occurs and also if I increase the connection pool size to 45, this issue no longer occurs.

What could be the reason? Is there a way to enable some fine level of debugging in c3p0 ( using log4j).
Hi Karthik

Firstly,let me appreciate you for your in-depth analysis of this Java Webstart problem on creating an explicit SocketFactory. This has typically helped in solving a similar issue which was raised by one of our customers. However, I would like some clarifications on the below points:

1. I presume, both ClientSocketFactory and ServerSocketFactory will be created in the server side only.But the when I export an object using these socket factories and I try to obtain a handle for the same from the client side , inturn the ClientSocketFactory which is created in the server side creates a socket which is used for RMI communication with the server. But the missing point is how does this happen? How does the client know that this particular remote object has a SocketFactory associated with it? I have not been able to deduce this part .

2. Have you done some kind of testing to ensure that if objects are exported using socket factories , one can do a Naming.lookup on the object from Java Webstart client connected to the server in https mode via proxy? If yes, can you please elaborate a little more on your findings.

Hoping to receive a quick reply.

Thanks in Advance.

Vg
13 years ago