code: public T getValue(long value) {
          final Object lock = new Object();
          final List<T> resultList = new ArrayList<>();
          synchronized (lock) {
              storageActor.send(new AsyncStorageActor.LoadItem<T>(value, item -> {
                  synchronized (lock) {
                      if (item != null) {
                          resultList.add(item);
                      }
                      lock.notify();
                  }
              }));
  
              try {
                  lock.wait();
              } catch (InterruptedException e) {
                  return null;
              }
  
              if (resultList.size() > 0) {
                  return resultList.get(0);
              } else {
                  return null;
              }
          }
      }
docs: Sync