source: src/main/java/onetomany/bargainingchipsgame/players/BilateralAgent.java@ 269

Last change on this file since 269 was 269, checked in by Tim Baarslag, 5 years ago

Started with concurrent BilateralAgent

File size: 761 bytes
Line 
1package onetomany.bargainingchipsgame.players;
2
3import java.util.concurrent.BlockingQueue;
4
5import onetomany.bargainingchipsgame.Bundle;
6import onetomany.bargainingchipsgame.interactions.Offer;
7
8public class BilateralAgent implements Runnable
9{
10 BlockingQueue<Offer> in;
11 BlockingQueue<Offer> out;
12
13 public BilateralAgent(BlockingQueue<Offer> in, BlockingQueue<Offer> out)
14 {
15 super();
16 this.in = in;
17 this.out = out;
18 }
19
20
21
22 @Override
23 public void run()
24 {
25 while (true)
26 {
27 Offer o;
28 try {
29 o = in.take();
30 Bundle bundle = o.getBundle();
31 System.out.println("Received " + bundle);
32 } catch (InterruptedException e) {
33 // TODO Auto-generated catch block
34 e.printStackTrace();
35 }
36 }
37
38 }
39
40}
Note: See TracBrowser for help on using the repository browser.