20 namespace Lucene.Net.Store
43 internal System.String host;
46 private class CheckedLock:
Lock
50 this.enclosingInstance = enclosingInstance;
57 return enclosingInstance;
61 private Lock lock_Renamed;
65 InitBlock(enclosingInstance);
66 this.lock_Renamed = lock_Renamed;
69 private void Verify(sbyte message)
73 System.Net.Sockets.TcpClient s =
new System.Net.Sockets.TcpClient(Enclosing_Instance.host, Enclosing_Instance.port);
74 System.IO.Stream out_Renamed = s.GetStream();
75 out_Renamed.WriteByte((byte) Enclosing_Instance.id);
76 out_Renamed.WriteByte((byte) message);
77 System.IO.Stream in_Renamed = s.GetStream();
78 int result = in_Renamed.ReadByte();
83 throw new System.SystemException(
"lock was double acquired");
85 catch (System.Exception e)
87 throw new System.SystemException(e.Message, e);
91 public override bool Obtain(
long lockWaitTimeout)
95 bool obtained = lock_Renamed.
Obtain(lockWaitTimeout);
102 public override bool Obtain()
106 return lock_Renamed.
Obtain();
110 public override bool IsLocked()
118 public override void Release()
149 public override Lock MakeLock(System.String lockName)
153 return new CheckedLock(
this, lf.MakeLock(lockName));
157 public override void ClearLock(System.String lockName)
161 lf.ClearLock(lockName);