Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-538

remove code duplication from HotRodOperationsImpl

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 4.1.0.CR2
    • None
    • None
    • None

      HotRodOperationsImpl - contain code duplication in the way retry is handled. Basically following logic is replicated through all operations:
      Transport transport = getTransport(key, true);
      int retryCount = 0;
      do {
      try

      { //to something here }

      catch (TransportException te)

      { logErrorAndThrowExceptionIfNeeded(retryCount, te); }

      finally

      { releaseTransport(transport); }

      if (shouldRetry(retryCount))

      { transport = getTransport(key, false); }

      retryCount++;
      } while (shouldRetry(retryCount));
      throw new IllegalStateException("We should not reach here!");

      This should be factorized in a TemplateMethod because: a - duplication is evil and b - duplication is more even in a reference implementation.

              mircea.markus Mircea Markus (Inactive)
              mircea.markus Mircea Markus (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: