Preparing things for OpenJDK 11

This commit is contained in:
jamesagnew 2018-12-08 17:52:48 -05:00
parent 5a80e70d93
commit 3a3b81a6a8
13 changed files with 83 additions and 29 deletions

View File

@ -8,7 +8,7 @@ dist: trusty
language: java
jdk:
- oraclejdk9
- openjdk11
env:
global:
- MAVEN_OPTS="-Xmx10244M -Xss128M -XX:MetaspaceSize=512M -XX:MaxMetaspaceSize=1024M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC"

View File

@ -20,7 +20,13 @@ package ca.uhn.fhir.util;
* #L%
*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.ConnectException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.LinkedHashSet;
/**
@ -28,6 +34,7 @@ import java.util.LinkedHashSet;
*/
@CoverageIgnore
public class PortUtil {
private static final Logger ourLog = LoggerFactory.getLogger(PortUtil.class);
private static LinkedHashSet<Integer> ourPorts = new LinkedHashSet<>();
/*
@ -41,20 +48,32 @@ public class PortUtil {
* This is really only used for unit tests but is included in the library so it can be reused across modules. Use with caution.
*/
public static int findFreePort() {
ServerSocket server;
try {
int port;
do {
server = new ServerSocket(0);
try (ServerSocket server = new ServerSocket(0)) {
server.setReuseAddress(true);
port = server.getLocalPort();
server.close();
}
} while (!ourPorts.add(port));
Thread.sleep(500);
// Make sure that we can't connect to the server, meaning the port is
// successfully released
for (int i = 0; i < 20; i++) {
Socket connector = new Socket();
try {
connector.connect(new InetSocketAddress(port));
} catch (ConnectException e) {
break;
}
ourLog.info("Port {} is still in use - Waiting...", port);
Thread.sleep(250);
}
Thread.sleep(1000);
return port;
} catch (Exception e) {
//FIXME resource leak
throw new Error(e);
}
}

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.model.entity;
/*-
* #%L
* HAPI FHIR Model
* %%
* Copyright (C) 2014 - 2018 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import java.io.Serializable;
public abstract class BaseResourceIndex implements Serializable {

View File

@ -84,7 +84,6 @@
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
@ -108,6 +107,12 @@
<artifactId>jscience</artifactId>
</dependency>
<!-- Java -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<!-- Testing -->
<dependency>

View File

@ -88,6 +88,12 @@
<scope>test</scope>
</dependency>
<!-- Java -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<!-- Spring -->
<dependency>
<groupId>aopalliance</groupId>

10
pom.xml
View File

@ -538,8 +538,8 @@
<servicemix_saxon_version>9.5.1-5_1</servicemix_saxon_version>
<servicemix_xmlresolver_version>1.2_5</servicemix_xmlresolver_version>
<slf4j_version>1.7.25</slf4j_version>
<spring_version>5.0.8.RELEASE</spring_version>
<spring_data_version>2.0.7.RELEASE</spring_data_version>
<spring_version>5.1.3.RELEASE</spring_version>
<spring_data_version>2.1.3.RELEASE</spring_data_version>
<spring-boot.version>1.5.6.RELEASE</spring-boot.version>
<stax2_api_version>3.1.4</stax2_api_version>
@ -628,7 +628,7 @@
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.3.1</version>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@ -1359,7 +1359,7 @@
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.3.1</version>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@ -2222,8 +2222,10 @@
<module>hapi-fhir-cli</module>
<module>hapi-fhir-dist</module>
<module>examples</module>
<!--
<module>osgi/hapi-fhir-karaf-features</module>
<module>osgi/hapi-fhir-karaf-integration-tests</module>
-->
<module>example-projects/hapi-fhir-base-example-embedded-ws</module>
<module>example-projects/hapi-fhir-standalone-overlay-example</module>
<module>example-projects/hapi-fhir-jpaserver-cds-example</module>

View File

@ -12,6 +12,8 @@
latest versions (dependent HAPI modules listed in brackets):
<![CDATA[
<ul>
<li>Spring (JPA): 5.0.8 -&gt; 5.1.3</li>
<li>Spring Data (JPA): 2.0.7 -&gt; 2.1.3</li>
<li>thymeleaf-spring4 (Testpage Overlay) has been replaced with thymeleaf-spring5</li>
</ul>
]]>