ApplicationConfig.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package com.ggits.etlp.server.config;
  2. import lombok.Data;
  3. import lombok.extern.slf4j.Slf4j;
  4. import org.springframework.boot.context.properties.ConfigurationProperties;
  5. import org.springframework.stereotype.Component;
  6. import javax.annotation.PostConstruct;
  7. @Slf4j
  8. @Data
  9. @Component
  10. @ConfigurationProperties(prefix = "application")
  11. public class ApplicationConfig {
  12. private String processId = "81010";
  13. private String ggitsServerIp = "192.168.24.22";
  14. private int dbmsWorkers = 0;
  15. private int dbmsQueueSize = 0;
  16. private boolean loggingHist = true;
  17. private int pageCount = 50000;
  18. @PostConstruct
  19. private void init() {
  20. if (this.dbmsWorkers == 0) {
  21. this.dbmsWorkers = Runtime.getRuntime().availableProcessors();
  22. if (this.dbmsWorkers == 0) this.dbmsWorkers = 1;
  23. }
  24. if (this.dbmsQueueSize <= 0) {
  25. this.dbmsQueueSize = 50000;
  26. }
  27. if (this.pageCount == 0) {
  28. this.pageCount = 10000;
  29. }
  30. if (this.pageCount < 1000) {
  31. this.pageCount = 1000;
  32. }
  33. this.pageCount = Math.min(100000, this.pageCount);
  34. log.info("[{}] -------------------------", this.getClass().getSimpleName());
  35. log.info("[{}] dbmsWorkers: {}", this.getClass().getSimpleName(), this.dbmsWorkers);
  36. log.info("[{}] dbmsQueueSize: {}", this.getClass().getSimpleName(), this.dbmsQueueSize);
  37. log.info("{}", super.toString());
  38. }
  39. }