mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-12 05:39:00 +08:00
✨ Introducing new features. closed #4642 up seata-server 1.6.1
This commit is contained in:
1 parent
859a049646
commit
510061cc75
116 files changed
+12716
-8752
No files matched your search
+33
-34
@@ -29,48 +29,47 @@ import io.seata.core.constants.ConfigurationKeys;
|
||||
*/
|
||||
public class SystemPropertyLoggerContextListener extends ContextAwareBase implements LoggerContextListener, LifeCycle {
|
||||
|
||||
private boolean started = false;
|
||||
private boolean started = false;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (started) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void start() {
|
||||
if (started) {
|
||||
return;
|
||||
}
|
||||
|
||||
Context context = getContext();
|
||||
context.putProperty("PORT", System.getProperty(ConfigurationKeys.SERVER_PORT));
|
||||
Context context = getContext();
|
||||
context.putProperty("RPC_PORT", System.getProperty(ConfigurationKeys.SERVER_SERVICE_PORT_CAMEL));
|
||||
|
||||
started = true;
|
||||
}
|
||||
started = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
}
|
||||
@Override
|
||||
public void stop() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStarted() {
|
||||
return started;
|
||||
}
|
||||
@Override
|
||||
public boolean isStarted() {
|
||||
return started;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResetResistant() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isResetResistant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(LoggerContext context) {
|
||||
}
|
||||
@Override
|
||||
public void onStart(LoggerContext context) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReset(LoggerContext context) {
|
||||
}
|
||||
@Override
|
||||
public void onReset(LoggerContext context) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop(LoggerContext context) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLevelChange(Logger logger, Level level) {
|
||||
}
|
||||
@Override
|
||||
public void onStop(LoggerContext context) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLevelChange(Logger logger, Level level) {
|
||||
}
|
||||
}
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package io.seata.server.logging.logback;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.pattern.CompositeConverter;
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
import io.seata.server.logging.logback.ansi.AnsiColor;
|
||||
import io.seata.server.logging.logback.ansi.AnsiElement;
|
||||
import io.seata.server.logging.logback.ansi.AnsiOutput;
|
||||
import io.seata.server.logging.logback.ansi.AnsiStyle;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Logback {@link CompositeConverter} colors output using the {@link AnsiOutput} class. A
|
||||
* single 'color' option can be provided to the converter, or if not specified color will
|
||||
* be picked based on the logging level.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @origin Copied from spring-boot.jar by wang.liang
|
||||
*/
|
||||
public class ColorConverter extends CompositeConverter<ILoggingEvent> {
|
||||
|
||||
private static final Map<String, AnsiElement> ELEMENTS;
|
||||
|
||||
private static final String DISABLE_PROPERTY_NAME = "logback.color.disable-for-bat";
|
||||
|
||||
static {
|
||||
Map<String, AnsiElement> ansiElements = new HashMap<>();
|
||||
ansiElements.put("faint", AnsiStyle.FAINT);
|
||||
ansiElements.put("red", AnsiColor.RED);
|
||||
ansiElements.put("green", AnsiColor.GREEN);
|
||||
ansiElements.put("yellow", AnsiColor.YELLOW);
|
||||
ansiElements.put("blue", AnsiColor.BLUE);
|
||||
ansiElements.put("magenta", AnsiColor.MAGENTA);
|
||||
ansiElements.put("cyan", AnsiColor.CYAN);
|
||||
ELEMENTS = Collections.unmodifiableMap(ansiElements);
|
||||
}
|
||||
|
||||
private static final Map<Integer, AnsiElement> LEVELS;
|
||||
|
||||
static {
|
||||
Map<Integer, AnsiElement> ansiLevels = new HashMap<>();
|
||||
ansiLevels.put(Level.ERROR_INTEGER, AnsiColor.RED);
|
||||
ansiLevels.put(Level.WARN_INTEGER, AnsiColor.YELLOW);
|
||||
LEVELS = Collections.unmodifiableMap(ansiLevels);
|
||||
}
|
||||
|
||||
private final boolean disable;
|
||||
|
||||
public ColorConverter() {
|
||||
// If is windows and run by seata-server.bat, then disable the color log.
|
||||
disable = PlatformDependent.isWindows() && Boolean.parseBoolean(System.getProperty(DISABLE_PROPERTY_NAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transform(ILoggingEvent event, String in) {
|
||||
if (disable) {
|
||||
// return the original log
|
||||
return in;
|
||||
}
|
||||
|
||||
AnsiElement element = ELEMENTS.get(getFirstOption());
|
||||
if (element == null) {
|
||||
// Assume highlighting
|
||||
element = LEVELS.get(event.getLevel().toInteger());
|
||||
element = (element != null) ? element : AnsiColor.GREEN;
|
||||
}
|
||||
return toAnsiString(in, element);
|
||||
}
|
||||
|
||||
protected String toAnsiString(String in, AnsiElement element) {
|
||||
return AnsiOutput.toString(element, in);
|
||||
}
|
||||
|
||||
}
|
||||
+6
-8
@@ -22,16 +22,14 @@ import ch.qos.logback.core.CoreConstants;
|
||||
/**
|
||||
* {@link ExtendedThrowableProxyConverter} that adds some additional whitespace around the
|
||||
* stack trace.
|
||||
*
|
||||
* Copied from spring-boot-xxx.jar by wang.liang
|
||||
* @author Phillip Webb
|
||||
* @origin Copied from spring-boot.jar by wang.liang
|
||||
*/
|
||||
public class ExtendedWhitespaceThrowableProxyConverter extends ExtendedThrowableProxyConverter {
|
||||
|
||||
@Override
|
||||
protected String throwableProxyToString(IThrowableProxy tp) {
|
||||
return "==>" + CoreConstants.LINE_SEPARATOR + super.throwableProxyToString(tp) + "<=="
|
||||
+ CoreConstants.LINE_SEPARATOR + CoreConstants.LINE_SEPARATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String throwableProxyToString(IThrowableProxy tp) {
|
||||
return "==>" + CoreConstants.LINE_SEPARATOR + super.throwableProxyToString(tp)
|
||||
+ "<==" + CoreConstants.LINE_SEPARATOR + CoreConstants.LINE_SEPARATOR;
|
||||
}
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package io.seata.server.logging.logback;
|
||||
|
||||
import ch.qos.logback.classic.pattern.ThrowableProxyConverter;
|
||||
import ch.qos.logback.classic.spi.IThrowableProxy;
|
||||
import ch.qos.logback.core.CoreConstants;
|
||||
|
||||
/**
|
||||
* {@link ThrowableProxyConverter} that adds some additional whitespace around the
|
||||
* stacktrace.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @origin Copied from spring-boot.jar by wang.liang
|
||||
*/
|
||||
public class WhitespaceThrowableProxyConverter extends ThrowableProxyConverter {
|
||||
|
||||
@Override
|
||||
protected String throwableProxyToString(IThrowableProxy tp) {
|
||||
return CoreConstants.LINE_SEPARATOR + super.throwableProxyToString(tp) + CoreConstants.LINE_SEPARATOR
|
||||
+ CoreConstants.LINE_SEPARATOR;
|
||||
}
|
||||
|
||||
}
|
||||
-126
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package io.seata.server.logging.logback.ansi;
|
||||
|
||||
/**
|
||||
* {@link AnsiElement Ansi} colors.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Geoffrey Chandler
|
||||
* @origin Copied from spring-boot.jar by wang.liang
|
||||
*/
|
||||
public enum AnsiColor implements AnsiElement {
|
||||
|
||||
/**
|
||||
* default is light-grey
|
||||
*/
|
||||
DEFAULT("39"),
|
||||
|
||||
/**
|
||||
* black
|
||||
*/
|
||||
BLACK("30"),
|
||||
|
||||
/**
|
||||
* red
|
||||
*/
|
||||
RED("31"),
|
||||
|
||||
/**
|
||||
* green
|
||||
*/
|
||||
GREEN("32"),
|
||||
|
||||
/**
|
||||
* yellow
|
||||
*/
|
||||
YELLOW("33"),
|
||||
|
||||
/**
|
||||
* blue
|
||||
*/
|
||||
BLUE("34"),
|
||||
|
||||
/**
|
||||
* magenta
|
||||
*/
|
||||
MAGENTA("35"),
|
||||
|
||||
/**
|
||||
* cyan
|
||||
*/
|
||||
CYAN("36"),
|
||||
|
||||
/**
|
||||
* white
|
||||
*/
|
||||
WHITE("37"),
|
||||
|
||||
/**
|
||||
* bright black
|
||||
*/
|
||||
BRIGHT_BLACK("90"),
|
||||
|
||||
/**
|
||||
* bright red
|
||||
*/
|
||||
BRIGHT_RED("91"),
|
||||
|
||||
/**
|
||||
* bright green
|
||||
*/
|
||||
BRIGHT_GREEN("92"),
|
||||
|
||||
/**
|
||||
* bright yellow
|
||||
*/
|
||||
BRIGHT_YELLOW("93"),
|
||||
|
||||
/**
|
||||
* bright blue
|
||||
*/
|
||||
BRIGHT_BLUE("94"),
|
||||
|
||||
/**
|
||||
* bright magenta
|
||||
*/
|
||||
BRIGHT_MAGENTA("95"),
|
||||
|
||||
/**
|
||||
* bright cyan
|
||||
*/
|
||||
BRIGHT_CYAN("96"),
|
||||
|
||||
/**
|
||||
* bright white
|
||||
*/
|
||||
BRIGHT_WHITE("97");
|
||||
|
||||
/**
|
||||
* code of color
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
AnsiColor(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package io.seata.server.logging.logback.ansi;
|
||||
|
||||
/**
|
||||
* An ANSI encodable element.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @origin Copied from spring-boot.jar by wang.liang
|
||||
*/
|
||||
public interface AnsiElement {
|
||||
|
||||
/**
|
||||
* @return the ANSI escape code
|
||||
*/
|
||||
@Override
|
||||
String toString();
|
||||
|
||||
}
|
||||
-184
@@ -1,184 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package io.seata.server.logging.logback.ansi;
|
||||
|
||||
import com.alipay.lookout.common.Assert;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Generates ANSI encoded output, automatically attempting to detect if the terminal
|
||||
* supports ANSI.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @origin Copied from spring-boot.jar by wang.liang
|
||||
*/
|
||||
public class AnsiOutput {
|
||||
|
||||
private static final String ENCODE_JOIN = ";";
|
||||
|
||||
private static Enabled enabled = Enabled.ALWAYS;
|
||||
|
||||
private static Boolean consoleAvailable;
|
||||
|
||||
private static Boolean ansiCapable;
|
||||
|
||||
private static final String OPERATING_SYSTEM_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
|
||||
|
||||
private static final String ENCODE_START = "\033[";
|
||||
|
||||
private static final String ENCODE_END = "m";
|
||||
|
||||
private static final String RESET = "0;" + AnsiColor.DEFAULT;
|
||||
|
||||
/**
|
||||
* Sets if ANSI output is enabled.
|
||||
* @param enabled if ANSI is enabled, disabled or detected
|
||||
*/
|
||||
public static void setEnabled(Enabled enabled) {
|
||||
Assert.notNull(enabled, "Enabled must not be null");
|
||||
AnsiOutput.enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the System.console() is known to be available.
|
||||
* @param consoleAvailable if the console is known to be available or {@code null} to
|
||||
* use standard detection logic.
|
||||
*/
|
||||
public static void setConsoleAvailable(Boolean consoleAvailable) {
|
||||
AnsiOutput.consoleAvailable = consoleAvailable;
|
||||
}
|
||||
|
||||
static Enabled getEnabled() {
|
||||
return AnsiOutput.enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a single {@link AnsiElement} if output is enabled.
|
||||
* @param element the element to encode
|
||||
* @return the encoded element or an empty string
|
||||
*/
|
||||
public static String encode(AnsiElement element) {
|
||||
if (isEnabled()) {
|
||||
return ENCODE_START + element + ENCODE_END;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ANSI string from the specified elements. Any {@link AnsiElement}s will
|
||||
* be encoded as required.
|
||||
* @param elements the elements to encode
|
||||
* @return a string of the encoded elements
|
||||
*/
|
||||
public static String toString(Object... elements) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (isEnabled()) {
|
||||
buildEnabled(sb, elements);
|
||||
}
|
||||
else {
|
||||
buildDisabled(sb, elements);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static void buildEnabled(StringBuilder sb, Object[] elements) {
|
||||
boolean writingAnsi = false;
|
||||
boolean containsEncoding = false;
|
||||
for (Object element : elements) {
|
||||
if (element instanceof AnsiElement) {
|
||||
containsEncoding = true;
|
||||
if (!writingAnsi) {
|
||||
sb.append(ENCODE_START);
|
||||
writingAnsi = true;
|
||||
}
|
||||
else {
|
||||
sb.append(ENCODE_JOIN);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (writingAnsi) {
|
||||
sb.append(ENCODE_END);
|
||||
writingAnsi = false;
|
||||
}
|
||||
}
|
||||
sb.append(element);
|
||||
}
|
||||
if (containsEncoding) {
|
||||
sb.append(writingAnsi ? ENCODE_JOIN : ENCODE_START);
|
||||
sb.append(RESET);
|
||||
sb.append(ENCODE_END);
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildDisabled(StringBuilder sb, Object[] elements) {
|
||||
for (Object element : elements) {
|
||||
if (!(element instanceof AnsiElement) && element != null) {
|
||||
sb.append(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEnabled() {
|
||||
if (enabled == Enabled.DETECT) {
|
||||
if (ansiCapable == null) {
|
||||
ansiCapable = detectIfAnsiCapable();
|
||||
}
|
||||
return ansiCapable;
|
||||
}
|
||||
return enabled == Enabled.ALWAYS;
|
||||
}
|
||||
|
||||
private static boolean detectIfAnsiCapable() {
|
||||
try {
|
||||
if (Boolean.FALSE.equals(consoleAvailable)) {
|
||||
return false;
|
||||
}
|
||||
if ((consoleAvailable == null) && (System.console() == null)) {
|
||||
return false;
|
||||
}
|
||||
return !(OPERATING_SYSTEM_NAME.indexOf("win") >= 0);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible values to pass to {@link AnsiOutput#setEnabled}. Determines when to output
|
||||
* ANSI escape sequences for coloring application output.
|
||||
*/
|
||||
public enum Enabled {
|
||||
|
||||
/**
|
||||
* Try to detect whether ANSI coloring capabilities are available. The default
|
||||
* value for {@link AnsiOutput}.
|
||||
*/
|
||||
DETECT,
|
||||
|
||||
/**
|
||||
* Enable ANSI-colored output.
|
||||
*/
|
||||
ALWAYS,
|
||||
|
||||
/**
|
||||
* Disable ANSI-colored output.
|
||||
*/
|
||||
NEVER
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package io.seata.server.logging.logback.ansi;
|
||||
|
||||
/**
|
||||
* {@link AnsiElement Ansi} styles.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @origin Copied from spring-boot.jar by wang.liang
|
||||
*/
|
||||
public enum AnsiStyle implements AnsiElement {
|
||||
|
||||
/**
|
||||
* normal
|
||||
*/
|
||||
NORMAL("0"),
|
||||
|
||||
/**
|
||||
* bold
|
||||
*/
|
||||
BOLD("1"),
|
||||
|
||||
/**
|
||||
* faint
|
||||
*/
|
||||
FAINT("2"),
|
||||
|
||||
/**
|
||||
* italic
|
||||
*/
|
||||
ITALIC("3"),
|
||||
|
||||
/**
|
||||
* underline
|
||||
*/
|
||||
UNDERLINE("4");
|
||||
|
||||
/**
|
||||
* code of style
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
AnsiStyle(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
}
|
||||
+15
-15
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package io.seata.server.logging.logback.appender;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.logstash.logback.composite.JsonProvider;
|
||||
import net.logstash.logback.composite.JsonProviders;
|
||||
import net.logstash.logback.encoder.LogstashEncoder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* The type Enhanced logstash encoder
|
||||
*
|
||||
@@ -29,17 +29,17 @@ import net.logstash.logback.encoder.LogstashEncoder;
|
||||
*/
|
||||
public class EnhancedLogstashEncoder extends LogstashEncoder {
|
||||
|
||||
/**
|
||||
* set exclude provider
|
||||
* @param excludedProviderClassName the excluded provider class name
|
||||
*/
|
||||
public void setExcludeProvider(String excludedProviderClassName) {
|
||||
JsonProviders<?> providers = getFormatter().getProviders();
|
||||
for (JsonProvider<?> provider : new ArrayList<>(providers.getProviders())) {
|
||||
if (provider.getClass().getName().equals(excludedProviderClassName)) {
|
||||
providers.removeProvider((JsonProvider) provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set exclude provider
|
||||
*
|
||||
* @param excludedProviderClassName the excluded provider class name
|
||||
*/
|
||||
public void setExcludeProvider(String excludedProviderClassName) {
|
||||
JsonProviders<?> providers = getFormatter().getProviders();
|
||||
for (JsonProvider<?> provider : new ArrayList<>(providers.getProviders())) {
|
||||
if (provider.getClass().getName().equals(excludedProviderClassName)) {
|
||||
providers.removeProvider((JsonProvider) provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user