List of usage examples for org.springframework.amqp.rabbit.stocks.domain Quote getTimestamp
public long getTimestamp()
From source file:org.springframework.amqp.rabbit.stocks.web.QuoteController.java
public void handleQuote(Quote message) { logger.info("Client received: " + message); long timestamp = System.currentTimeMillis() - timeout; for (Iterator<Quote> iterator = quotes.iterator(); iterator.hasNext();) { Quote quote = iterator.next(); if (quote.getTimestamp() < timestamp) { iterator.remove();// ww w . j a va 2 s . c om } } quotes.add(message); }
From source file:org.springframework.amqp.rabbit.stocks.web.QuoteController.java
@RequestMapping("/quotes") @ResponseBody//from w ww . j a v a2 s . c o m public List<Quote> quotes(@RequestParam(required = false) Long timestamp) { if (timestamp == null) { timestamp = 0L; } ArrayList<Quote> list = new ArrayList<Quote>(); for (Quote quote : quotes) { if (quote.getTimestamp() > timestamp) { list.add(quote); } } Collections.reverse(list); return list; }