package wxyz.mf.plugin.services; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import arc.mf.plugin.PluginLog; import arc.mf.plugin.ServiceExecutor; import arc.xml.XmlDoc.Element; import arc.xml.XmlWriter; import wxyz.mf.plugin.util.MultiThreadPluginService; public class SvcTest extends MultiThreadPluginService<Integer> { private Interface _defn; public SvcTest() { _defn = new Interface(); } @Override public Access access() { return ACCESS_ACCESS; } @Override public Interface definition() { return _defn; } @Override public String description() { return "Test multithreading."; } @Override public String name() { return "omics.test"; } @Override protected void consume(ServiceExecutor executor, Integer input, PluginLog log) throws Throwable { Thread.sleep(1000); String uuid = executor.execute("server.uuid").value("uuid"); if (input == 15) { log.add(PluginLog.WARNING, "#8: Mock Exception for value 15."); throw new Exception("Mock Exception for value 15."); } System.out.println(Thread.currentThread().getName() + " consumed: " + input); System.out.println(Thread.currentThread().getName() + " uuid: " + uuid); } @Override protected Collection<Integer> produce(Element args, Inputs in, Outputs out, XmlWriter w, Map<String, Object> intermediateResults) throws Throwable { List<Integer> inputs = new ArrayList<Integer>(100); for (int i = 0; i < 20; i++) { inputs.add(i); } return inputs; } }
Search This Blog
Multi-threading in Mediaflux Plugin Service
HTML table fill up the whole page
<table style="width:100%; height:100%; position:absolute; top:0; bottom:0; left 0; right:0;" border="0" cellspacing="1" cellpadding="3"> <tr id="content" style="height: 100%;"> <td align="center">Content</td> </tr> <tr id="footer" style="height:28px;"> <td align="center">footer</td> </tr> </table>
Subscribe to:
Posts (Atom)