persistence@glassfish.java.net

Re: Code review for: [Issue 1107] Logger defined by a property doesn't work]

From: Wonseok Kim <guruwons_at_gmail.com>
Date: Fri, 13 Oct 2006 02:54:58 +0900

Tom,
Please see below comments...

On 10/13/06, Tom Ware <tom.ware_at_oracle.com> wrote:
>
> Marina and Wonsoek,
>
> >
> > 4. (To Tom) This is another concern but related to #3. What is the
> > behaviour of session name property? If I specify the same session name
> > of two applications or two persistence units, could I share
> > ServerSession? But it doesn't seem to do it, because in
> > EntityManagerSetupImpl.predeploy() session is always newly created
> > like below regardless of the session name.
> >
> > session = new ServerSession(...);
> >
> > If session name property has no effect in JPA, I think it should be
> > removed and then there will be no confusion in #3.
>
> Session name is used to store the session we use on the SessionManager.
> We expect the session name to be unique. If it is not, an exception
> will be thrown when the session is added to the SessionManager. Take a
> look at the addSessionToGlobalSessionManager() method.
>
>
If a session name is specified by property, current code will set it in
updateSessionName(). But as you see below, it calls
removeSessionFromGlobalSessionManager(), therefore non-unique session name
doesn't appear to throw an exception in addSessionToGlobalSessionManager().

    protected void updateSessionName(Map m) {
        String newName = getConfigPropertyAsStringLogDebug(
TopLinkProperties.SESSION_NAME, m, session);
        if(newName == null || newName.equals(session.getName())) {
            return;
        }

        removeSessionFromGlobalSessionManager();
        session.setName(newName);
        addSessionToGlobalSessionManager();
    }

Frankly I would like to know what we could get with explicitly-specified
session name? I couldn't find any usage of the session name except for
logger hierachy. ServerSessions don't seem to be shared. I found some
internal code with regard to session name, but actually they don't do
special things with this(such as DatabaseQuery.sessionName). Could you
elaborate on this?

Regards
- Wonseok