@Override public Entry<Integer, Data> apply(Data input) { // Null-pointer here, in case of null key loaded by MapLoader checkNotNull(input, "Key loaded by a MapLoader cannot be null."); Integer partition = partitionService.getPartitionId(input); return new MapEntrySimple<Integer, Data>(partition, input); } }
@Override public Object process(Entry<IndexKey, IndexedValue> entry) { try { for (IndexKey ik: indices) { IndexedValue iv = ddSvc.getCachedObject(CN_XDM_INDEX, ik, true); processIndex(new MapEntrySimple<>(ik, iv)); } } catch (Exception ex) { logger.error("process.error", ex); return ex; } return null; }
@Override public Entry<Integer, Data> apply(Data input) { // Null-pointer here, in case of null key loaded by MapLoader checkNotNull(input, "Key loaded by a MapLoader cannot be null."); Integer partition = partitionService.getPartitionId(input); return new MapEntrySimple<Integer, Data>(partition, input); } }
@Override public int removeDocumentFromCollections(String uri, String[] collections) { logger.trace("removeDocumentsFromCollections.enter; got uri: {}; collectIds: {}", uri, Arrays.toString(collections)); int cnt = 0; Document doc = getDocument(uri); if (doc != null) { DocumentKey key = factory.newDocumentKey(doc.getDocumentKey()); cnt = updateDocumentCollections(false, new MapEntrySimple<>(key, doc), collections); if (cnt > 0) { docCache.set(key, doc); } } logger.trace("removeDocumentsFromCollections.exit; removed: {}", cnt); return cnt; }
/** * Gets attributes. * * @param sessionId the session id * @return the attributes * @throws Exception the exception */ Set<Map.Entry<String, Object>> getAttributes(String sessionId) throws Exception { GetSessionStateEntryProcessor entryProcessor = new GetSessionStateEntryProcessor(); SessionState sessionState = (SessionState) executeOnKey(sessionId, entryProcessor); if (sessionState == null) { return null; } Map<String, Data> dataAttributes = sessionState.getAttributes(); Set<Map.Entry<String, Object>> attributes = new HashSet<Map.Entry<String, Object>>(dataAttributes.size()); for (Map.Entry<String, Data> entry : dataAttributes.entrySet()) { String key = entry.getKey(); Object value = sss.getSerializationService().toObject(entry.getValue()); attributes.add(new MapEntrySimple<String, Object>(key, value)); } return attributes; }
/** * Gets attributes. * * @param sessionId the session id * @return the attributes * @throws Exception the exception */ Set<Map.Entry<String, Object>> getAttributes(String sessionId) throws Exception { GetSessionStateEntryProcessor entryProcessor = new GetSessionStateEntryProcessor(); SessionState sessionState = (SessionState) executeOnKey(sessionId, entryProcessor); if (sessionState == null) { return null; } Map<String, Data> dataAttributes = sessionState.getAttributes(); Set<Map.Entry<String, Object>> attributes = new HashSet<Map.Entry<String, Object>>(dataAttributes.size()); for (Map.Entry<String, Data> entry : dataAttributes.entrySet()) { String key = entry.getKey(); Object value = sss.getSerializationService().toObject(entry.getValue()); attributes.add(new MapEntrySimple<String, Object>(key, value)); } return attributes; }
@Override public int addDocumentToCollections(String uri, String[] collections) { logger.trace("addDocumentsToCollections.enter; got uri: {}; collectIds: {}", uri, Arrays.toString(collections)); int cnt = 0; Document doc = getDocument(uri); if (doc != null) { DocumentKey key = factory.newDocumentKey(doc.getDocumentKey()); cnt = updateDocumentCollections(true, new MapEntrySimple<>(key, doc), collections); if (cnt > 0) { docCache.set(key, doc); } } logger.trace("addDocumentsToCollections.exit; added: {}", cnt); return cnt; }
entry = new MapEntrySimple<>(lastKey, null); entry = new MapEntrySimple<>(lastKey, lastDoc);