Ejemplo n.º 1
0
 private bool ClientHoldsThisLock(ForsetiClient client)
 {
     foreach (AtomicReferenceArray <ForsetiClient> holders in _clientsHoldingThisLock)
     {
         for (int j = 0; holders != null && j < holders.length(); j++)
         {
             ForsetiClient current = holders.get(j);
             if (current != null && current.Equals(client))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        private void RemoveClientHoldingLock(ForsetiClient client)
        {
            foreach (AtomicReferenceArray <ForsetiClient> holders in _clientsHoldingThisLock)
            {
                if (holders == null)
                {
                    break;
                }

                for (int j = 0; j < holders.length(); j++)
                {
                    ForsetiClient current = holders.get(j);
                    if (current != null && current.Equals(client))
                    {
                        holders.set(j, null);
                        return;
                    }
                }
            }

            throw new System.InvalidOperationException(client + " asked to be removed from holder list, but it does not hold " + this);
        }