Java Code Examples for com.hazelcast.jet.Jet#shutdownAll()
The following examples show how to use
com.hazelcast.jet.Jet#shutdownAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlightTelemetry.java From hazelcast-jet-demos with Apache License 2.0 | 6 votes |
public static void main(String[] args) { if (FlightDataSource.API_AUTHENTICATION_KEY.equals("YOUR_API_KEY_HERE")) { System.err.println("API_AUTHENTICATION_KEY not set in FlightDataSource.java"); System.exit(1); } JetInstance jet = getJetInstance(); Pipeline pipeline = buildPipeline(); addListener(jet.getMap(TAKE_OFF_MAP), a -> System.out.println("New aircraft taking off: " + a)); addListener(jet.getMap(LANDING_MAP), a -> System.out.println("New aircraft landing " + a)); try { Job job = jet.newJob(pipeline, new JobConfig().setName("FlightTelemetry").setProcessingGuarantee(ProcessingGuarantee.EXACTLY_ONCE)); job.join(); } finally { Jet.shutdownAll(); } }
Example 2
Source File: TrafficPredictor.java From hazelcast-jet-demos with Apache License 2.0 | 6 votes |
public static void main(String[] args) { if (args.length != 2) { System.err.println("Missing command-line arguments: <input file> <output directory>"); System.exit(1); } Path sourceFile = Paths.get(args[0]).toAbsolutePath(); final String targetDirectory = args[1]; if (!Files.isReadable(sourceFile)) { System.err.println("Source file does not exist or is not readable (" + sourceFile + ")"); System.exit(1); } JetInstance instance = Jet.newJetInstance(); Pipeline pipeline = buildPipeline(sourceFile, targetDirectory); try { instance.newJob(pipeline).join(); } finally { Jet.shutdownAll(); } }
Example 3
Source File: RealTimeImageRecognition.java From hazelcast-jet-demos with Apache License 2.0 | 6 votes |
public static void main(String[] args) { validateWebcam(); if (args.length != 1) { System.err.println("Missing command-line argument: <model path>"); System.exit(1); } Path modelPath = Paths.get(args[0]).toAbsolutePath(); if (!Files.isDirectory(modelPath)) { System.err.println("Model path does not exist (" + modelPath + ")"); System.exit(1); } Pipeline pipeline = buildPipeline(); JobConfig jobConfig = new JobConfig(); jobConfig.attachDirectory(modelPath.toString(), "model"); JetInstance jet = Jet.newJetInstance(); try { jet.newJob(pipeline, jobConfig).join(); } finally { Jet.shutdownAll(); } }
Example 4
Source File: TestJetMain.java From hazelcast-jet-demos with Apache License 2.0 | 6 votes |
@Test public void testBuildDAG() { User u = makeUser(); Bet b = makeBet(); u.addBet(b); assertNotNull(b); try { IMap<String, ?> ism = jet.getMap(WORST_ID); System.out.println(ism); System.out.println("Size: " + ism.size()); for (String s : ism.keySet()) { System.out.println(s + " : " + ism.get(s)); } } finally { Jet.shutdownAll(); } }
Example 5
Source File: TradeAnalysis.java From hazelcast-jet-training with Apache License 2.0 | 6 votes |
public static void main(String[] args) { Pipeline p = buildPipeline(); JetInstance jet = Jet.bootstrappedInstance(); try { JobConfig jobConfig = new JobConfig() .setAutoScaling(true) .setName("TradeAnalysis") .setProcessingGuarantee(ProcessingGuarantee.EXACTLY_ONCE); jet.newJob(p, jobConfig).join(); } finally { Jet.shutdownAll(); } }
Example 6
Source File: WordCounter.java From tutorials with MIT License | 6 votes |
public Long countWord(List<String> sentences, String word) { long count = 0; JetInstance jet = Jet.newJetInstance(); try { List<String> textList = jet.getList(LIST_NAME); textList.addAll(sentences); Pipeline p = createPipeLine(); jet.newJob(p) .join(); Map<String, Long> counts = jet.getMap(MAP_NAME); count = counts.get(word); } finally { Jet.shutdownAll(); } return count; }
Example 7
Source File: MarkovChainGenerator.java From hazelcast-jet-demos with Apache License 2.0 | 5 votes |
public static void main(String[] args) { JetInstance jet = Jet.newJetInstance(); Pipeline p = buildPipeline(); System.out.println("Generating model..."); try { jet.newJob(p).join(); printTransitionsAndMarkovChain(jet); } finally { Jet.shutdownAll(); } }
Example 8
Source File: CryptocurrencySentimentAnalysis.java From hazelcast-jet-demos with Apache License 2.0 | 5 votes |
public static void main(String[] args) { System.out.println("DISCLAIMER: This is not investment advice"); Pipeline pipeline = buildPipeline(); // Start Jet JetInstance jet = Jet.newJetInstance(); try { new CryptoSentimentGui(jet.getMap(MAP_NAME_JET_RESULTS)); jet.newJob(pipeline).join(); } finally { Jet.shutdownAll(); } }
Example 9
Source File: JetRunner.java From beam with Apache License 2.0 | 5 votes |
private void stopClusterIfNeeded(JetPipelineOptions options) { Integer noOfLocalMembers = options.getJetLocalMode(); if (noOfLocalMembers > 0) { Jet.shutdownAll(); LOG.info("Stopped all Jet cluster members"); } }
Example 10
Source File: JetBetMain.java From hazelcast-jet-demos with Apache License 2.0 | 4 votes |
public void stop() throws IOException { Jet.shutdownAll(); Utils.cleanupDataInTmp(filePath); }