Package com.netflix.hystrix.strategy.concurrency

Examples of com.netflix.hystrix.strategy.concurrency.HystrixRequestContext.shutdown()


            String log = HystrixRequestLog.getCurrentRequest().getExecutedCommandsAsString();
            // strip the actual count so we can compare reliably
            log = log.replaceAll(DIGITS_REGEX, "[");
            assertEquals("TestCommand[SUCCESS][ms], TestCommand[SUCCESS, RESPONSE_FROM_CACHE][ms]x4", log);
        } finally {
            context.shutdown();
        }
    }

    @Test
    public void testFailWithFallbackSuccess() {
View Full Code Here


            String log = HystrixRequestLog.getCurrentRequest().getExecutedCommandsAsString();
            // strip the actual count so we can compare reliably
            log = log.replaceAll(DIGITS_REGEX, "[");
            assertEquals("TestCommand[FAILURE, FALLBACK_SUCCESS][ms], TestCommand[FAILURE, FALLBACK_SUCCESS, RESPONSE_FROM_CACHE][ms]x4", log);
        } finally {
            context.shutdown();
        }
    }

    @Test
    public void testFailWithFallbackFailure() {
View Full Code Here

            String log = HystrixRequestLog.getCurrentRequest().getExecutedCommandsAsString();
            // strip the actual count so we can compare reliably
            log = log.replaceAll(DIGITS_REGEX, "[");
            assertEquals("TestCommand[FAILURE, FALLBACK_FAILURE][ms], TestCommand[FAILURE, FALLBACK_FAILURE, RESPONSE_FROM_CACHE][ms]", log);
        } finally {
            context.shutdown();
        }
    }

    @Test
    public void testMultipleCommands() {
View Full Code Here

            String log = HystrixRequestLog.getCurrentRequest().getExecutedCommandsAsString();
            // strip the actual count so we can compare reliably
            log = log.replaceAll(DIGITS_REGEX, "[");
            assertEquals("GetData[SUCCESS][ms], PutData[SUCCESS][ms], GetValues[SUCCESS][ms], GetValues[SUCCESS, RESPONSE_FROM_CACHE][ms], TestCommand[FAILURE, FALLBACK_FAILURE][ms], TestCommand[FAILURE, FALLBACK_FAILURE, RESPONSE_FROM_CACHE][ms]", log);
        } finally {
            context.shutdown();
        }

    }

    @Test
View Full Code Here

                new TestCommand("A", false, true).execute();
            }

            assertEquals(HystrixRequestLog.MAX_STORAGE, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size());
        } finally {
            context.shutdown();
        }
    }

    private static class TestCommand extends HystrixCommand<String> {
View Full Code Here

        System.out.println("timer.tasks.size() A: " + timer.tasks.size());
        System.out.println("tasks in test: " + timer.tasks);

        // simulate request lifecycle
        requestContext.shutdown();

        System.out.println("timer.tasks.size() B: " + timer.tasks.size());

        HystrixRequestVariableHolder<RequestCollapser<?, ?, ?>> rv = RequestCollapserFactory.getRequestVariable(new TestRequestCollapser(timer, counter, 1).getCollapserKey().name());
View Full Code Here

        for (TestCollapserTimer.ATask t : timer.tasks) {
            assertEquals(3, t.task.count.get());
        }

        // simulate request lifecycle
        requestContext.shutdown();

        HystrixRequestVariableHolder<RequestCollapser<?, ?, ?>> rv = RequestCollapserFactory.getRequestVariable(new TestRequestCollapser(timer, counter, 1).getCollapserKey().name());

        assertNotNull(rv);
        // they should have all been removed as part of ThreadContext.remove()
View Full Code Here

            assertEquals(2, (int) properties.keepAliveTimeMinutes().get());
            assertEquals(15, (int) properties.queueSizeRejectionThreshold().get());
            assertEquals(1440, (int) properties.metricsRollingStatisticalWindowInMilliseconds().get());
            assertEquals(12, (int) properties.metricsRollingStatisticalWindowBuckets().get());
        } finally {
            context.shutdown();
        }
    }

    @Test
    public void testGetUserDefaultPropertiesValues() {
View Full Code Here

            assertEquals("getUserDefProperties", command.getCommandKey().name());
            assertEquals("UserService", command.getCommandGroup().name());
            assertEquals("UserService", command.getThreadPoolKey().name());
            assertTrue(command.getExecutionEvents().contains(HystrixEventType.SUCCESS));
        } finally {
            context.shutdown();
        }
    }

    public static class UserService {
View Full Code Here

            // confirm that it was a COLLAPSED command execution
            assertTrue(command.getExecutionEvents().contains(HystrixEventType.COLLAPSED));
            // and that it was successful
            assertTrue(command.getExecutionEvents().contains(HystrixEventType.SUCCESS));
        } finally {
            context.shutdown();
        }
    }

    public static class UserService {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.