Skip to content

Commit 83f501d

Browse files
committed
Fix Checkstyle warnings
Signed-off-by: Thiago Henrique Hüpner <[email protected]>
1 parent b44368c commit 83f501d

File tree

10 files changed

+114
-13
lines changed

10 files changed

+114
-13
lines changed

appserver/microprofile/health-glassfish/src/main/java/org/glassfish/microprofile/health/service/CollectHealthChecksExtension.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import jakarta.enterprise.inject.spi.Extension;
2525
import jakarta.enterprise.inject.spi.ProcessBean;
2626

27+
import java.lang.ref.Cleaner;
2728
import java.util.Collections;
2829
import java.util.HashSet;
2930
import java.util.Set;
@@ -44,6 +45,8 @@
4445

4546
public class CollectHealthChecksExtension implements Extension {
4647

48+
private static final Cleaner CLEANER = Cleaner.create();
49+
4750
private final HealthReporter service;
4851
private final Set<HealthCheckBeanAndKind> healthChecks = Collections.newSetFromMap(new ConcurrentHashMap<>());
4952
private final InvocationManager invocationManager;
@@ -86,10 +89,13 @@ public <T> void processBeans(@Observes ProcessBean<T> beans) {
8689
}
8790

8891
public void afterDeploymentValidation(@Observes AfterDeploymentValidation adv, BeanManager beanManager) {
89-
healthChecks.forEach(bean -> {
90-
CreationalContext<HealthCheck> creationalContext = beanManager.createCreationalContext(bean.bean());
92+
healthChecks.forEach(healthCheckBeanAndKind -> {
93+
Bean<HealthCheck> bean = healthCheckBeanAndKind.bean();
94+
CreationalContext<HealthCheck> creationalContext = beanManager.createCreationalContext(bean);
95+
HealthCheck healthCheck = bean.create(creationalContext);
96+
9197
service.addHealthCheck(invocationManager.getCurrentInvocation().getAppName(),
92-
new HealthCheckInfo(bean.bean().create(creationalContext), bean.kind()));
98+
new HealthCheckInfo(healthCheck, healthCheckBeanAndKind.kind()));
9399
});
94100
}
95101
}

appserver/microprofile/health-glassfish/src/main/java/org/glassfish/microprofile/health/service/HealthService.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
/*
2+
* Copyright (c) 2024 Contributors to Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* This Source Code may also be made available under the following Secondary
9+
* Licenses when the conditions for such availability set forth in the
10+
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11+
* version 2 with the GNU Classpath Exception, which is available at
12+
* https://www.gnu.org/software/classpath/license.html.
13+
*
14+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15+
*/
116
package org.glassfish.microprofile.health.service;
217

3-
418
import jakarta.inject.Inject;
519

620
import org.glassfish.api.StartupRunLevel;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2024 Contributors to Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* This Source Code may also be made available under the following Secondary
9+
* Licenses when the conditions for such availability set forth in the
10+
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11+
* version 2 with the GNU Classpath Exception, which is available at
12+
* https://www.gnu.org/software/classpath/license.html.
13+
*
14+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15+
*/
16+
package org.glassfish.microprofile.health.service;

appserver/microprofile/health/src/main/java/org/glassfish/microprofile/health/HealthReporter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.glassfish.microprofile.health;
1717

18+
import jakarta.enterprise.inject.spi.CDI;
1819
import jakarta.inject.Singleton;
1920

2021
import java.util.Collection;
@@ -112,6 +113,8 @@ public void addHealthCheck(String contextName, HealthCheckInfo healthCheck) {
112113
}
113114

114115
public void removeAllHealthChecksFrom(String contextName) {
116+
List<HealthCheckInfo> healthCheckInfos = applicationHealthChecks.get(contextName);
117+
healthCheckInfos.forEach(healthCheck -> CDI.current().destroy(healthCheck));
115118
applicationHealthChecks.remove(contextName);
116119
}
117120

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2024 Contributors to Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* This Source Code may also be made available under the following Secondary
9+
* Licenses when the conditions for such availability set forth in the
10+
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11+
* version 2 with the GNU Classpath Exception, which is available at
12+
* https://www.gnu.org/software/classpath/license.html.
13+
*
14+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15+
*/
16+
package org.glassfish.microprofile.health;

appserver/tests/tck/microprofile/health/src/main/java/org/glassfish/microprofile/health/tck/HealthArquillianExtension.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package org.glassfish.microprofile.health.tck;
1717

18-
import java.net.URI;
1918
import java.util.logging.Logger;
2019

2120
import org.glassfish.microprofile.health.tck.client.BeansXmlTransformer;

appserver/tests/tck/microprofile/health/src/main/java/org/glassfish/microprofile/health/tck/client/BeansXmlTransformer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
*/
1616
package org.glassfish.microprofile.health.tck.client;
1717

18+
import java.net.URL;
19+
import java.util.Optional;
20+
import java.util.function.Consumer;
21+
import java.util.logging.Logger;
22+
1823
import org.jboss.arquillian.container.spi.event.container.BeforeDeploy;
1924
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
2025
import org.jboss.arquillian.core.api.annotation.Observes;
@@ -25,11 +30,6 @@
2530
import org.jboss.shrinkwrap.api.asset.ArchiveAsset;
2631
import org.jboss.shrinkwrap.api.asset.UrlAsset;
2732

28-
import java.net.URL;
29-
import java.util.Optional;
30-
import java.util.function.Consumer;
31-
import java.util.logging.Logger;
32-
3333
import static java.lang.String.format;
3434

3535
/**

appserver/tests/tck/microprofile/health/src/main/java/org/glassfish/microprofile/health/tck/client/RootResourceProvider.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1+
/*
2+
* Copyright (c) 2024 Contributors to Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* This Source Code may also be made available under the following Secondary
9+
* Licenses when the conditions for such availability set forth in the
10+
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11+
* version 2 with the GNU Classpath Exception, which is available at
12+
* https://www.gnu.org/software/classpath/license.html.
13+
*
14+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15+
*/
116
package org.glassfish.microprofile.health.tck.client;
217

3-
import org.jboss.arquillian.container.test.impl.enricher.resource.URIResourceProvider;
4-
import org.jboss.arquillian.test.api.ArquillianResource;
5-
618
import java.lang.annotation.Annotation;
719
import java.net.URI;
820
import java.net.URISyntaxException;
921

22+
import org.jboss.arquillian.container.test.impl.enricher.resource.URIResourceProvider;
23+
import org.jboss.arquillian.test.api.ArquillianResource;
24+
1025
public class RootResourceProvider extends URIResourceProvider {
1126

1227
@Override
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2024 Contributors to Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* This Source Code may also be made available under the following Secondary
9+
* Licenses when the conditions for such availability set forth in the
10+
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11+
* version 2 with the GNU Classpath Exception, which is available at
12+
* https://www.gnu.org/software/classpath/license.html.
13+
*
14+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15+
*/
16+
package org.glassfish.microprofile.health.tck.client;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2024 Contributors to Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* This Source Code may also be made available under the following Secondary
9+
* Licenses when the conditions for such availability set forth in the
10+
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11+
* version 2 with the GNU Classpath Exception, which is available at
12+
* https://www.gnu.org/software/classpath/license.html.
13+
*
14+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15+
*/
16+
package org.glassfish.microprofile.health.tck;

0 commit comments

Comments
 (0)