DATAGRAPH-1223 - Deprecate SessionFactoryUtils#closeSession.
This commit is contained in:
@@ -248,10 +248,8 @@ public class Neo4jTransactionManager extends AbstractPlatformTransactionManager
|
||||
} catch (Throwable ex) {
|
||||
logger.debug("Could not rollback Session after failed transaction begin", ex);
|
||||
} finally {
|
||||
// close session.
|
||||
SessionFactoryUtils.closeSession(session);
|
||||
txObject.setSessionHolder(null, false);
|
||||
}
|
||||
txObject.setSessionHolder(null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,8 +363,6 @@ public class Neo4jTransactionManager extends AbstractPlatformTransactionManager
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Closing Neo4j Session [" + session + "] after transaction");
|
||||
}
|
||||
// close session.
|
||||
SessionFactoryUtils.closeSession(session);
|
||||
} else {
|
||||
logger.debug("Not closing pre-bound Neo4j Session after transaction");
|
||||
}
|
||||
|
||||
@@ -58,6 +58,11 @@ public class SessionFactoryUtils {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SessionFactoryUtils.class);
|
||||
|
||||
/**
|
||||
* @deprecated since 5.2, this has been a Noop since 4.2 and has no meaning since then. It will be removed in the next major version.
|
||||
* @param session
|
||||
*/
|
||||
@Deprecated
|
||||
public static void closeSession(Session session) {}
|
||||
|
||||
public static Session getSession(SessionFactory sessionFactory) throws IllegalStateException {
|
||||
|
||||
@@ -126,20 +126,15 @@ public class SharedSessionCreator {
|
||||
}
|
||||
|
||||
// Regular Session operations.
|
||||
boolean isNewSession = false;
|
||||
if (targetSession == null) {
|
||||
logger.debug("Creating new Session for shared Session invocation");
|
||||
targetSession = this.sessionFactory.openSession();
|
||||
isNewSession = true;
|
||||
}
|
||||
|
||||
// Invoke method on current Session.
|
||||
try {
|
||||
return methodCall.apply(targetSession);
|
||||
} finally {
|
||||
if (isNewSession) {
|
||||
SessionFactoryUtils.closeSession(targetSession);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,8 +79,6 @@ class AsyncRequestInterceptor implements CallableProcessingInterceptor, Deferred
|
||||
private void closeAfterTimeout() {
|
||||
if (this.timeoutInProgress) {
|
||||
logger.debug("Closing Neo4j OGM Session after async request timeout");
|
||||
// close session.
|
||||
// SessionFactoryUtils.closeSession(session);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,8 +135,6 @@ public class OpenSessionInViewFilter extends OncePerRequestFilter {
|
||||
TransactionSynchronizationManager.unbindResource(sessionFactory);
|
||||
if (!isAsyncStarted(request)) {
|
||||
logger.debug("Closed Neo4J OGM Session in OpenSessionInViewFilter");
|
||||
// close session.
|
||||
// SessionFactoryUtils.closeSession(session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +130,6 @@ public class OpenSessionInViewInterceptor implements BeanFactoryAware, AsyncWebR
|
||||
if (!decrementParticipateCount(request)) {
|
||||
TransactionSynchronizationManager.unbindResource(getSessionFactory());
|
||||
logger.debug("Closed Neo4j OGM Session in OpenSessionInViewInterceptor");
|
||||
// close session.
|
||||
// SessionFactoryUtils.closeSession(session);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user