Пример #1
0
 public Session getSession()
 {
     session = Session.getSession(this, session);
     if (session == null || !session.isValid())
     {
         lock (this)
         {
             session = Session.getSession(this, session);
             if (session == null || !session.isValid())                     //need re-auth ?
             {
                 session = Auth.login(
                     Bootstrap.getAppRealm(),
                     auth.indexType.moduleInstance, "Application",
                     new Callback[] {
                     new NameCallback(Bootstrap.getAppUser()),
                     new PasswordCallback(Bootstrap.getAppPassword())
                 }
                     );
                 naming        = Naming.Get(new naming.Request(session));
                 reread_config = true;                        //clear config
                 config        = GetConfig();
             }
         }
     }
     return(session);
 }
Пример #2
0
        public Session getSession()
        {
            Session session = Session.getSession(this, sessionId);

            if (session == null || !session.isValid())
            {
                lock (this)
                {
                    session = Session.getSession(this, sessionId);
                    if (session == null || !session.isValid())                     //need re-auth ?
                    {
                        session = Auth.login(
                            Bootstrap.getAppRealm(),
                            auth.indexType.moduleInstance, "Application",
                            new Callback[] {
                            new NameCallback(Bootstrap.getAppUser()),
                            new PasswordCallback(Bootstrap.getAppPassword())
                        }
                            );
                        sessionId = session.sessionId;
                        naming    = null;                     //clear naming
                        config    = null;                     //clear config
                    }
                }
            }
            return(session);
        }