コード例 #1
0
            void iSerializerSession.recreateTable <tRow>()
            {
                if (cooperativeLevel != eSessionCooperativeLevel.Exclusive)
                {
                    throw new Exception("To call recreateTable API, this session must be opened with eSessionCooperativeLevel.Exclusive option");
                }

                SerializerSession.eTableState stateInThisSession = this.session.closeTable <tRow>();

                // Close this table in all sessions.
                object k = this.pool.closeTable <tRow>(this.session);

                try
                {
                    // Recreate the table
                    this.session.recreateTable <tRow>();
                }
                finally
                {
                    // Reopen the table in this session
                    this.session.reopenTable <tRow>(stateInThisSession);

                    // For the rest of the sessions however, delay reopening till the end of this session
                    // Due to session isolations other session can't see the changes until the transaction is committed,
                    // and because we require eSessionCooperativeLevel.Exclusive the reopen is safe to delay until the end of the session (it's much harder to track the exact moment when the transaction is committed - they can be nested).
                    Action actReopenInOtherSessions = () => this.pool.reopenTable <tRow>(k);
                    if (null == actAfterRelease)
                    {
                        actAfterRelease = actReopenInOtherSessions;
                    }
                    else
                    {
                        actAfterRelease += actReopenInOtherSessions;
                    }
                }
            }
コード例 #2
0
 public void add(SerializerSession s, SerializerSession.eTableState t)
 {
     m_list.Add(s, t);
 }