mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-03-04 08:49:22 +00:00
HHH-13916 : Add a unique Session "token"
This commit is contained in:
parent
7bca059f94
commit
903bb292e7
@ -118,6 +118,15 @@ default SharedSessionContractImplementor getSession() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A "token" that is unique to this Session.
|
||||
*
|
||||
* @return The token
|
||||
*/
|
||||
default Object getSessionToken() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the session is closed. Provided separately from
|
||||
* {@link #isOpen()} as this method does not attempt any JTA synchronization
|
||||
|
@ -105,6 +105,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||
private final String tenantIdentifier;
|
||||
protected transient FastSessionServices fastSessionServices;
|
||||
private UUID sessionIdentifier;
|
||||
private Object sessionToken;
|
||||
|
||||
private transient JdbcConnectionAccess jdbcConnectionAccess;
|
||||
private transient JdbcSessionContext jdbcSessionContext;
|
||||
@ -277,6 +278,14 @@ public UUID getSessionIdentifier() {
|
||||
return sessionIdentifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSessionToken() {
|
||||
if ( sessionToken == null ) {
|
||||
sessionToken = new Object();
|
||||
}
|
||||
return sessionToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenantIdentifier() {
|
||||
return tenantIdentifier;
|
||||
|
Loading…
x
Reference in New Issue
Block a user