Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 764 | blopes | 1 | package br.com.sl.domain.dto.robo; |
| 2 | |||
| 3 | import java.util.ArrayList; |
||
| 4 | import java.util.List; |
||
| 5 | import java.util.Queue; |
||
| 6 | import java.util.concurrent.ConcurrentLinkedQueue; |
||
| 7 | |||
| 8 | import javax.inject.Singleton; |
||
| 9 | |||
| 10 | import org.springframework.stereotype.Service; |
||
| 11 | |||
| 12 | @Singleton |
||
| 13 | @Service |
||
| 14 | public class AlertaPadraoService { |
||
| 15 | |||
| 16 | private static final Queue<String> FILA_ALERTAS = new ConcurrentLinkedQueue<>(); |
||
| 17 | |||
| 18 | public static void novoAlerta(String mensagem) { |
||
| 19 | FILA_ALERTAS.add(mensagem); |
||
| 20 | } |
||
| 21 | |||
| 22 | public static List<String> consumirAlertas() { |
||
| 23 | List<String> alertas = new ArrayList<>(); |
||
| 24 | String msg; |
||
| 25 | while ((msg = FILA_ALERTAS.poll()) != null) { |
||
| 26 | alertas.add(msg); |
||
| 27 | } |
||
| 28 | return alertas; |
||
| 29 | } |
||
| 30 | |||
| 31 | } |