コード例 #1
0
        protected override RefUpdateResult doUpdate(RefUpdateResult status)
        {
            _lock.setNeedStatInformation(true);
            _lock.Write(NewObjectId);

            string msg = getRefLogMessage();

            if (msg != null)
            {
                if (isRefLogIncludingResult())
                {
                    string strResult = toResultString(status);
                    if (strResult != null)
                    {
                        if (msg.Length > 0)
                        {
                            msg = msg + ": " + strResult;
                        }
                        else
                        {
                            msg = strResult;
                        }
                    }
                }
                _database.log(this, msg, true);
            }
            if (!_lock.Commit())
            {
                return(RefUpdateResult.LOCK_FAILURE);
            }
            _database.stored(this, _lock.CommitLastModified);
            return(status);
        }
コード例 #2
0
            protected override void writeFile(string name, byte[] content)
            {
                _lck.setNeedStatInformation(true);
                try
                {
                    _lck.Write(content);
                }
                catch (IOException ioe)
                {
                    throw new ObjectWritingException("Unable to write " + name,
                                                     ioe);
                }
                try
                {
                    _lck.waitForStatChange();
                }
                catch (ThreadAbortException)
                {
                    _lck.Unlock();
                    throw new ObjectWritingException("Interrupted writing "
                                                     + name);
                }
                if (!_lck.Commit())
                {
                    throw new ObjectWritingException("Unable to write " + name);
                }

                _packedRefs.compareAndSet(_oldPackedList, new PackedRefList(_refs,
                                                                            content.Length, _lck.CommitLastModified));
            }