@Test public void get_notPresent() throws Exception { final QueryRepository queries = new InMemoryQueryRepository( new InMemoryQueryChangeLog(), SCHEDULE ); final Optional<StreamsQuery> query = queries.get(UUID.randomUUID()); assertFalse(query.isPresent()); }
@Override public Optional<StreamsQuery> get(final UUID queryId) throws QueryRepositoryException, IllegalStateException { requireNonNull(queryId); lock.lock(); try { checkState(); updateCache(); return Optional.ofNullable( queriesCache.get(queryId) ); } finally { lock.unlock(); } }
InMemoryQueryRepository extends AbstractScheduledService implements QueryRepository { @Override public Optional<StreamsQuery> get(final UUID queryId) throws QueryRepositoryException, IllegalStateException { requireNonNull(queryId); lock.lock(); try { checkState(); updateCache(); return Optional.ofNullable( queriesCache.get(queryId) ); } finally { lock.unlock(); } } }
InMemoryQueryRepository extends AbstractScheduledService implements QueryRepository { @Override public Optional<StreamsQuery> get(final UUID queryId) throws QueryRepositoryException, IllegalStateException { requireNonNull(queryId); lock.lock(); try { checkState(); updateCache(); return Optional.ofNullable( queriesCache.get(queryId) ); } finally { lock.unlock(); } } InMemoryQueryRepository(final QueryChangeLog changeLog, final Scheduler scheduler); }
InMemoryQueryRepository extends AbstractScheduledService implements QueryRepository { @Override public Optional<StreamsQuery> get(final UUID queryId) throws QueryRepositoryException, IllegalStateException { requireNonNull(queryId); lock.lock(); try { checkState(); updateCache(); return Optional.ofNullable( queriesCache.get(queryId) ); } finally { lock.unlock(); } } InMemoryQueryRepository(final QueryChangeLog changeLog, final Scheduler scheduler); @Override StreamsQuery add(final String query, final boolean isActive, final boolean isInsert); @Override Optional<StreamsQuery> get(final UUID queryId); @Override void updateIsActive(final UUID queryId, final boolean isActive); @Override void delete(final UUID queryId); @Override Set<StreamsQuery> list(); @Override Set<StreamsQuery> subscribe(final QueryChangeLogListener listener); @Override void unsubscribe(final QueryChangeLogListener listener); }
InMemoryQueryRepository extends AbstractScheduledService implements QueryRepository { @Override public Optional<StreamsQuery> get(final UUID queryId) throws QueryRepositoryException, IllegalStateException { requireNonNull(queryId); lock.lock(); try { checkState(); updateCache(); return Optional.ofNullable( queriesCache.get(queryId) ); } finally { lock.unlock(); } } InMemoryQueryRepository(final QueryChangeLog changeLog, final Scheduler scheduler); @Override StreamsQuery add(final String query, final boolean isActive, final boolean isInsert); @Override Optional<StreamsQuery> get(final UUID queryId); @Override void updateIsActive(final UUID queryId, final boolean isActive); @Override void delete(final UUID queryId); @Override Set<StreamsQuery> list(); @Override Set<StreamsQuery> subscribe(final QueryChangeLogListener listener); @Override void unsubscribe(final QueryChangeLogListener listener);  }