Interface OneTimeInitializerPredicate

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface OneTimeInitializerPredicate
The presence of the service implementing this interface with runOnce() returning true means that ServletContainerInitializers are executed only once and the implementation doesn't have to care about cleaning up data collected based on previous call.

In some cases (e.g. OSGi) the ServletContainerInitializer.onStartup(java.util.Set, jakarta.servlet.ServletContext) method may be called several times for the application (with different classes provided). In this case the initializer logic should reset the data passed on the previous call and set the new data. To be able to reset the data correctly the ServletContainerInitializer implementation may need to store additional data between calls which is excessive if the ServletContainerInitializer.onStartup(java.util.Set, jakarta.servlet.ServletContext) is executed only once.

Since:
Author:
Vaadin Ltd
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks whether the ServletContainerInitializers requires reset to the previous state on ServletContainerInitializer.onStartup(java.util.Set, jakarta.servlet.ServletContext) call.
  • Method Details

    • runOnce

      boolean runOnce()
      Checks whether the ServletContainerInitializers requires reset to the previous state on ServletContainerInitializer.onStartup(java.util.Set, jakarta.servlet.ServletContext) call.
      Returns:
      true if ServletContainerInitializers are executed only once, false otherwise