Class DefaultAutoTuneService

java.lang.Object
io.ebeaninternal.server.autotune.service.DefaultAutoTuneService
All Implemented Interfaces:
io.ebean.AutoTune, io.ebeaninternal.server.autotune.AutoTuneService

public class DefaultAutoTuneService extends Object implements io.ebeaninternal.server.autotune.AutoTuneService
Implementation of the AutoTuneService which is comprised of profiling and query tuning.
  • Constructor Details

    • DefaultAutoTuneService

      public DefaultAutoTuneService(io.ebeaninternal.api.SpiEbeanServer server, io.ebean.DatabaseBuilder builder)
  • Method Details

    • startup

      public void startup()
      Load the query tuning information from it's data store.
      Specified by:
      startup in interface io.ebeaninternal.server.autotune.AutoTuneService
    • shutdown

      public void shutdown()
      Shutdown the listener.

      We should try to collect the usage statistics by calling a System.gc(). This is necessary for use with short lived applications where garbage collection may not otherwise occur at all.

      Specified by:
      shutdown in interface io.ebeaninternal.server.autotune.AutoTuneService
    • reportProfiling

      public void reportProfiling()
      Output the profiling.

      When profiling updates are applied to tuning at runtime this reports all tuning and profiling combined. When profiling is not applied at runtime then this reports the diff report with new and diff entries relative to the existing tuning.

      Specified by:
      reportProfiling in interface io.ebean.AutoTune
    • collectProfiling

      public void collectProfiling()
      Ask for a System.gc() so that we gather node usage information.

      Really only want to do this sparingly but useful just prior to shutdown for short run application where garbage collection may otherwise not occur at all.

      waitMillis will do a thread sleep to give the garbage collection a little time to do its thing assuming we are shutting down the VM.

      If waitMillis is -1 then the defaultGarbageCollectionWait is used which defaults to 100 milliseconds.

      Specified by:
      collectProfiling in interface io.ebean.AutoTune
      Specified by:
      collectProfiling in interface io.ebeaninternal.server.autotune.AutoTuneService
    • collectProfiling

      public void collectProfiling(long waitMillis)
    • tuneQuery

      public boolean tuneQuery(io.ebeaninternal.api.SpiQuery<?> query)
      Auto tune the query and enable profiling.
      Specified by:
      tuneQuery in interface io.ebeaninternal.server.autotune.AutoTuneService