@Override public HazelcastInstance getClient() { return jet.getHazelcastInstance(); }
/** * <p>Make the Hazelcast instance that Jet is using available * as a Spring bean. * </p> * * @param jetInstance Spring {@code @Bean} created above * @return The Hazelcast server embedded in the Jet instance */ @Bean public HazelcastInstance hazelcastInstance(JetInstance jetInstance) { return jetInstance.getHazelcastInstance(); } }
/** * Returns the collection of exported job state snapshots stored in the * cluster. */ @Nonnull default Collection<JobStateSnapshot> getJobStateSnapshots() { return getHazelcastInstance().getMap(JobRepository.EXPORTED_SNAPSHOTS_DETAIL_CACHE) .entrySet().stream() .map(entry -> new JobStateSnapshot(this, (String) entry.getKey(), (SnapshotValidationRecord) entry.getValue())) .collect(toList()); }
public JobRepository(JetInstance jetInstance) { this.instance = jetInstance.getHazelcastInstance(); this.logger = instance.getLoggingService().getLogger(getClass()); this.randomIds = instance.getMap(RANDOM_IDS_MAP_NAME); this.jobRecords = instance.getMap(JOB_RECORDS_MAP_NAME); this.jobExecutionRecords = instance.getMap(JOB_EXECUTION_RECORDS_MAP_NAME); this.jobResults = instance.getMap(JOB_RESULTS_MAP_NAME); this.exportedSnapshotDetailsCache = instance.getMap(EXPORTED_SNAPSHOTS_DETAIL_CACHE); }
@Override protected void init(@Nonnull Context context) { serializationService = ((HazelcastInstanceImpl) context.jetInstance().getHazelcastInstance()).getSerializationService(); }
@Override public void init(@Nonnull Context context) { partitionToIterator = iteratorSupplier.apply(context.jetInstance().getHazelcastInstance()); }
@Bean public HazelcastInstance hazelcastInstance(CommandListener commandListener, JetInstance jetInstance) { HazelcastInstance hazelcastInstance = jetInstance.getHazelcastInstance(); // React to map changes IMap<?, ?> commandMap = hazelcastInstance.getMap(Constants.IMAP_NAME_COMMAND); commandMap.addLocalEntryListener(commandListener); // Add in, if we want to trace map changes IMap<?, ?> preciousMap = hazelcastInstance.getMap(Constants.IMAP_NAME_PRECIOUS); preciousMap.addLocalEntryListener(new LoggingListener()); return hazelcastInstance; } }
@Override public void init(@Nonnull Context context) { if (clientXml != null) { instance = client = newHazelcastClient(asClientConfig(clientXml)); } else { instance = context.jetInstance().getHazelcastInstance(); } }
@Override public void init(@Nonnull Context context) { addrToPartitions = context.jetInstance().getHazelcastInstance().getPartitionService().getPartitions() .stream() .collect(groupingBy(p -> p.getOwner().getAddress(), mapping(Partition::getPartitionId, toList()))); }
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification = "jetInstance() can be null in TestProcessorContext") private ILogger getLogger(@Nonnull Context context) { return context.jetInstance() != null ? context.jetInstance().getHazelcastInstance().getLoggingService().getLogger(getClass() + "." + toString()) : Logger.getLogger(getClass()); }
private static <K, V> ICacheJet<K, V> getCache(JetInstance jetInstance, String name) { return new ICacheDecorator<>( jetInstance.getHazelcastInstance().getCacheManager().getCache(name), jetInstance ); }
private Thread shutdownHookThread(NodeEngine nodeEngine) { return new Thread(() -> { String policy = nodeEngine.getProperties().getString(SHUTDOWNHOOK_POLICY); if (policy.equals("TERMINATE")) { jetInstance.getHazelcastInstance().getLifecycleService().terminate(); } else { jetInstance.shutdown(); } }, "jet.ShutdownThread"); } }
@Override public void init(@Nonnull Context context) { HazelcastInstance instance = context.jetInstance().getHazelcastInstance(); if (clientXml != null) { client = newHazelcastClient(asClientConfig(clientXml)); instance = client; } eventJournalReader = eventJournalReaderSupplier.apply(instance); }
/** * Creates a server instance of Hazelcast Jet. If the system property * {@code print.port} is set, the server writes the port number of the * Hazelcast instance to a file named by the property. */ public static void main(String[] args) throws Exception { configureLogging(); JetInstance jet = Jet.newJetInstance(); printMemberPort(jet.getHazelcastInstance()); }
@Override public void init(@Nonnull Context context) { if (clientXml != null) { initRemote(); } else { initLocal(context.jetInstance().getHazelcastInstance().getPartitionService().getPartitions()); } }
@Override public void init(@Nonnull Context context) { if (context.localParallelism() != 1) { throw new IllegalArgumentException( "Non-distributed vertex had parallelism of " + context.localParallelism() + ", should be 1"); } String key = StringPartitioningStrategy.getPartitionKey(partitionKey); ownerAddress = context.jetInstance().getHazelcastInstance().getPartitionService() .getPartition(key).getOwner().getAddress(); }
@Override public void init(@Nonnull Context context) { HazelcastInstance instance; if (isRemote()) { instance = client = newHazelcastClient(asClientConfig(clientXml)); } else { instance = context.jetInstance().getHazelcastInstance(); } flushBufferFn = instanceToFlushBufferFn.apply(instance); newBufferFn = instanceToNewBufferFn.apply(instance); }
@Override public void init(@Nonnull Context context) throws Exception { logger = context.jetInstance().getHazelcastInstance().getLoggingService().getLogger(ReadHdfsP.class); int totalParallelism = context.totalParallelism(); InputFormat inputFormat = jobConf.getInputFormat(); InputSplit[] splits = inputFormat.getSplits(jobConf, totalParallelism); IndexedInputSplit[] indexedInputSplits = new IndexedInputSplit[splits.length]; Arrays.setAll(indexedInputSplits, i -> new IndexedInputSplit(i, splits[i])); Address[] addrs = context.jetInstance().getCluster().getMembers() .stream().map(Member::getAddress).toArray(Address[]::new); assigned = assignSplitsToMembers(indexedInputSplits, addrs); printAssignments(assigned); }
private static Sink<String> buildTopicSink() { return sinkBuilder("topicSink(" + TOPIC_NAME + ')', jet -> jet.jetInstance().getHazelcastInstance().<String>getTopic(TOPIC_NAME)) .<String>receiveFn((topic, message) -> topic.publish(message)) .build(); }
@Override public void run() { JetService service = getService(); HazelcastInstance instance = service.getJetInstance().getHazelcastInstance(); Cluster cluster = instance.getCluster(); String name = instance.getConfig().getGroupConfig().getName(); response = new ClusterMetadata(name, cluster); }