1 31 package org.objectweb.proactive.examples.binarytree; 32 33 import org.apache.log4j.Logger; 34 import org.objectweb.proactive.core.config.ProActiveConfiguration; 35 36 public class Main { 37 38 static Logger logger = Logger.getLogger(Main.class.getName()); 39 40 public static void main(String [] args) { 41 Main theMainActiveObject = null; 42 ProActiveConfiguration.load(); 44 try { 45 theMainActiveObject = (Main)org.objectweb.proactive.ProActive.newActive(Main.class.getName(), 46 null); 47 } catch (Exception e) { 48 logger.error(e); 49 System.exit(1); 50 } 51 theMainActiveObject.doStuff(); 53 return; 54 } 55 56 public void doStuff() { 57 BinaryTree myTree = null; 58 try { 69 myTree = (BinaryTree)org.objectweb.proactive.ProActive.newActive(ActiveBinaryTree.class.getName(), 71 null); 72 } catch (Exception e) { 73 logger.error(e); 74 e.printStackTrace(); 75 } 76 myTree.put(1, "one"); 79 myTree.put(2, "two"); 80 myTree.put(3, "three"); 81 myTree.put(4, "four"); 82 ObjectWrapper tmp1 = myTree.get(3); 88 ObjectWrapper tmp2 = myTree.get(4); 89 ObjectWrapper tmp3 = myTree.get(2); 90 ObjectWrapper tmp4 = myTree.get(1); 91 logger.info("Value associated to key 1 is " + tmp4); 92 logger.info("Value associated to key 2 is " + tmp3); 93 logger.info("Value associated to key 3 is " + tmp1); 94 logger.info("Value associated to key 4 is " + tmp2); 95 logger.info("Use CTRL+C to stop the program"); 96 } 97 } | Popular Tags |