<T> T withAllLocksWriteLocked(@NotNull Computable<T> computable) {
    Lock[] locks = new Lock[myLocks.length];
    List<Exception> exceptions = new SmartList<>();
    boolean isComputed = false;
    T result = null;
    try {
      for (int i = 0; i < myLocks.length; i++) {
        locks[i] = myLocks[i].writeLock();
        locks[i].lock();
      }
      result = computable.compute();
      isComputed = true;
    }
    catch (Exception e) {
      exceptions.add(e);
    }
    finally {
      for (Lock lock : locks) {
        if (lock == null) {
          break;
        }
        else {
          try {
            lock.unlock();
          }
          catch (Exception e) {
            exceptions.add(e);
          }
        }
      }
    }
    if (!exceptions.isEmpty()) {
      IllegalStateException exception = new IllegalStateException("Exceptions during unlocking");
      for (Exception subException : exceptions) {
        exception.addSuppressed(subException);
      }
      throw exception;
    }
    else {
      assert isComputed : "Computation in StripedLock.withAllLocksWriteLocked was incorrect";
      return result;
    }
  }
<T> T withAllLocksWriteLocked(@NotNull Computable<T> computable)