public final class HypersistenceOptimizer extends Object
HypersistenceOptimizer represents the main class of
this project.
It takes a Config object and provides a way to initialize
the optimization analysis process.
| Constructor and Description |
|---|
HypersistenceOptimizer(Config config)
Instantiate a
HypersistenceOptimizer object using the
provided configuration. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the
HypersistenceOptimizer, just like stop(). |
Config |
config()
Get the current
Config object. |
EventPersistenceContext |
getEventPersistenceContext()
Get the
EventPersistenceContext, if the event persistence feature is active. |
List<Event> |
getEvents()
|
String |
getWebAppUrl()
Get the URL of the embedded Event Persistence Web App, when it has been started successfully,
either automatically (via
Config.EventPersistence#setWebAppEnabled(true)) or on demand
(via startWebApp()). |
void |
startWebApp()
Start the embedded Event Persistence Web App on demand, reusing the host application's
SessionFactory. |
void |
stop()
Stop the
HypersistenceOptimizer, flushing and releasing the event persistence
resources when the feature is active. |
void |
stopWebApp()
Stop the embedded Event Persistence Web App, if it is running, while keeping the event
persistence feature active.
|
public HypersistenceOptimizer(Config config)
HypersistenceOptimizer object using the
provided configuration.config - Config objectpublic EventPersistenceContext getEventPersistenceContext()
EventPersistenceContext, if the event persistence feature is active.EventPersistenceContext, or null if the feature is not activepublic String getWebAppUrl()
Config.EventPersistence#setWebAppEnabled(true)) or on demand
(via startWebApp()).
This is the reliable way to discover the address when the web app binds a dynamically allocated port, without having to rely on the startup log line: the host application can read it and, for example, re-log it through its own logging framework or expose it via a management endpoint.
null if the web app is not runningpublic void startWebApp()
SessionFactory. This is useful when the web app is not started automatically (via
Config.EventPersistence#setWebAppEnabled(true)), e.g. to open it from a management
endpoint only when needed. The host, port, and Basic authentication settings of the
Config.EventPersistence are still applied.
It has no effect if the event persistence feature is not active or the web app is already
running, and it never throws; call getWebAppUrl() to find out whether it started.
public void stopWebApp()
public void stop()
HypersistenceOptimizer, flushing and releasing the event persistence
resources when the feature is active.public void close()
HypersistenceOptimizer, just like stop(). Frameworks that manage the
HypersistenceOptimizer lifecycle call it automatically, e.g., Spring infers close as
the destroy method of a @Bean, so the runtime events are flushed and the web app is stopped
when the application context is closed.Copyright © 2026. All rights reserved.