public PadInt AccessPadInt(int uid) { IServer server = null; PadInt remote = null; try { server = lookupService.GetServer(uid); Console.WriteLine("server: " + uid + " "); remote = server.AccessPadInt(currentTid, uid); if (remote == null) { Console.WriteLine("remote null"); } Console.WriteLine("remote uid: " + uid); } catch (SocketException e) { Console.WriteLine("exception: " +e.Message); //Recuperacao masterService.Master.RemoveServer(lookupService.GetServerEndpoint(uid)); //Recuperacao concluida //Tenta executar novamente //lookupService.AddParticipant(currentTid, uid); server = lookupService.GetServer(uid); AccessPadInt(uid); //throw new NotImplementedException(); //////////////////////////////////////////////tEMOS DE IMPLEMENTAR ISTO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! } if (remote == null) return null; int value = remote.Read(); PadIntLocal local = new PadIntLocal(uid, value); local.changeHandler += this.OnPadintChange; local.readHandler += this.OnPadintRead; return local; }
public PadInt CreatePadInt(int uid) { IServer server = null; PadInt padInt = null; try { server = lookupService.GetServer(uid); if (currentTid == 0) { currentTid = server.GetTid(); } lookupService.AddParticipant(currentTid, uid); padInt = server.CreatePadInt(currentTid, uid); } catch (SocketException e) { //Recuperacao masterService.Master.RemoveServer(lookupService.GetServerEndpoint(uid)); CreatePadInt(uid); //throw new NotImplementedException(); //////////////////////////////////////////////tEMOS DE IMPLEMENTAR ISTO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! } if (padInt == null) return null; PadIntLocal local = new PadIntLocal(uid); if (local == null) return null; local.changeHandler += this.OnPadintChange; local.readHandler += this.OnPadintRead; return local; }