Moving LRTS handling into a Connection Preparer#1596
Moving LRTS handling into a Connection Preparer#1596rma-rripken wants to merge 8 commits intodevelopfrom
Conversation
…se. The integration tests test this code more extensively
| final String officeId = ctx.attribute(ApiServlet.OFFICE_ID); | ||
|
|
||
| final DataSource dataSource = ctx.attribute(ApiServlet.DATA_SOURCE); | ||
| final Boolean isNewLRTS = ctx.header(ApiServlet.IS_NEW_LRTS) == null |
There was a problem hiding this comment.
null should really be false for now
There was a problem hiding this comment.
ok. I made null be false.
| } | ||
|
|
||
|
|
||
| private static class CloseUnsettingHandler implements InvocationHandler { |
There was a problem hiding this comment.
I don't think we should be unsetting. it should always be explicitly true or false. That way we aren't letting the database decide what the default behavior of CDA is.
There was a problem hiding this comment.
Ok. I put the unsetting bit behind a flag and default to false.
| // Convert to SQLException contract if the call fails | ||
| SQLException sqlEx = new SQLException("Failed setting LRTS session flag", ex); | ||
| try { | ||
| connection.close(); |
There was a problem hiding this comment.
We shouldn't close the connection, the calling API should handle that.
There was a problem hiding this comment.
Took out the close class.
Removed connection close call. Made connection preparer not unset the session by default.
… for every IT method.
| public void cleanupLocationCategories() throws Exception { | ||
| if (this.categoriesCreated.isEmpty()) { | ||
| logger.atInfo().log("No location categories to cleanup."); | ||
| logger.atFine().log("No location categories to cleanup."); |
|
I believe the office id context and this LRTS context is designed with the understanding that the session state would be cleared when the connection is returned to the pool. Since that seem to not be the case, I think the real solution would be to add something like: either as the first connection preparer or on connection return. |
This handles the LRTS flag in a way that unsets the flag in the session when the connection is closed.