1 22 package org.jboss.test.recover.bean; 23 24 import javax.naming.Context ; 25 import javax.naming.InitialContext ; 26 27 import org.jboss.aop.Dispatcher; 28 import org.jboss.aspects.remoting.Remoting; 29 import org.jboss.naming.Util; 30 import org.jboss.system.ServiceMBeanSupport; 31 import org.jboss.test.recover.interfaces.RemoteDummyRecoverable; 32 import org.jboss.tm.recovery.Recoverable; 33 34 40 public class RemoteDummyRecoverableService 41 extends ServiceMBeanSupport 42 implements RemoteDummyRecoverableServiceMBean 43 { 44 private String id; 45 46 public String getId() 47 { 48 return id; 49 } 50 51 public void setId(String id) 52 { 53 this.id = id; 54 } 55 56 public void startService() throws Exception 57 { 58 Recoverable target = new RemoteDummyRecoverable(id); 59 60 Dispatcher.singleton.registerTarget("Recoverable/" + id, target); 61 Recoverable proxy = 62 (Recoverable)Remoting.createRemoteProxy( 63 "Recoverable/" + id, 64 RemoteDummyRecoverable.class, 65 "socket://0.0.0.0:5150"); 66 67 String jndiName = "RemoteDummyRecoverable/" + id; 68 Context iniCtx = new InitialContext (); 69 Util.bind(iniCtx, jndiName, proxy); 70 log.debug("Bound proxy under jndiName=" + jndiName); 71 } 72 73 public void stopService() throws Exception 74 { 75 String jndiName = "RemoteDummyRecoverable/" + id; 76 Context iniCtx = new InitialContext (); 77 Util.unbind(iniCtx, jndiName); 78 } 79 80 } 81 | Popular Tags |