1 package net.walend.somnifugi; 2 3 import java.io.Serializable ; 4 5 import java.util.Date ; 6 7 13 14 @SuppressWarnings ("serial") 15 public class SomniConsumerReport 16 implements Serializable 17 { 18 private final int messageCountGuess; 19 private final long pendingMessageTimestamp; 20 21 SomniConsumerReport(int messageCountGuess,long pendingMessageTimestamp) 22 { 23 this.messageCountGuess = messageCountGuess; 24 this.pendingMessageTimestamp = pendingMessageTimestamp; 25 } 26 27 30 public int getMessageCountGuess() 31 { 32 return messageCountGuess; 33 } 34 35 38 public long getPendingMessageTimestamp() 39 { 40 return pendingMessageTimestamp; 41 } 42 43 public String toString() 44 { 45 StringBuilder builder = new StringBuilder (); 46 builder.append(Integer.toString(messageCountGuess)); 47 builder.append(" pending messages"); 48 if((messageCountGuess>0) && (pendingMessageTimestamp!=0)) 49 { 50 builder.append(", the next one sent at "); 51 builder.append(new Date (pendingMessageTimestamp)); 52 } 53 return builder.toString(); 54 } 55 } 56 57 79 80 81 82 | Popular Tags |