From 3a3b81a6a8d175761a207d686b4872e19de3564a Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sat, 8 Dec 2018 17:52:48 -0500 Subject: [PATCH] Preparing things for OpenJDK 11 --- .travis.yml | 2 +- .../main/java/ca/uhn/fhir/util/PortUtil.java | 41 ++++++++++++++----- .../jpa/model/entity/BaseResourceIndex.java | 20 +++++++++ .../ResourceIndexedSearchParamDate.java | 4 +- .../ResourceIndexedSearchParamNumber.java | 4 +- .../ResourceIndexedSearchParamQuantity.java | 4 +- .../ResourceIndexedSearchParamToken.java | 4 +- .../entity/ResourceIndexedSearchParamUri.java | 4 +- .../fhir/jpa/model/entity/ResourceLink.java | 4 +- hapi-fhir-jpaserver-searchparam/pom.xml | 7 +++- hapi-fhir-testpage-overlay/pom.xml | 6 +++ pom.xml | 10 +++-- src/changes/changes.xml | 2 + 13 files changed, 83 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 333caa4ff7f..4d29c64275c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java index 93e78db922d..93d709f5639 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.util; * 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. @@ -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 ourPorts = new LinkedHashSet<>(); /* @@ -35,26 +42,38 @@ public class PortUtil { */ private PortUtil() { // nothing - } - + } + /** * 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); - server.setReuseAddress(true); - port = server.getLocalPort(); - server.close(); + try (ServerSocket server = new ServerSocket(0)) { + server.setReuseAddress(true); + port = server.getLocalPort(); + } } 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); } } diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java index a80264671cc..c4eb9ad7df9 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java @@ -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 { diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java index e0c443fa4d6..9a81e0079c6 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * 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. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java index 31d29b78cdb..4a43d0eff09 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * 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. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java index 6689b07f10f..79960e20d73 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * 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. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java index 90a1fb1ce5e..10d17bcf611 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * 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. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java index 1cb54974855..bf3d7e969cb 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * 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. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java index 1c5c9ed537d..af7c517984d 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * 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. diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index 72b42149b2f..c5ee9d19bfd 100644 --- a/hapi-fhir-jpaserver-searchparam/pom.xml +++ b/hapi-fhir-jpaserver-searchparam/pom.xml @@ -84,7 +84,6 @@ - org.springframework spring-beans @@ -108,6 +107,12 @@ jscience + + + javax.annotation + javax.annotation-api + + diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index d377521707b..8d41fa54e58 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -88,6 +88,12 @@ test + + + javax.annotation + javax.annotation-api + + aopalliance diff --git a/pom.xml b/pom.xml index 39f7bc79476..6c42c31b450 100644 --- a/pom.xml +++ b/pom.xml @@ -538,8 +538,8 @@ 9.5.1-5_1 1.2_5 1.7.25 - 5.0.8.RELEASE - 2.0.7.RELEASE + 5.1.3.RELEASE + 2.1.3.RELEASE 1.5.6.RELEASE 3.1.4 @@ -628,7 +628,7 @@ com.google.errorprone error_prone_core - 2.3.1 + 2.3.2 com.google.guava @@ -1359,7 +1359,7 @@ com.google.errorprone error_prone_core - 2.3.1 + 2.3.2 org.codehaus.plexus @@ -2222,8 +2222,10 @@ hapi-fhir-cli hapi-fhir-dist examples + example-projects/hapi-fhir-base-example-embedded-ws example-projects/hapi-fhir-standalone-overlay-example example-projects/hapi-fhir-jpaserver-cds-example diff --git a/src/changes/changes.xml b/src/changes/changes.xml index fcb7c7624be..06a29cf65c1 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -12,6 +12,8 @@ latest versions (dependent HAPI modules listed in brackets): +
  • Spring (JPA): 5.0.8 -> 5.1.3
  • +
  • Spring Data (JPA): 2.0.7 -> 2.1.3
  • thymeleaf-spring4 (Testpage Overlay) has been replaced with thymeleaf-spring5
  • ]]>