Brownie Sessions Service

The BrownieSessionsService class is useful to manage all the BrownieSession database operations

Author

N7ghtm4r3 - Tecknobit

See also

Constructors

Link copied to clipboard
@Autowired
constructor(publisher: ApplicationEventPublisher, sessionsRepository: BrownieSessionsRepository)
Constructor used to init the service

Properties

Link copied to clipboard
private val LOGGER: Logger
LOGGER is the instance used to log about the events of the monitor-and-sync routine
Link copied to clipboard
private val MONITOR_AND_SYNC_DELAY: Int = 5
MONITOR_AND_SYNC_DELAY constant value for the delay between each monitor-and-sync check
Link copied to clipboard
private val publisher: ApplicationEventPublisher
Link copied to clipboard
servicesMonitor pool used to perform the monitor-and-sync routine
Link copied to clipboard
sessionsRepository instance used to access to the SESSIONS_KEY table

Functions

Link copied to clipboard
open fun connectToSession(joinCode: String, password: String): BrownieSession
Method used to connect to an existing session
Link copied to clipboard
open fun createSession(sessionId: String, joinCode: String, password: String): BrownieSession
Method used to create a new session
Link copied to clipboard
open fun deleteSession(sessionId: String)
Method used to delete an existing session
Link copied to clipboard
open fun emitEvent(event: EquinoxApplicationEvent<T>)
Link copied to clipboard
open fun getBrownieSession(sessionId: String): BrownieSession
Method to get an existing Brownie's session
open fun getBrownieSession(sessionId: String, password: String): BrownieSession
Method to get an existing Brownie's session to validate its deletion
Link copied to clipboard
protected open fun hash(secret: String): String
Method to hash a sensitive user data
Link copied to clipboard
@PostConstruct
private open fun monitorAndSyncServiceStatuses()
Method automatically invoked after dependency injection by Spring used to perform the monitor-and-sync routine.
Link copied to clipboard
private open fun monitorServices(host: BrownieHost)
Method used to perform the monitoring of the services of a host
Link copied to clipboard
@PreDestroy
private open fun shutdownServicesMonitor()
Method automatically invoked by Spring before termination used to shut down the servicesMonitor pool
Link copied to clipboard
private open fun syncServiceStatuses(host: BrownieHost, stoppedServices: Collection<Long>)
Method used to sync the services of a host