Skip to content

Moving LRTS handling into a Connection Preparer#1596

Open
rma-rripken wants to merge 8 commits intodevelopfrom
bugfix/lrts_left_on
Open

Moving LRTS handling into a Connection Preparer#1596
rma-rripken wants to merge 8 commits intodevelopfrom
bugfix/lrts_left_on

Conversation

@rma-rripken
Copy link
Collaborator

@rma-rripken rma-rripken commented Feb 19, 2026

This handles the LRTS flag in a way that unsets the flag in the session when the connection is closed.

@rma-rripken rma-rripken changed the title Trying to resolve failing test Moving LRTS handling into a Connection Preparer Feb 20, 2026
@rma-rripken rma-rripken requested a review from zack-rma February 20, 2026 00:49
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null should really be false for now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. I made null be false.

}


private static class CloseUnsettingHandler implements InvocationHandler {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't close the connection, the calling API should handle that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took out the close class.

Removed connection close call.
Made connection preparer not unset the session by default.
@rma-rripken rma-rripken marked this pull request as ready for review February 24, 2026 18:37
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.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good change.

@adamkorynta
Copy link
Collaborator

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:

BEGIN
  DBMS_SESSION.CLEAR_ALL_CONTEXT;
  DBMS_SESSION.RESET_PACKAGE;
END;

either as the first connection preparer or on connection return.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants