Within our Java Application we're using a connection pool. Whenever we take a connection out of the pool we set the desired workspace and/or savepoint/date for the upcoming transaction.
The used underlying session will stay in that workspace, also after connection return to the pool.
We are wondering whether it is in general advidsable to "reset" the session during putting back the connection into the pool by issueing a gotoWorkspace('LIVE')?
On one hand there is certain functionality that cannot be executed when any session is in a workspace, but maybe it might also be bad for performance reasons?
When using a connection pool, you need to execute GotoWorkspace when you first acquire a session as you mentioned since you can't rely on the session being in a particular workspace. GotoWorkspace is a very fast procedure as it is simply setting context, so it should not adversely impact performance. As a result, whether or not you reset the workspace to a specific workspace is up to you. One thing to note is that the session will hold on to whatever workspace locks it currently holds. This could prevent other sessions from obtaining the same lock in certain situations. To avoid this, you would either want to be sure the workspace is in LIVE or some other unused workspace.