示例#1
0
 //Only visible to the library.
 internal PadInt(PadIntValue v)
 {
     _requests = new List<Request>();
     _value = v;
 }
示例#2
0
 //Function that registers a padint on this server.
 public PadIntValue CreatePadInt(int uid)
 {
     try
     {
        /* _master = (RemoteMasterInterface)Activator.GetObject(
         typeof(RemoteMasterInterface),
         "tcp://localhost:" + Interfaces.Constants.MasterPort + "/master");*/
         if( _master.regPadint(uid, _ownURL))
         {
             PadIntValue v = new PadIntValue(uid, 0);
             _padInts.Add(uid, v);
             Console.WriteLine("CreatedPadint: " + v.getId());
             return v;
         }
         else
         {
             //TODO
             Console.WriteLine("Duplicated Padint");
             throw new TxException("Duplicated Padint");
         }
        }
     catch (Exception e)
        {
        Console.WriteLine("Error Creating Padint from master.");
         //throws either a new exception or the same returned from the master.
        //throw new TxException("Error Creating Padint from master.");
        throw e;
     }
 }