BrokerServer.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package com.yihu.hos.models;
  2. import org.springframework.data.annotation.Id;
  3. import org.springframework.data.mongodb.core.index.Indexed;
  4. import org.springframework.data.mongodb.core.mapping.Document;
  5. import java.util.Date;
  6. /**
  7. * @created Airhead 2016/7/27.
  8. */
  9. @Document
  10. public class BrokerServer {
  11. @Id
  12. private String id;
  13. private String hostName;
  14. private String hostAddress;
  15. private int port;
  16. @Indexed(name = "updateTime_1", expireAfterSeconds = 30)
  17. private Date updateTime;
  18. public String getId() {
  19. return id;
  20. }
  21. public void setId(String id) {
  22. this.id = id;
  23. }
  24. public int getPort() {
  25. return port;
  26. }
  27. public void setPort(int port) {
  28. this.port = port;
  29. }
  30. public Date getUpdateTime() {
  31. return updateTime;
  32. }
  33. public void setUpdateTime(Date updateTime) {
  34. this.updateTime = updateTime;
  35. }
  36. public String getHostName() {
  37. return hostName;
  38. }
  39. public void setHostName(String hostName) {
  40. this.hostName = hostName;
  41. }
  42. public String getHostAddress() {
  43. return hostAddress;
  44. }
  45. public void setHostAddress(String hostAddress) {
  46. this.hostAddress = hostAddress;
  47. }
  48. public String getURL() {
  49. return "http://" + hostAddress + ":" + port;
  50. }
  51. }