简体   繁体   English

WLP的Microprofile Fault Tolerance隔板实施未启动

[英]WLPs Microprofile Fault Tolerance bulkhead implementation not kicking in

Trying to test the Microprofile Fault Tolerance in WebSphere Liberty (WebSphere Application Server 18.0.0.3/wlp-1.0.22.cl180320180905-2337) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_161-b12 (en_US) but i cannot get the bulkhead logic to kick in. 尝试在Java HotSpot(TM)64位服务器VM版本1.8.0_161-b12(en_US)上测试WebSphere Liberty(WebSphere Application Server 18.0.0.3/wlp-1.0.22.cl180320180905905-2337)中的微概要文件容错我无法了解舱壁逻辑。

Created a REST resource: 创建了一个REST资源:

import org.eclipse.microprofile.faulttolerance.Bulkhead;

@Path("bulk")
public class BulkheadResource {

    @GET
    @Bulkhead(1)
    public String getBulk() {
        return getMessage();
    }

    private String getMessage() {
        String vMessage = "Start: " + System.currentTimeMillis();
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return vMessage;
    }
}

And calls it from JMeter with 3 threads. 并通过3个线程从JMeter调用它。 My expectation was that the first call would work fine but 2nd and 3rd would fail since call one was hogging the only thread and the bulkhead would work. 我的期望是,第一个调用可以正常工作,但是第二个和第三个调用将失败,因为调用一个正在占用唯一的线程,并且隔板可以工作。

Instead after 5s all three threads returned a 200 response: 在5s之后,所有三个线程都返回了200响应:

timeStamp   elapsed label   responseCode    threadName  grpThreads
1539095137936   5057    GET Bulk    200 Micro Profile 1-1   3
1539095138272   5041    GET Bulk    200 Micro Profile 1-2   2
1539095138608   5029    GET Bulk    200 Micro Profile 1-3   1

Server.xml: 在server.xml:

<featureManager>
    <feature>microProfile-2.0</feature>
    <feature>localConnector-1.0</feature>
</featureManager>

Any ideas? 有任何想法吗?

The circuitBreaker is linked to the instance. circuitBreaker链接到实例。 In your example, your bean is dependent scoped and it has its own circuit breaker per request. 在您的示例中,您的bean是依赖作用域的,并且每个请求都有自己的断路器。 If you change to ApplicationScoped, you should see what you expected happening. 如果更改为ApplicationScoped,则应该看到预期的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM