Skip to content

Commit

Permalink
[TOMEE-4400] Remove openejb.jaxb.fastBoot
Browse files Browse the repository at this point in the history
  • Loading branch information
jungm committed Sep 13, 2024
1 parent a2040d5 commit 0844703
Showing 1 changed file with 5 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,9 @@
import java.util.logging.Level;

public final class JAXBContextFactory {
private static final boolean USE_FAST_BOOT = "true".equals(System.getProperty("openejb.jaxb.fastBoot", "true"));
private static final String FAST_BOOT = "com.sun.xml.bind.v2.runtime.JAXBContextImpl.fastBoot";

private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(JAXBContextFactory.class.getName());
// private static boolean useSXC = false;

private static String setFastBoot() {
final String fastBoot = System.getProperty(FAST_BOOT);
if (USE_FAST_BOOT) {
System.setProperty(FAST_BOOT, Boolean.TRUE.toString());
}
return fastBoot;
}

private static void resetFastBoot(final String fastBoot) {
if (USE_FAST_BOOT) {
if (fastBoot == null) {
System.clearProperty(FAST_BOOT);
} else {
System.setProperty(FAST_BOOT, fastBoot);
}
}
}

public static JAXBContext newInstance(final String s) throws JAXBException {
// if (useSXC) {
Expand All @@ -57,12 +37,7 @@ public static JAXBContext newInstance(final String s) throws JAXBException {
// }
final Event event = Event.start(s);
try {
final String fastBoot = setFastBoot();
try {
return JAXBContext.newInstance(s);
} finally {
resetFastBoot(fastBoot);
}
return JAXBContext.newInstance(s);
} finally {
event.stop();
}
Expand All @@ -78,12 +53,7 @@ public static JAXBContext newInstance(final String s, final ClassLoader classLoa

final Event event = Event.start(s);
try {
final String fastBoot = setFastBoot();
try {
return JAXBContext.newInstance(s, classLoader);
} finally {
resetFastBoot(fastBoot);
}
return JAXBContext.newInstance(s, classLoader);
} finally {
event.stop();
}
Expand All @@ -99,12 +69,7 @@ public static JAXBContext newInstance(final String s, final ClassLoader classLoa

final Event event = Event.start(s);
try {
final String fastBoot = setFastBoot();
try {
return JAXBContext.newInstance(s, classLoader, properties);
} finally {
resetFastBoot(fastBoot);
}
return JAXBContext.newInstance(s, classLoader, properties);
} finally {
event.stop();
}
Expand All @@ -125,14 +90,7 @@ public static JAXBContext newInstance(final Class... classes) throws JAXBExcepti
sb.deleteCharAt(sb.length() - 1);
final Event event = Event.start(sb.toString());
try {
final String fastBoot = setFastBoot();
try {
return JAXBContext.newInstance(classes);
} catch (final LinkageError ignore) {
return JAXBContext.newInstance(classes);
} finally {
resetFastBoot(fastBoot);
}
return JAXBContext.newInstance(classes);
} finally {
event.stop();
}
Expand All @@ -154,12 +112,7 @@ public static JAXBContext newInstance(final Class[] classes, final Map<String, ?
sb.deleteCharAt(sb.length() - 1);
final Event event = Event.start(sb.toString());
try {
final String fastBoot = setFastBoot();
try {
return JAXBContext.newInstance(classes, properties);
} finally {
resetFastBoot(fastBoot);
}
return JAXBContext.newInstance(classes, properties);
} finally {
event.stop();
}
Expand Down

0 comments on commit 0844703

Please sign in to comment.