Class EventLoopExtension

java.lang.Object
com.linecorp.armeria.testing.junit5.common.AbstractAllOrEachExtension
com.linecorp.armeria.testing.junit5.common.EventLoopExtension
All Implemented Interfaces:
AfterAllCallback, AfterEachCallback, BeforeAllCallback, BeforeEachCallback, Extension

public class EventLoopExtension
extends AbstractAllOrEachExtension
An Extension that provides an EventLoopGroup. For example:

 > public class MyTest {
 >     @RegisterExtension
 >     public static final EventLoopExtension eventLoop = new EventLoopExtension();
 >
 >     @Test
 >     public void test() {
 >         eventLoop.get().execute(() -> System.out.println("Hello!"));
 >     }
 > }
 
See Also:
EventLoopGroupExtension
  • Constructor Details

    • EventLoopExtension

      public EventLoopExtension()
      Creates a new Extension that provides an EventLoop.
    • EventLoopExtension

      public EventLoopExtension​(boolean useDaemonThread)
      Creates a new Extension that provides an EventLoop.
      Parameters:
      useDaemonThread - whether to create a daemon thread or not
    • EventLoopExtension

      public EventLoopExtension​(String threadNamePrefix)
      Creates a new Extension that provides an EventLoop.
      Parameters:
      threadNamePrefix - the prefix of a thread name
    • EventLoopExtension

      public EventLoopExtension​(String threadNamePrefix, boolean useDaemonThread)
      Creates a new Extension that provides an EventLoop.
      Parameters:
      threadNamePrefix - the prefix of a thread name
      useDaemonThread - whether to create a daemon thread or not
  • Method Details