com.alibaba.csp.sentinel.slots.block.SentinelRpcException Java Examples
The following examples show how to use
com.alibaba.csp.sentinel.slots.block.SentinelRpcException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultSofaRpcFallbackTest.java From Sentinel with Apache License 2.0 | 6 votes |
@Test public void testHandle() { SofaRpcFallback sofaRpcFallback = new DefaultSofaRpcFallback(); BlockException blockException = mock(BlockException.class); boolean throwSentinelRpcException = false; boolean causeIsBlockException = false; try { sofaRpcFallback.handle(null, null, blockException); } catch (Exception e) { throwSentinelRpcException = e instanceof SentinelRpcException; causeIsBlockException = e.getCause() instanceof BlockException; } assertTrue(throwSentinelRpcException); assertTrue(causeIsBlockException); }
Example #2
Source File: DemoController.java From sentinel-guides with Apache License 2.0 | 5 votes |
@GetMapping("/hello") public String apiSayHello(@RequestParam String name) { try { return fooService.sayHello(name); } catch (SentinelRpcException e) { e.getCause().printStackTrace(); return "oops, blocked by Sentinel..."; } catch (Exception ex) { ex.printStackTrace(); return "oops..."; } }
Example #3
Source File: DemoController.java From sentinel-guides with Apache License 2.0 | 5 votes |
@GetMapping("/time") public long apiCurrentTime() { try { return fooService.getCurrentTime(); } catch (SentinelRpcException e) { e.getCause().printStackTrace(); return -2; } catch (Exception ex) { ex.printStackTrace(); return -1; } }
Example #4
Source File: DubboFallbackRegistryTest.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
@Test(expected = SentinelRpcException.class) public void testDefaultFallback() { // Test for default. BlockException ex = new FlowException("xxx"); DubboFallbackRegistry.getConsumerFallback() .handle(null, null, ex); }
Example #5
Source File: DubboFallbackRegistryTest.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
@Test(expected = SentinelRpcException.class) public void testDefaultFallback() { // Test for default. BlockException ex = new FlowException("xxx"); DubboFallbackRegistry.getConsumerFallback() .handle(null, null, ex); }
Example #6
Source File: DubboFallbackRegistryTest.java From dubbo-sentinel-support with Apache License 2.0 | 5 votes |
@Test(expected = SentinelRpcException.class) public void testDefaultFallback() { // Test for default. BlockException ex = new FlowException("xxx"); DubboFallbackRegistry.getConsumerFallback() .handle(null, null, ex); }
Example #7
Source File: DubboFallbackRegistryTest.java From Sentinel with Apache License 2.0 | 5 votes |
@Test(expected = SentinelRpcException.class) public void testDefaultFallback() { // Test for default. BlockException ex = new FlowException("xxx"); DubboFallbackRegistry.getConsumerFallback() .handle(null, null, ex); }
Example #8
Source File: DubboFallbackRegistryTest.java From Sentinel with Apache License 2.0 | 5 votes |
@Test(expected = SentinelRpcException.class) public void testDefaultFallback() { // Test for default. BlockException ex = new FlowException("xxx"); DubboFallbackRegistry.getConsumerFallback() .handle(null, null, ex); }
Example #9
Source File: DefaultDubboFallback.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 4 votes |
@Override public Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex) { // Just wrap and throw the exception. throw new SentinelRpcException(ex); }
Example #10
Source File: DefaultDubboFallback.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 4 votes |
@Override public Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex) { // Just wrap and throw the exception. throw new SentinelRpcException(ex); }
Example #11
Source File: DefaultDubboFallback.java From dubbo-sentinel-support with Apache License 2.0 | 4 votes |
@Override public Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex) { // Just wrap and throw the exception. throw new SentinelRpcException(ex); }
Example #12
Source File: DefaultDubboFallback.java From Sentinel with Apache License 2.0 | 4 votes |
@Override public Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex) { // Just wrap and throw the exception. throw new SentinelRpcException(ex); }
Example #13
Source File: DefaultOkHttpFallback.java From Sentinel with Apache License 2.0 | 4 votes |
@Override public Response handle(Request request, Connection connection, BlockException e) { // Just wrap and throw the exception. throw new SentinelRpcException(e); }
Example #14
Source File: OkHttpFallbackTest.java From Sentinel with Apache License 2.0 | 4 votes |
@Test(expected = SentinelRpcException.class) public void testDefaultOkHttpFallback() { BlockException e = new FlowException("xxx"); OkHttpFallback fallback = new DefaultOkHttpFallback(); fallback.handle(null, null, e); }
Example #15
Source File: DefaultSofaRpcFallback.java From Sentinel with Apache License 2.0 | 4 votes |
@Override public SofaResponse handle(FilterInvoker invoker, SofaRequest request, BlockException ex) { // Just wrap and throw the exception. throw new SentinelRpcException(ex); }
Example #16
Source File: DefaultDubboFallback.java From Sentinel with Apache License 2.0 | 4 votes |
@Override public Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex) { // Just wrap and throw the exception. throw new SentinelRpcException(ex); }