1 23 24 package org.objectweb.clif.deploy; 25 26 import org.objectweb.clif.server.api.ClifServerControl; 27 import org.objectweb.clif.supervisor.api.ClifException; 28 import org.objectweb.fractal.api.Component; 29 import java.util.Map ; 30 31 32 36 public class BladeDeploy extends Thread 37 { 38 protected Component clifApp; 39 protected ClifServerControl server; 40 protected String id; 41 protected String adlFilename; 42 protected Map adlParameters; 43 protected String argument; 44 protected Component bladeComp = null; 45 protected ClifException exception = null; 46 protected boolean terminated = false; 47 48 49 57 public BladeDeploy(Component clifApp, String adlFilename, Map adlParameters, ClifServerControl server, String id) 58 { 59 super(adlFilename + " blade deployment on " + server + " with parameters " + adlParameters); 60 this.clifApp = clifApp; 61 this.server = server; 62 this.adlParameters = adlParameters; 63 this.adlFilename = adlFilename; 64 this.id = id; 65 } 66 67 68 71 public synchronized void run() 72 { 73 try 74 { 75 bladeComp = server.addBlade(clifApp, adlFilename, adlParameters, id); 76 } 77 catch (ClifException ex) 78 { 79 exception = ex; 80 } 81 terminated = true; 82 notify(); 83 } 84 85 86 91 public synchronized Component get() 92 throws ClifException 93 { 94 while (! terminated) 95 { 96 try 97 { 98 wait(); 99 } 100 catch (InterruptedException ex) 101 { 102 System.err.println(ex); 103 } 104 } 105 if (exception == null) 106 { 107 return bladeComp; 108 } 109 throw exception; 110 } 111 } 112 | Popular Tags |