List of usage examples for java.util.concurrent Future getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:maltcms.ui.nb.pipelineRunner.ui.PipelineRunnerTopComponent.java
private void runButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runButtonActionPerformed final MaltcmsLocalHostExecution mlhe = getActiveProcess(); if (mlhe != null) { final Future<File> f = MaltcmsLocalHostExecution.createAndRun(mlhe.getConfigurationFile().getName(), mlhe);/*from ww w.j a v a 2 s . c o m*/ setProcessRunning(mlhe); final ExecutorService es = Executors.newSingleThreadExecutor(); Runnable r = new Runnable() { @Override public void run() { final File result; try { result = f.get(); if (result != null) { Runnable resultImporter = new Runnable() { @Override public void run() { Collection<? extends IFileResultFinder> resultFinders = Lookup.getDefault() .lookupAll(IFileResultFinder.class); Collection<IFileBasedToolResultDescriptor> c = new ArrayList<>(); for (IFileResultFinder f : resultFinders) { Logger.getLogger(PipelineRunnerTopComponent.class.getName()).log(Level.INFO, "Invoking fileResultFinder {0}", f.getClass().getName()); if (f.getResults(result.getParentFile()).length > 0) { c.add(f.createDescriptor((IChromAUIProject) mlhe.getProject(), result.getParentFile())); } else { Logger.getLogger(PipelineRunnerTopComponent.class.getName()).log( Level.INFO, "Skipping fileResultFinder {0}, no suitable results!", f.getClass().getName()); } } Logger.getLogger(PipelineRunnerTopComponent.class.getName()).log(Level.INFO, "Showing dialog for {0} descriptors", c.size()); Collection<? extends IFileBasedToolResultDescriptor> results = Dialogs .showAndSelectDescriptors(c, Lookups.fixed(mlhe.getProject()), IFileBasedToolResultDescriptor.class, "Select results to import", "Select tools to import results:"); for (IFileBasedToolResultDescriptor descr : results) { AProgressAwareRunnable.createAndRun("Running " + descr.getDisplayName(), descr.getProgressAwareRunnable()); } } }; RequestProcessor.getDefault().post(resultImporter); Runnable updater = new Runnable() { @Override public void run() { PipelineRunnerTopComponent.findInstance().removeProcess(mlhe); } }; SwingUtilities.invokeLater(updater); } } catch (InterruptedException | ExecutionException ex) { Exceptions.printStackTrace(ex); } } }; es.submit(r); es.shutdown(); } // Logger.getLogger(PipelineRunnerTopComponent.class.getName()).info("Configuration: " + ConfigurationUtils.toString(cfg)); // if (lhmp != null) { // if (!lhmp.isDone()) { // Logger.getLogger(PipelineRunnerTopComponent.class.getName()).warning("Maltcms is already running! Please stop the running process, before restarting!"); // return; // } // } // // try { // Factory f = Factory.getInstance(); // f.configure(buildCompositeConfiguration(new PropertiesConfiguration(this.cfg))); // ICommandSequence ics = f.createCommandSequence(); // for (IFragmentCommand afc : ics.getCommands()) { // System.out.println("Executing command: " + afc.getClass().getName()); // } // while (ics.hasNext()) { // ics.next(); // } // f.shutdown(); // try { // Factory.awaitTermination(1, TimeUnit.DAYS); // } catch (InterruptedException ex) { // Exceptions.printStackTrace(ex); // } // // Save configuration // Factory.dumpConfig("runtime.properties", ics.getIWorkflow().getStartupDate()); // // Save workflow // final IWorkflow iw = ics.getIWorkflow(); // iw.save(); // // } catch (ConfigurationException ex) { // Exceptions.printStackTrace(ex); // } // LocalHostLauncher lhh; // try { // lhh = new LocalHostLauncher(buildCompositeConfiguration(new PropertiesConfiguration(this.cfg)), this.jPanel1, false); // lhmp = lhh.getProcess(); // ExecutorService es = Executors.newSingleThreadExecutor(); // es.execute(lhh); //// submit(); // jButton1.setEnabled(false); // jButton2.setEnabled(true); // } catch (ConfigurationException ex) { // Exceptions.printStackTrace(ex); // } }