CacheSplitBrainHandlerService(NodeEngine nodeEngine, CachePartitionSegment[] segments) { super(nodeEngine); this.segments = segments; this.cacheService = nodeEngine.getService(SERVICE_NAME); }
CacheSplitBrainHandlerService(NodeEngine nodeEngine, CachePartitionSegment[] segments) { super(nodeEngine); this.segments = segments; this.cacheService = nodeEngine.getService(SERVICE_NAME); }
ReplicatedMapMergeRunnable(Collection<ReplicatedRecordStore> mergingStores, ReplicatedMapSplitBrainHandlerService splitBrainHandlerService, NodeEngine nodeEngine) { super(SERVICE_NAME, mergingStores, splitBrainHandlerService, nodeEngine); this.service = nodeEngine.getService(SERVICE_NAME); }
ReplicatedMapMergeRunnable(Collection<ReplicatedRecordStore> mergingStores, ReplicatedMapSplitBrainHandlerService splitBrainHandlerService, NodeEngine nodeEngine) { super(SERVICE_NAME, mergingStores, splitBrainHandlerService, nodeEngine); this.service = nodeEngine.getService(SERVICE_NAME); }
CacheMergeRunnable(Collection<ICacheRecordStore> mergingStores, CacheSplitBrainHandlerService splitBrainHandlerService, NodeEngine nodeEngine) { super(CacheService.SERVICE_NAME, mergingStores, splitBrainHandlerService, nodeEngine); this.cacheService = nodeEngine.getService(SERVICE_NAME); this.configs = new ConcurrentHashMap<String, CacheConfig>(cacheService.getConfigs()); }
public final <T> T getService() { if (service == null) { // one might have overridden getServiceName() method... final String name = serviceName != null ? serviceName : getServiceName(); service = nodeEngine.getService(name); } return (T) service; }
public final <T> T getService() { if (service == null) { // one might have overridden getServiceName() method... final String name = serviceName != null ? serviceName : getServiceName(); service = nodeEngine.getService(name); } return (T) service; }
CacheMergeRunnable(Collection<ICacheRecordStore> mergingStores, CacheSplitBrainHandlerService splitBrainHandlerService, NodeEngine nodeEngine) { super(CacheService.SERVICE_NAME, mergingStores, splitBrainHandlerService, nodeEngine); this.cacheService = nodeEngine.getService(SERVICE_NAME); this.configs = new ConcurrentHashMap<String, CacheConfig>(cacheService.getConfigs()); }
public static JetInstance getJetInstance(NodeEngine nodeEngine) { return nodeEngine.<JetService>getService(JetService.SERVICE_NAME).getJetInstance(); }
@Nonnull private NodeSequencerService getSequencerService(@Nonnull NodeEngine nodeEngine) { return ExceptionUtils.execute(() -> { NodeSequencerService service = nodeEngine.getService(SnowcastConstants.SERVICE_NAME); printStartupMessage(false); return service; }, SERVICE_NOT_REGISTERED); }
private RecordStore<?> getRecordStore(int partitionId, String storeName) { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapServiceContext mapCtx = svc.getMapServiceContext(); return mapCtx.getExistingRecordStore(partitionId, storeName); }
@Override public void shutdown() { try { JetService jetService = nodeEngine.getService(JetService.SERVICE_NAME); jetService.shutDownJobs(); super.shutdown(); } catch (Throwable t) { throw rethrow(t); } }
@Override public void afterRun() throws Exception { super.afterRun(); final CRDTReplicationMigrationService replicationMigrationService = getNodeEngine().getService(CRDTReplicationMigrationService.SERVICE_NAME); replicationMigrationService.scheduleMigrationTask(0); }
@Override public void afterRun() throws Exception { super.afterRun(); final CRDTReplicationMigrationService replicationMigrationService = getNodeEngine().getService(CRDTReplicationMigrationService.SERVICE_NAME); replicationMigrationService.scheduleMigrationTask(0); }
public Collection<Document> getLastDocumentsForQuery(Predicate<DocumentKey, Document> query) { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapServiceContext mapCtx = svc.getMapServiceContext(); Query q = new Query(CN_XDM_DOCUMENT, query, IterationType.VALUE, null, null); QueryResult rs = (QueryResult) mapCtx.getMapQueryRunner(CN_XDM_DOCUMENT).runIndexOrPartitionScanQueryOnOwnedPartitions(q); if (rs == null) { logger.info("getLastDocumentsForQuery; got null QueryResult for query: {}", query); return Collections.emptyList(); } else { Map<String, Document> results = new HashMap<>(rs.size()); for (QueryResultRow row: rs.getRows()) { Document doc = nodeEngine.toObject(row.getValue()); Document last = results.get(doc.getUri()); if (last == null || doc.getVersion() > last.getVersion()) { results.put(doc.getUri(), doc); } } logger.trace("getLastDocumentsForQuery; returning: {}", results.size()); return results.values(); } }
public Collection<DataKey> getElementKeys(long docId) { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapServiceContext mapCtx = svc.getMapServiceContext(); Query query = new Query(CN_XDM_ELEMENT, Predicates.equal("__key#documentKey", docId), IterationType.KEY, null, null); QueryResult rs = (QueryResult) mapCtx.getMapQueryRunner(CN_XDM_ELEMENT).runIndexOrPartitionScanQueryOnOwnedPartitions(query); if (rs == null) { logger.info("getElementKeys; got null QueryResult for docId: {}", docId); return Collections.emptyList(); } Collection<DataKey> result = new ArrayList<>(rs.size()); for (QueryResultRow row: rs.getRows()) { result.add((DataKey) nodeEngine.toObject(row.getKey())); } return result; }
public Object storeData(Object key, Object value, String storeName) { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapServiceContext mapCtx = svc.getMapServiceContext(); int partId = nodeEngine.getPartitionService().getPartitionId(key); logger.trace("storeData; going to store key: {}; on partition: {}", key, partId); RecordStore<?> rs = mapCtx.getExistingRecordStore(partId, storeName); if (rs != null) { return rs.put(nodeEngine.toData(key), value, 0, 0); } return null; }
public Map<DataKey, Elements> getElements(long docId) { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapServiceContext mapCtx = svc.getMapServiceContext(); Query query = new Query(CN_XDM_ELEMENT, Predicates.equal("__key#documentKey", docId), IterationType.ENTRY, null, null); QueryResult rs = (QueryResult) mapCtx.getMapQueryRunner(CN_XDM_ELEMENT).runIndexOrPartitionScanQueryOnOwnedPartitions(query); if (rs == null) { logger.info("getElements; got null QueryResult for docId: {}", docId); return Collections.emptyMap(); } Map<DataKey, Elements> result = new HashMap<>(rs.size()); for (QueryResultRow row: rs.getRows()) { result.put((DataKey) nodeEngine.toObject(row.getKey()), (Elements) nodeEngine.toObject(row.getValue())); } return result; }
public MapStore getMapStore(String mapName) { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapContainer mc = svc.getMapServiceContext().getMapContainer(mapName); if (mc != null) { MapStoreContext msc = mc.getMapStoreContext(); if (msc != null) { MapStoreWrapper msw = msc.getMapStoreWrapper(); if (msw != null) { return (MapStore) msw.getImpl(); } } } return null; }
public int getUpdatingDocumentCount() { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapServiceContext xddCtx = svc.getMapServiceContext(); // this does not work for some reason //return xddCtx.getWriteBehindQueueItemCounter().get(); int cnt = 0; List<Integer> parts = nodeEngine.getPartitionService().getMemberPartitions(nodeEngine.getThisAddress()); for (int part: parts) { RecordStore rs = xddCtx.getRecordStore(part, CN_XDM_DOCUMENT); if (rs != null) { cnt += rs.getMapDataStore().notFinishedOperationsCount(); } } return cnt; }