forked from eclipse-ee4j/glassfish
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part 2 for issue eclipse-ee4j#24900 Start with a new PoolManagertImpl…
… unit test to understand enlisted versus busy states of Resource handles and the wiring inside a transaction to keep track of all used resources.
- Loading branch information
Showing
7 changed files
with
565 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...tors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/InjectionUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2024 Eclipse Foundation and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
|
||
package com.sun.enterprise.resource.pool; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
public class InjectionUtil { | ||
|
||
/** | ||
* Use injection to fill in private fields in (final) classes. E.g. fields annotated with jakarta.inject.Inject. | ||
* | ||
* @param clazz the class to be altered | ||
* @param clazzInstance the instance of the class that needs to be altered | ||
* @param fieldName the name of the field in the class | ||
* @param fieldValue the new value for the field | ||
* @throws Exception if the injection of the value failed | ||
*/ | ||
public static void injectPrivateField(Class<?> clazz, Object clazzInstance, String fieldName, Object fieldValue) throws Exception { | ||
Field declaredField = clazz.getDeclaredField(fieldName); | ||
declaredField.setAccessible(true); | ||
declaredField.set(clazzInstance, fieldValue); | ||
} | ||
} |
Oops, something went wrong.