Package edu.csusm.cs671.auction

Examples of edu.csusm.cs671.auction.ServerMain


      Work work = workQueue.peek();
     
      if(work == null) return; //No work to process
     
      printString("Current work queue size = " + workQueue.size());
      WorkPreferenceType preference = config.getWorkPreference(work.getWorkType());
       
      switch (preference) {
      case FIRST:
        processWork(work, FIRST_PREFERENCE_BURN_RATE, preference);
        break;
View Full Code Here


    String idTemp = props.getProperty("agentConfig.id");
    int id = Integer.parseInt(idTemp);
    result.setId(id);
   
    String workType0ne = props.getProperty("agentConfig.workPreference.one");
    WorkType workType1 = buildWorkType(workType0ne);
    result.setWorkPreference(workType1, WorkPreferenceType.FIRST);
   
   
    String workTypeTwo = props.getProperty("agentConfig.workPreference.two");
    WorkType workType2 = buildWorkType(workTypeTwo);
    result.setWorkPreference(workType2, WorkPreferenceType.SECOND);
   
    String workTypeThree = props.getProperty("agentConfig.workPreference.three");
    WorkType workType3 = buildWorkType(workTypeThree);
    result.setWorkPreference(workType3, WorkPreferenceType.THIRD);
   
    return result;
  }
View Full Code Here

    auctionMessage.setAuctionID(UUID.randomUUID());
    //auctionMessage.setTimeAuctionIsOpen(new Duration(10));
    auctionMessage.setWorkForAuction(work);
   
   
    MessageEvent messageEvent = new MessageEvent(auctionAgent, auctionMessage);
    auctionAgent.onMessageReceived(messageEvent);
   
   
  }
View Full Code Here

    auctionMessage.setAuctionID(UUID.randomUUID());
    auctionMessage.setWorkForAuction(work);
//    auction Message.setBidAmount(new Currency(100));
    auctionMessage.setAgentID(1);
   
    MessageEvent messageEvent = new MessageEvent(auctionAgent, auctionMessage);
    auctionAgent.onMessageReceived(messageEvent);
   
   
  }
View Full Code Here

    final AuctionMessage data = message;
   
    for (final AuctionMessageListener socketClientTextListener : tmp) {
      threadPool.execute(new Runnable() {
        public void run() {
          socketClientTextListener.onMessageReceived(new MessageEvent(source, data));
        }
      });
    }
   
  }
View Full Code Here

  private Timer timer;
 
 
  public AuctionAgentImpl(AgentConfig config) {
    this.workQueue = new LinkedBlockingQueue<Work>();
    this.client = new SocketClient(config.getPort(), config.getHost());
    this.client.addListener(this);
    this.client.setId(config.getId());
    this.config = config;
  }
View Full Code Here

  private volatile boolean listenning = false;


  public AuctioneerImpl (AuctioneerConfig config){

    server = new SocketServer();
    server.setPort(config.getPort());
    server.addListener(this);
    ExecutorService executor = Executors.newSingleThreadExecutor();
    executor.submit(server);
View Full Code Here

TOP

Related Classes of edu.csusm.cs671.auction.ServerMain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.