Esempio n. 1
0
        public ResourceMgr_local(ILegacyLogger i_Logger)
        {
            int    ii;
            ISMVMC vmc;

            try
            {
                m_Logger       = i_Logger;
                m_iMaxSessions = ConfigParams.GetNumExt();

                m_VMCs = new VMCList();

                Monitor.Enter(m_Lock);

                for (ii = 0; ii < m_iMaxSessions; ii++)
                {
                    vmc = new ISMVMC();
                    vmc.Clear();
                    m_VMCs.Add(new VMCInfo(ref vmc));
                }
            }
            catch (Exception exc)
            {
                m_Logger.Log(Level.Exception, "RMl ctor caught exception: " + exc.ToString());
            }
            finally
            {
                Monitor.Exit(m_Lock);
            }
        }         // ctor
Esempio n. 2
0
        }         // GetVMCBySessionid

        /// <summary>
        ///
        /// </summary>
        /// <param name="i_iKey"></param>
        /// <returns></returns>
        public virtual string GetSessionId(int i_iKey)
        {
            string sRet   = "";
            ISMVMC vmcTmp = null;

            try
            {
                if (i_iKey == -1)                       // Catch if an invalid key was passed in
                {
                    vmcTmp = new ISMVMC();
                    vmcTmp.Clear();
                }
                else
                {
                    Monitor.Enter(m_Lock);

                    vmcTmp = GetVMCInfoByKey_NoSync(i_iKey).m_VMC;
                    sRet   = vmcTmp.m_sSessionId;
                }
            }
            catch (Exception exc)
            {
                m_Logger.Log(Level.Exception, "RMl GetSessionId(key=" + i_iKey.ToString() + ") caught exception: " + exc.ToString());
            }
            finally
            {
                Monitor.Exit(m_Lock);
            }

            return(sRet);
        }         // GetSessionId
Esempio n. 3
0
        }         // ReleaseSession

/*
 *              /// <summary>
 *              ///
 *              /// </summary>
 *              /// <param name="i_sSessionId"></param>
 *              /// <returns></returns>
 *              public virtual bool ReleaseSession(string i_sSessionId)
 *              {
 *                      bool	bRet = true;
 *                      ISMVMC	vRes;
 *
 *                      try
 *                      {
 *                              Monitor.Enter(m_Lock);
 *
 *                              vRes = GetVMCNoSync(i_sSessionId);
 *                              vRes.Clear();
 *                      }
 *                      catch(Exception exc)
 *                      {
 *                              //Console.Error.WriteLine("ResourceMgr_local.RemoveSession('{0}') Caught exception: '{1}'.", i_sSessionId, e.ToString());
 *                              m_Logger.Log(Level.Exception, "RMl ReleaseSession(id=" + i_sSessionId + ") caught exception: " + exc.ToString());
 *                      }
 *                      finally
 *                      {
 *                              Monitor.Exit(m_Lock);
 *                      }
 *
 *                      return(bRet);
 *              } // ReleaseSession
 */

        protected ISMVMC GetVMCBySrc_NoSync(string i_sSrc)
        {
            ISMVMC vRet = null;
            int    ii, iLen;
            string sTmp;

            iLen = m_VMCs.Count;
            for (ii = 0; ((ii < iLen) && (vRet == null)); ii++)
            {
                sTmp = ((ISMVMC)(m_VMCs[ii].m_VMC)).m_sDescription;
                if (i_sSrc == sTmp)
                {
                    vRet = (ISMVMC)m_VMCs[ii].m_VMC;
                }
            }

            if (vRet == null)                   // VMC wasn't found
            {
                // Allocate new VMC so we don't return null
                vRet = new ISMVMC();
                vRet.Clear();
            }

            return(vRet);
        }         // GetVMCBySrc_NoSync
Esempio n. 4
0
 public VMCInfo()
 {
     m_State = VMCState.Unused;
     m_VMC   = new ISMVMC();
     m_VMC.Clear();
 }