Skip to content

Commit

Permalink
HHH-13916 : Add a unique Session "token"
Browse files Browse the repository at this point in the history
  • Loading branch information
gbadner authored and sebersole committed Apr 21, 2020
1 parent 7bca059 commit 903bb29
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Expand Up @@ -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
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 903bb29

Please sign in to comment.