Class ErrorContextBuilder

    • Constructor Detail

      • ErrorContextBuilder

        public ErrorContextBuilder()
    • Method Detail

      • environment

        public ErrorContextBuilder environment​(io.dropwizard.setup.Environment environment)
        Sets the Dropwizard Environment to use with this builder.
        Parameters:
        environment - the Environment
        Returns:
        this builder
      • skipHealthCheck

        public ErrorContextBuilder skipHealthCheck()
        Configures the resulting ErrorContext so that it does not create/register a health check with Dropwizard.
        Returns:
        this builder
      • skipCleanupJob

        public ErrorContextBuilder skipCleanupJob()
        Configures the resulting ErrorContext so that it does not create/register a cleanup job with Dropwizard.
        Returns:
        this builder
      • timeWindow

        public ErrorContextBuilder timeWindow​(TimeWindow timeWindow)
        Configures the TimeWindow for the health check. If an error occurs within this time window, the health check will report as unhealthy. If there are no errors inside of this window, the health check will report as healthy.
        Parameters:
        timeWindow - the TimeWindow
        Returns:
        this builder
        Implementation Note:
        This will override any value set by timeWindowValue(long) and timeWindowUnit(TemporalUnit). Also, it will recast the values given in terms of minutes.
      • timeWindowValue

        public ErrorContextBuilder timeWindowValue​(long timeWindowValue)
        Configures the length of time for the health check. If an error occurs within this time window, the health check will report as unhealthy. If there are no errors inside of this window, the health check will report as healthy.
        Parameters:
        timeWindowValue - the length of time
        Returns:
        this builder
        Implementation Note:
        This value will be overwritten/ignored if timeWindow(TimeWindow) is invoked.
      • timeWindowUnit

        public ErrorContextBuilder timeWindowUnit​(TemporalUnit timeWindowUnit)
        Configures the TemporalUnit for the health check. If an error occurs within this time window, the health check will report as unhealthy. If there are no errors inside of this window, the health check will report as healthy.
        Parameters:
        timeWindowUnit - the TemporalUnit
        Returns:
        this builder
        Implementation Note:
        This value will be overwritten/ignored if timeWindow(TimeWindow) is invoked.
      • buildInMemoryH2

        public ErrorContext buildInMemoryH2()
        Build an ErrorContext backed by an in-memory H2 database that uses JDBI version 3.
        Returns:
        a new ErrorContext instance
        Implementation Note:
        Always sets dataStoreType to DataStoreType.NOT_SHARED, since this builds an in-memory database that can only be accessed from within the service in which it resides.
      • buildWithJdbi3

        public ErrorContext buildWithJdbi3​(org.jdbi.v3.core.Jdbi jdbi)
        Build an ErrorContext that uses JDBI version 3.
        Parameters:
        jdbi - the Jdbi instance to use; it must be configured with SqlObjectPlugin
        Returns:
        a new ErrorContext instance
        Implementation Note:
        If you do not invoke dataStoreType(DataStoreType) prior to calling this method, this method will default to using a value of DataStoreType.SHARED. Otherwise we would need to open a database connection, inspect the database metadata, etc. to figure out the database, and we don't want to do all this. If you are using an in-memory database, then be sure to configure the data store type before calling.