Hi I am not very familiar with CompletableFuture, but highly suspect SiteResource isn't thread safe.
Its member functions(i.e. createSite, getSiteBySiteId) could be called concurrently, and each member function run its callback via CompletableFuture. This requires SiteEntityEntityServiceMemoryImpl thread safe, but it's not , because siteId2EntityMap is HashMap. Thanks Chang