Uploaded image for project: 'Sentry (Retired)'
  1. Sentry (Retired)
  2. SENTRY-1501

SentryStore shouldn't synchronize openTransaction() and commitUpdateTransaction()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.0, 2.0.0
    • 1.8.0, 2.0.0
    • Sentry
    • None

    Description

      SentryStore.openTransaction() is synchronized for no reason - the peristence manager factory is thread-safe.

      The synchronization here doesn't make any sense at all:

        /**
         * Synchronized due to sequence id generation
         */
        public synchronized CommitContext commitUpdateTransaction(PersistenceManager pm) {
          commitTransaction(pm);
          return new CommitContext(SERVER_UUID, incrementGetSequenceId());
        }
      
        /**
         * Increments commitSequenceId which should not be modified outside
         * this method.
         *
         * @return sequence id
         */
        private synchronized long incrementGetSequenceId() {
          return ++commitSequenceId;
        }
      

      Note that incrementGetSequenceId() is synchronized so there is no need to synchronize commitUpdateTransaction(). More over, there is no need to synchronize incrementGetSequenceId(), it can just use atomic for the index. And I think that handling of this atomic should be moved to the CommitContext instead.

      Attachments

        Issue Links

          Activity

            People

              akolb Alex Kolbasov
              akolb Alex Kolbasov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: