开发者

eclipselink jpa 2.0 with j2se swing application freezing

how to configure eclipselink to use it inside swing application to connect to a database sever directly inside workgroup environment . i am currently using this but my application is freezing after some transactions (after 20-30 transaction ) . my persistence.xml is ,

<property name="javax.persistence.jdbc.url" value="jdbc:mysql://192.0.0.1:3306/myhotel"/>
      <property name="javax.persistence.jdbc.password" value="123"/>
      <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
      <property name="javax.persistence.jdbc.user" value="root"/>

i went through thread dump it shows..

SwingWorker-pool-1-thread-10" daemon prio=6 tid=0x03143400 nid=0xbec in Object.wait() [0x052ff000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at org.eclipse.persistence.sessions.server.ConnectionPool.acquireConnection(ConnectionPool.java:102)
    - locked <0x27d6d7e0> (a org.eclipse.persistence.sessions.server.ConnectionPool)
    at org.eclipse.persistence.sessions.server.ServerSession.allocateReadConnection(ServerSession.java:477)
    at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:525)
    at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:205)
    at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:191)
.....................

also awt thread even became wai开发者_运维知识库nting state

"AWT-EventQueue-0" prio=6 tid=0x02c6d400 nid=0xfcc in Object.wait() [0x033ae000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at org.eclipse.persistence.sessions.server.ConnectionPool.acquireConnection(ConnectionPool.java:102)

please some body help me !!!


The default connection pool size is 32 connections. If you have > 32 active transactions, then the next request will wait until a connection is released. Are you calling close() on your EntityManager and commit() or rollback() on your transaction?

Include you full persistence.xml.

You can also configure the connection pool wait time to trigger an exception if the pool size is exceeded,

"eclipselink.jdbc.connections.wait-timeout" or "eclipselink.connection-pool.default.wait" (in 2.2)

or increase the size of the pool,

"eclipselink.jdbc.connections.max" or "eclipselink.connection-pool.default.max" (in 2.2)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜