There is a configuration on the Connection
Pool in Glassfish that allows you to associated the connection to the current
thread of execution. This will allow for the connection to be reused when
it is requested. Take a look at the ConnectionPool and check this option.
Chris Mathrusse
Reinhard Girstenbrei a écrit :
>
> the fact that each query obtains it's own connection is intended
> behavior. This does guarantee that the application holds on a
> connection for the minimum amount of time and therefore it allows
the
> most efficient use of precious physical connection resources. For
sure
> you can get a ClientSession that obtains a connection and keeps it.
> You can also obtain an exlusive connection for read and write
> operations and keep it. But maybe the best solution is to use the
> connections lazily, the way you have observed EclipseLink to work.
>
>
Thank you for this information. But I still think something is wrong
and your advice could help me a lot.
If there is a new connection for each db request, even if one single
query generates a lot of requests, I guess they won't use the same
transaction? I would like to have all request in a transaction.
The EclipseLink queries are running in ejb session bean methods. I am
trying to get the transaction (UnitOfWork) which should be associated
with the injected EntityManager. Can I do this?
Here are some stats from glassfish jdbc pool monitoring:
Resource Statistics (14) Name
Value
Details
Description
NumConnSuccessfullyMatched
0 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Number of Connections successfully
matched
NumConnUsed
0 Count
High Water Mark: 12 Count
Low Water Mark: 0 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides Connection usage statistics.
In addition to number of connections being used currently, this also
provides information about the Maximum number of connections that were
used(High Watermark).
WaitQueueLength
0 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a count value indicating the
number of connection requests in the queue waiting to be servied.
NumConnDestroyed
10 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a count value reflecting the
number of connections that were destroyed since the last sampling
ConnRequestWaitTime
0 milliseconds
High Water Mark: 16303 milliseconds
Low Water Mark: 0 milliseconds
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a range value that indicates
the longest, shortest wait times of connection requests since the last
sampling. The current value indicates the wait time of the last request
that was serviced by the pool.
NumConnFailedValidation
0 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a count value reflecting the
number of connections in the connection pool that failed validation
since the start time till the last sample time.
NumConnReleased
495643 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a count value reflecting the
number of connections released back to the pool since the last sampling
NumConnFree
8 Count
High Water Mark: 12 Count
Low Water Mark: 0 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a count value reflecting the
number of connections in the connection pool that are free as of the
last sampling
NumPotentialConnLeak
0 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a count value reflecting the
number of potential connection leaks
AverageConnWaitTime
0 milliseconds
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Average wait time-duration per
successful connection request
NumConnTimedOut
0 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a count value reflecting the
number of connections in the connection pool that timed out since the
start time till the last sample time.
NumConnCreated
18 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a count value reflecting the
number of connections that were created by the pool since the last
sampling.
NumConnAcquired
495643 Count
Last Sample Time: 26 juin 2009 14:38:49
Start Time: 26 juin 2009 11:43:10
Provides a count value reflecting the
number of connections acquired from the pool since the last sampling
NumConnNotSuccessfullyMatched
0 Count
Last Sample Time: 26
juin 2009
14:38:49
Start Time: 26 juin 2009 11:43:10
Number of Connections rejected during
matching
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users