Class DataSources

java.lang.Object
io.quarkus.agroal.runtime.DataSources

@Singleton public class DataSources extends Object
This class is sort of a producer for AgroalDataSource.

It isn't a CDI producer in the literal sense, but it created a synthetic bean from AgroalProcessor The createDataSource method is called at runtime (see AgroalRecorder.agroalDataSourceSupplier(String, DataSourcesRuntimeConfig)) in order to produce the actual AgroalDataSource objects.

  • Field Details

  • Constructor Details

  • Method Details

    • fromName

      @Deprecated public static io.agroal.api.AgroalDataSource fromName(String dataSourceName)
      Deprecated.
      This method should not be used as it can very easily lead to timing issues during bean creation
      Meant to be used from recorders that create synthetic beans that need access to Datasource. In such using Arc.container.instance(DataSource.class) is not possible because Datasource is itself a synthetic bean.

      This method relies on the fact that DataSources should - given the same input - always return the same AgroalDataSource no matter how many times it is invoked (which makes sense because DataSource is a Singleton bean).

      This method is thread-safe

    • isDataSourceCreated

      public boolean isDataSourceCreated(String dataSourceName)
    • getActiveDataSourceNames

      public Set<String> getActiveDataSourceNames()
    • getDataSource

      public io.agroal.api.AgroalDataSource getDataSource(String dataSourceName)
    • start

      @PostConstruct public void start()
    • doCreateDataSource

      public io.agroal.api.AgroalDataSource doCreateDataSource(String dataSourceName, boolean failIfInactive)
    • stop

      @PreDestroy public void stop()