Add @Override annotation to the findByIndexNameAndIndexValue(..) method.

Iterate the o.a.g.cache.query.SearchResults using the Collection.forEach(..) method to add the queried, returned o.s.s.Sessions to a Map.
This commit is contained in:
John Blum
2017-11-01 17:20:06 -07:00
parent 3fd848384b
commit 91706a8a14

View File

@@ -74,15 +74,14 @@ public class GemFireOperationsSessionRepository extends AbstractGemFireOperation
* @see java.util.Map
* @see #prepareQuery(String)
*/
@Override
public Map<String, Session> findByIndexNameAndIndexValue(String indexName, String indexValue) {
SelectResults<Session> results = getTemplate().find(prepareQuery(indexName), indexValue);
Map<String, Session> sessions = new HashMap<>(results.size());
for (Session session : results.asList()) {
sessions.put(session.getId(), session);
}
results.asList().forEach(session -> sessions.put(session.getId(), session));
return sessions;
}