pdf - 395 K - Ecole des mines de Nantes
pdf - 395 K - Ecole des mines de Nantes
pdf - 395 K - Ecole des mines de Nantes
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
HttpChannel chan = newHttpChannel(Middleware.SERVER_PORT);ChannelServices.RegisterChannel(chan);Instance = new NameServer();RemotingServices.Marshal(Instance, FUNCTION);Console.WriteLine("NS - Available locally");}//****** NON-STATIC PART ******// Table of (agentId, agentAddress)private Hashtable table;/// /// Private constructor because this is Singleton./// private NameServer(){table = new Hashtable();}/// /// Allows for the retrieval of an AgentAddress. Returns nullif none found./// /// /// public AgentAddress FindAddressOf(AgentId agentId){Debug.Assert(agentId != null);AgentAddress address = null;lock (table){if (table.ContainsKey(agentId)){// IAgent is registeredaddress = (AgentAddress)table[agentId];}}return address;}address./// /// Registers an IAgent. If already registered, updates its/// /// /// public void Register(AgentId agentId, AgentAddress address){Debug.Assert(agentId != null);Debug.Assert(address != null);lock (table){if (!table.Contains(agentId)){table.Add(agentId, address);}else{MSc EMOOSE Thesis – http://www.emn.fr/EMOOSE 74