@SuppressWarnings("unchecked") @Test void testGetBatchIdLoaderThrowsException() { when(repository.findAll(any(Stream.class))) .thenThrow(new MolgenisDataException("Table is missing for entity TestEntity")); assertThrows( UncheckedExecutionException.class, () -> l2Cache.getBatch(repository, newArrayList("1", "2"))); }
public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) { try { EntityType entityType = repository.getEntityType(); return getEntityCache(repository).getAll(ids).values().stream() .filter(Optional::isPresent) .map(e -> entityHydration.hydrate(e.get(), entityType)) .collect(toList()); } catch (ExecutionException exception) { throw translateExecutionException(exception); } }
L2Cache implements TransactionListener { public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) { try { EntityType entityType = repository.getEntityType(); return getEntityCache(repository).getAll(ids).values().stream() .filter(Optional::isPresent) .map(e -> entityHydration.hydrate(e.get(), entityType)) .collect(toList()); } catch (ExecutionException exception) { throw translateExecutionException(exception); } } }
L2Cache implements TransactionListener { public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) { try { EntityType entityType = repository.getEntityType(); return getEntityCache(repository).getAll(ids).values().stream() .filter(Optional::isPresent) .map(e -> entityHydration.hydrate(e.get(), entityType)) .collect(toList()); } catch (ExecutionException exception) { throw translateExecutionException(exception); } } L2Cache(
      TransactionManager transactionManager,
      EntityHydration entityHydration,
      TransactionInformation transactionInformation,
      MeterRegistry meterRegistry); }
L2Cache implements TransactionListener { public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) { try { EntityType entityType = repository.getEntityType(); return getEntityCache(repository).getAll(ids).values().stream() .filter(Optional::isPresent) .map(e -> entityHydration.hydrate(e.get(), entityType)) .collect(toList()); } catch (ExecutionException exception) { throw translateExecutionException(exception); } } L2Cache(
      TransactionManager transactionManager,
      EntityHydration entityHydration,
      TransactionInformation transactionInformation,
      MeterRegistry meterRegistry); @Override void afterCommitTransaction(String transactionId); Entity get(Repository<Entity> repository, Object id); Entity get(Repository<Entity> repository, Object id, Fetch fetch); List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids); List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids, Fetch fetch); @Scheduled(fixedRate = 60000) void logStatistics(); }
L2Cache implements TransactionListener { public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) { try { EntityType entityType = repository.getEntityType(); return getEntityCache(repository).getAll(ids).values().stream() .filter(Optional::isPresent) .map(e -> entityHydration.hydrate(e.get(), entityType)) .collect(toList()); } catch (ExecutionException exception) { throw translateExecutionException(exception); } } L2Cache(
      TransactionManager transactionManager,
      EntityHydration entityHydration,
      TransactionInformation transactionInformation,
      MeterRegistry meterRegistry); @Override void afterCommitTransaction(String transactionId); Entity get(Repository<Entity> repository, Object id); Entity get(Repository<Entity> repository, Object id, Fetch fetch); List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids); List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids, Fetch fetch); @Scheduled(fixedRate = 60000) void logStatistics();  }