(From Kwang Ho-Lee's investigations)
When using a Grails service that is transactional (default) and it uses the DB, the service will try and get a connection to the DB from the pool each time it is called.
So it is a bad idea to have code in a controller that calls a service in a loop. The loop should really be in the service, this will prevent multiple connections being made, plus it makes better design sense.
Code Snippets, Ideas and Rants from a Tech Lead interested primarily in server side web development and leading teams who build web apps.
Monday, October 18, 2010
Wednesday, October 13, 2010
Time durations
Some code that shows durations and works nicely as a timer
import groovy.time.* def timeStart = new Date() // Some code you want to time def timeStop = new Date() TimeDuration duration = TimeCategory.minus(timeStop, timeStart) println durationThis will give you the time in hours, minutes, seconds
Subscribe to:
Posts (Atom)