public override void real_work() { SQueue <SchokoHase> hasen = new SQueue <SchokoHase>(this.space, "SchokoHasen", remote_space_uri); SQueue <Ei> bemalt = new SQueue <Ei>(this.space, "BemalteEier", remote_space_uri); SQueue <Nest> nester = new SQueue <Nest>(this.space, "Nester", remote_space_uri); int count = 0; while (true) { try { using (XcoTransaction tx = space.BeginTransaction()) { Ei e1 = bemalt.Dequeue(); Ei e2 = bemalt.Dequeue(); SchokoHase sh = hasen.Dequeue(); nester.Enqueue(new Nest(id + count.ToString(), id, e1, e2, sh)); count = count + 1; tx.Commit(); Console.WriteLine("done"); } } catch (Exception e) { } if (Console.KeyAvailable) { return; } } }
public override void real_work() { SQueue <Ei> unbemalt = new SQueue <Ei>(this.space, "UnbemalteEier", remote_space_uri); SQueue <Ei> bemalt = new SQueue <Ei>(this.space, "BemalteEier", remote_space_uri); while (true) { try { using (XcoTransaction tx = space.BeginTransaction()) { Ei e = unbemalt.Dequeue(); Console.WriteLine("done"); e.Maler = this.id; e.Farbe = this.farbe; bemalt.Enqueue(e); tx.Commit(); } } catch (Exception e) { Console.WriteLine("Timeout"); } if (Console.KeyAvailable) { return; } } }
public override void real_work() { SQueue <Nest> eingang = new SQueue <Nest>(this.space, "Nester", remote_space_uri); SQueue <Nest> ausgang = new SQueue <Nest>(this.space, "Ausgeliefert", remote_space_uri); while (true) { try { using (XcoTransaction tx = space.BeginTransaction()) { Nest n = eingang.Dequeue(); ausgang.Enqueue(n); tx.Commit(); } } catch (Exception e) { } // Dequeue operations have a timeout to allow the following lines to quit the programm nicely. if (Console.KeyAvailable) { return; } } }
public override void real_work() { SQueue <SchokoHase> q = new SQueue <SchokoHase>(this.space, "SchokoHasen", remote_space_uri); for (int i = 0; i < this.count; i++) { q.Enqueue(new SchokoHase(id + "_" + i.ToString(), id)); } }
public override void real_work() { SQueue <Ei> q = new SQueue <Ei>(this.space, "UnbemalteEier", remote_space_uri); for (int i = 0; i < this.count; i++) { q.Enqueue(new Ei(id + "_" + i.ToString(), id)); } }