Changeset 5 for src/main/java
- Timestamp:
- 09/24/19 14:13:25 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/geniusweb/partiesserver/websocket/PartiesListSocket.java
r1 r5 46 46 private AvailablePartiesRepo repo; 47 47 private SendBuffer outstream; 48 private static transient String hostport = ""; // cache 48 49 49 50 public PartiesListSocket() { … … 140 141 private String getIpAddressAndPort() 141 142 throws UnknownHostException, MalformedObjectNameException { 143 synchronized (hostport) { 144 if (hostport.isEmpty()) { 145 MBeanServer beanServer = ManagementFactory 146 .getPlatformMBeanServer(); 142 147 143 MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer(); 148 Set<ObjectName> objectNames = beanServer.queryNames( 149 new ObjectName("*:type=Connector,*"), 150 Query.match(Query.attr("protocol"), 151 Query.value("HTTP/1.1"))); 144 152 145 Set<ObjectName> objectNames = beanServer.queryNames(146 new ObjectName("*:type=Connector,*"),147 Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));153 String host = InetAddress.getLocalHost().getHostAddress(); 154 String port = objectNames.iterator().next() 155 .getKeyProperty("port"); 148 156 149 String host = InetAddress.getLocalHost().getHostAddress();150 String port = objectNames.iterator().next().getKeyProperty("port");151 152 return host + ":" + port;157 hostport = host + ":" + port; 158 } 159 return hostport; 160 } 153 161 154 162 }
Note:
See TracChangeset
for help on using the changeset viewer.