Example usage for org.springframework.integration.channel FixedSubscriberChannel send

List of usage examples for org.springframework.integration.channel FixedSubscriberChannel send

Introduction

In this page you can find the example usage for org.springframework.integration.channel FixedSubscriberChannel send.

Prototype

@Override
    public boolean send(Message<?> message) 

Source Link

Usage

From source file:org.springframework.integration.channel.DirectChannelTests.java

@Test
public void testSendPerfFixedSubscriberChannel() {
    /*//from  w ww  .ja  va  2  s.c o  m
     *  INT-3308 - 96 million/sec
     *  NOTE: in order to get a measurable time, I had to add some code to the handler -
     *  presumably the JIT compiler short circuited the call becaues it's a final field
     *  and he knows the method does nothing.
     *  Added the same code to the other tests for comparison.
     */
    final AtomicInteger count = new AtomicInteger();
    FixedSubscriberChannel channel = new FixedSubscriberChannel(message -> count.incrementAndGet());
    GenericMessage<String> message = new GenericMessage<String>("test");
    assertTrue(channel.send(message));
    for (int i = 0; i < 100000000; i++) {
        channel.send(message, 0);
    }
}