예제 #1
0
 @Override
 public void handleNewObject(Object thing) {
   initMaybe();
   BalancingTransaction msg = (BalancingTransaction) thing;
   // contains kWH and charge
   Broker broker = msg.getBroker();
   if (brokerBal.keySet().contains(broker)) {
     double amt = msg.getCharge();
     brokerBal.put(broker, brokerBal.get(broker) + amt);
   }
 }
 /** Handles a BalancingTransaction message. */
 public synchronized void handleMessage(BalancingTransaction tx) {
   log.info("Balancing tx: " + tx.getCharge());
 }