/** * Clear customizer if it's active and set it to null. * Called by the same object that has created customizer (DatabaseSession, ConnectionPool) when * the latter is no longer required, typically before releasing the accessor. * Ignored if there's no customizer. */ public void releaseCustomizer() { if(customizer != null) { if(customizer.isActive()) { customizer.clear(); } customizer = null; } }
/** * Clear customizer if it's active and set it to null. * Called by the same object that has created customizer (DatabaseSession, ConnectionPool) when * the latter is no longer required, typically before releasing the accessor. * Ignored if there's no customizer. */ public void releaseCustomizer() { if(customizer != null) { if(customizer.isActive()) { customizer.clear(); } customizer = null; } }
/** * Clear customizer if it's active and set it to null. * Called by the same object that has created customizer (DatabaseSession, ConnectionPool) when * the latter is no longer required, typically before releasing the accessor. * Ignored if there's no customizer. */ public void releaseCustomizer() { if(customizer != null) { if(customizer.isActive()) { customizer.clear(); } customizer = null; } }
/** * Close the accessor's connection. * This is used only for external connection pooling * when it is intended for the connection to be reconnected in the future. */ public void closeConnection() { try { if (this.datasourceConnection != null) { if (isDatasourceConnected()) { if(currentSession != null) { currentSession.preDisconnectExternalConnection(this); } if(customizer != null && customizer.isActive()) { customizer.clear(); } closeDatasourceConnection(); } this.datasourceConnection = null; } } catch (DatabaseException exception) { // Ignore this.datasourceConnection = null; } finally { currentSession = null; } }
/** * Close the accessor's connection. * This is used only for external connection pooling * when it is intended for the connection to be reconnected in the future. */ public void closeConnection() { try { if (this.datasourceConnection != null) { if (isDatasourceConnected()) { if(currentSession != null) { currentSession.preReleaseConnection(this); } if(customizer != null && customizer.isActive()) { customizer.clear(); } closeDatasourceConnection(); } this.datasourceConnection = null; } } catch (DatabaseException exception) { // Ignore this.datasourceConnection = null; } finally { currentSession = null; } }
/** * Close the accessor's connection. * This is used only for external connection pooling * when it is intended for the connection to be reconnected in the future. */ public void closeConnection() { try { if (this.datasourceConnection != null) { if (isDatasourceConnected()) { if(currentSession != null) { currentSession.preReleaseConnection(this); } if(customizer != null && customizer.isActive()) { customizer.clear(); } closeDatasourceConnection(); } this.datasourceConnection = null; } } catch (DatabaseException exception) { // Ignore this.datasourceConnection = null; } finally { currentSession = null; } }
/** * This method is called by reestablishConnection. * Nothing needs to be done in case customize is not active (customization hasn't been applied yet). * to repair existing customizer after connection became invalid. * However if connection has been customized then * if connection is still there and deemed to be valid - clear customization. * Otherwise (or if clear fails) remove customizer and set its prevCustomizer as a new customizer, * then re-create customizer using the same session as the original one. */ protected void reestablishCustomizer() { if(customizer != null && customizer.isActive()) { if(isValid()) { // the method eats SQLException in case of a failure. customizer.clear(); } else { // It's an invalid connection - don't bother trying to clear customization. AbstractSession customizerSession = (AbstractSession)customizer.getSession(); // need this so that the new customizer has the same prevCustomizer as the old one. customizer = customizer.getPrevCustomizer(); // customizer recreated - it's the same as the original one, but not active. createCustomizer(customizerSession); } } }
/** * Clear and remove customizer if its session is the same as the passed one; * in case prevCustomizer exists set it as a new customizer. * Called when ClientSession releases write accessor: * if the customizer was created by the ClientSession it's removed, and * the previous customizer (that ConnectionPool had set) is brought back; * otherwise the customizer (created by ConnectionPool) is kept. * Ignored if there's no customizer. */ public void releaseCustomizer(AbstractSession session) { if(customizer != null) { if(customizer.getSession() == session) { if(customizer.isActive()) { customizer.clear(); } if(customizer.getPrevCustomizer() == null) { customizer = null; } else { setCustomizer(customizer.getPrevCustomizer()); } } } }
/** * Clear and remove customizer if its session is the same as the passed one; * in case prevCustomizer exists set it as a new customizer. * Called when ClientSession releases write accessor: * if the customizer was created by the ClientSession it's removed, and * the previous customizer (that ConnectionPool had set) is brought back; * otherwise the customizer (created by ConnectionPool) is kept. * Ignored if there's no customizer. */ public void releaseCustomizer(AbstractSession session) { if(customizer != null) { if(customizer.getSession() == session) { if(customizer.isActive()) { customizer.clear(); } if(customizer.getPrevCustomizer() == null) { customizer = null; } else { setCustomizer(customizer.getPrevCustomizer()); } } } }
/** * This method is called by reestablishConnection. * Nothing needs to be done in case customize is not active (customization hasn't been applied yet). * to repair existing customizer after connection became invalid. * However if connection has been customized then * if connection is still there and deemed to be valid - clear customization. * Otherwise (or if clear fails) remove customizer and set its prevCustomizer as a new customizer, * then re-create customizer using the same session as the original one. */ protected void reestablishCustomizer() { if(customizer != null && customizer.isActive()) { if(isValid()) { // the method eats SQLException in case of a failure. customizer.clear(); } else { // It's an invalid connection - don't bother trying to clear customization. AbstractSession customizerSession = (AbstractSession)customizer.getSession(); // need this so that the new customizer has the same prevCustomizer as the old one. customizer = customizer.getPrevCustomizer(); // customizer recreated - it's the same as the original one, but not active. createCustomizer(customizerSession); } } }
/** * Clear and remove customizer if its session is the same as the passed one; * in case prevCustomizer exists set it as a new customizer. * Called when ClientSession releases write accessor: * if the customizer was created by the ClientSession it's removed, and * the previous customizer (that ConnectionPool had set) is brought back; * otherwise the customizer (created by ConnectionPool) is kept. * Ignored if there's no customizer. */ public void releaseCustomizer(AbstractSession session) { if(customizer != null) { if(customizer.getSession() == session) { if(customizer.isActive()) { customizer.clear(); } if(customizer.getPrevCustomizer() == null) { customizer = null; } else { setCustomizer(customizer.getPrevCustomizer()); } } } }
/** * This method is called by reestablishConnection. * Nothing needs to be done in case customize is not active (customization hasn't been applied yet). * to repair existing customizer after connection became invalid. * However if connection has been customized then * if connection is still there and deemed to be valid - clear customization. * Otherwise (or if clear fails) remove customizer and set its prevCustomizer as a new customizer, * then re-create customizer using the same session as the original one. */ protected void reestablishCustomizer() { if(customizer != null && customizer.isActive()) { if(isValid()) { // the method eats SQLException in case of a failure. customizer.clear(); } else { // It's an invalid connection - don't bother trying to clear customization. AbstractSession customizerSession = (AbstractSession)customizer.getSession(); // need this so that the new customizer has the same prevCustomizer as the old one. customizer = customizer.getPrevCustomizer(); // customizer recreated - it's the same as the original one, but not active. createCustomizer(customizerSession); } } } }