public void LookForBemaltesEi() { IOsterFabrikCallback callback = GetCallbackChannel(); lock (_bemalteEier) { if (_bemalteEier.Count > 0) { Ei ei = _bemalteEier.Dequeue(); try { callback.ReturnBemaltesEi(ei); NotifyBemalteEier(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); _bemalteEier.Enqueue(ei); } } else { lock (_waitForBemaltesEi) { _waitForBemaltesEi.Enqueue(callback); } } } }
public void AddUnbemaltesEi(Ei ei) { lock (_unbemalteEier) { lock (_waitForUnbemaltesEi) { while (_waitForUnbemaltesEi.Count > 0 && ei != null) { IOsterFabrikCallback callback = _waitForUnbemaltesEi.Dequeue(); if (IsCommunicationOpened(callback)) { try { callback.ReturnUnbemaltesEi(ei); ei = null; } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } } if (ei != null) { _unbemalteEier.Enqueue(ei); NotifyUnbemalteEier(); } } }
public void AddBemaltesEi(Ei ei) { lock (_bemalteEier) { lock (_waitForBemaltesEi) { while (_waitForBemaltesEi.Count > 0 && ei != null) { IOsterFabrikCallback callback = _waitForBemaltesEi.Dequeue(); if (IsCommunicationOpened(callback)) { try { callback.ReturnBemaltesEi(ei); ei = null; } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } } if (ei != null) { _bemalteEier.Enqueue(ei); NotifyBemalteEier(); } } }