Skip to content

Commit

Permalink
format the code
Browse files Browse the repository at this point in the history
  • Loading branch information
alaneuler committed Nov 12, 2020
1 parent 8490406 commit 34be4c1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
*/
@SpringBootTest
@RunWith(SpringRunner.class)
@TestPropertySource(properties = {"com.alipay.sofa.boot.disableJvmFirst=true",
@TestPropertySource(properties = { "com.alipay.sofa.boot.disableJvmFirst=true",
"com.alipay.sofa.boot.skipJvmReferenceHealthCheck=true",
"com.alipay.sofa.boot.skipJvmSerialize=true",
"com.alipay.sofa.boot.skipExtensionHealthCheck=true",
"com.alipay.sofa.boot.extensionFailureInsulating=true"})
"com.alipay.sofa.boot.extensionFailureInsulating=true" })
public class SofaRuntimePropertiesTest {

@Autowired
Expand Down Expand Up @@ -86,7 +86,7 @@ public void testSkipExtensionHealthCheckProperty() {
@Test
public void testExtensionFailureInsulating() {
SofaRuntimeConfigurationProperties configurationProperties = ctx
.getBean(SofaRuntimeConfigurationProperties.class);
.getBean(SofaRuntimeConfigurationProperties.class);

Assert.assertTrue(SofaRuntimeProperties.isSkipExtensionHealthCheck(ctx.getClassLoader()));
Assert.assertTrue(configurationProperties.isExtensionFailureInsulating());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class SofaRuntimeProperties {
private static final ConcurrentHashMap<ClassLoader, Boolean> skipJvmSerializeMap = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<ClassLoader, Boolean> extensionFailureInsulatingMap = new ConcurrentHashMap<>();

private static boolean jvmFilterEnable = false;
private static boolean jvmFilterEnable = false;

public static boolean isJvmFilterEnable() {
return jvmFilterEnable;
Expand All @@ -57,10 +57,12 @@ public static void setSkipJvmReferenceHealthCheck(ClassLoader classLoader,
}

public static boolean isExtensionFailureInsulating(ClassLoader classLoader) {
return extensionFailureInsulatingMap.get(classLoader) != null && extensionFailureInsulatingMap.get(classLoader);
return extensionFailureInsulatingMap.get(classLoader) != null
&& extensionFailureInsulatingMap.get(classLoader);
}

public static void setExtensionFailureInsulating(ClassLoader classLoader, boolean extensionFailureInsulating) {
public static void setExtensionFailureInsulating(ClassLoader classLoader,
boolean extensionFailureInsulating) {
extensionFailureInsulatingMap.putIfAbsent(classLoader, extensionFailureInsulating);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public boolean isSkipJvmReferenceHealthCheck() {
}

public void setExtensionFailureInsulating(boolean extensionFailureInsulating) {
SofaRuntimeProperties.setExtensionFailureInsulating(this.getClass().getClassLoader(), extensionFailureInsulating);
SofaRuntimeProperties.setExtensionFailureInsulating(this.getClass().getClassLoader(),
extensionFailureInsulating);
}

public boolean isExtensionFailureInsulating() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ private void loadContributions(ExtensionPoint extensionPoint, Extension extensio
.loadContributions((ExtensionInternal) extension);
((ExtensionInternal) extension).setContributions(contribs);
} catch (Exception e) {
if (SofaRuntimeProperties.isExtensionFailureInsulating(sofaRuntimeContext.getAppClassLoader())) {
if (SofaRuntimeProperties.isExtensionFailureInsulating(sofaRuntimeContext
.getAppClassLoader())) {
this.e = e;
}
SofaLogger.error("Failed to create contribution objects", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public void testUninstallEvent() {
Assert
.assertFalse(SofaRuntimeProperties.isSkipJvmReferenceHealthCheck(ctx.getClassLoader()));
Assert.assertFalse(SofaRuntimeProperties.isSkipExtensionHealthCheck(ctx.getClassLoader()));
Assert.assertFalse(SofaRuntimeProperties.isExtensionFailureInsulating(ctx.getClassLoader()));
Assert
.assertFalse(SofaRuntimeProperties.isExtensionFailureInsulating(ctx.getClassLoader()));
Assert.assertFalse(SofaRuntimeProperties.isSkipJvmSerialize(ctx.getClassLoader()));
Assert.assertTrue(SofaFramework.getRuntimeSet().isEmpty());
Assert.assertFalse(ctx.isActive());
Expand Down

0 comments on commit 34be4c1

Please sign in to comment.