public class DenormalisedPermissionStateManagerImpl extends Object implements DenormalisedPermissionStateManager, org.springframework.beans.factory.DisposableBean
Modifier and Type | Field and Description |
---|---|
static long |
MAX_ALLOWED_RELOAD_STATE_DELAY |
static int |
SERVICE_STATE_RELOADING_INTERVAL |
static int |
SERVICE_STATE_RELOADING_INTERVAL_WHEN_SERVICE_IS_DISABLED |
Constructor and Description |
---|
DenormalisedPermissionStateManagerImpl(com.atlassian.event.api.EventPublisher eventPublisher,
DenormalisedServiceStateDao denormalisedServiceStateDao,
org.springframework.transaction.PlatformTransactionManager transactionManager,
DenormalisedPermissionStateLogService denormalisedPermissionStateLogService,
DenormalisedLockService denormalisedLockService) |
Modifier and Type | Method and Description |
---|---|
void |
createStateRecordsIfTheyDoNotExist()
When the service is starting up for the first time, we need to create "state records".
|
void |
destroy() |
void |
disableService(boolean cleanDenormalisedData)
Disables the service and deletes all triggers/functions, so denormalised data will not be updated.
|
void |
enableContentService() |
void |
enableService()
Enables the service.
|
void |
enableSpaceService() |
Long |
getContentPermissionUpdateLag()
Returns the time difference between updating regular content permissions and denormalised content permissions
|
DenormalisedPermissionServiceState |
getContentServiceState(boolean realTimeData)
Get the state of denormalised content service.
|
Long |
getSpacePermissionUpdateLag()
Returns the time difference between updating regular space permissions and denormalised space permissions
|
DenormalisedPermissionServiceState |
getSpaceServiceState(boolean realTimeData)
Get the state of denormalised space service.
|
List<StateChangeInformation> |
getStateChangeLog(int limit)
Returns a list of service state change events
|
void |
init() |
boolean |
isApiReady()
Returns true if the state of the service is "READY", if both CONTENT and SPACE services are in ready state
Possible reasons for returning false:
1.
|
boolean |
isContentApiReady()
Returns true if the state of denormalised CONTENT service is "READY", which means that denormalised content permissions
reflect real permissions.
|
boolean |
isSpaceApiReady()
Returns true if the state of denormalised SPACE service is "READY", which means that denormalised space permissions
reflect real permissions.
|
void |
onApplicationStartedEvent(com.atlassian.config.lifecycle.events.ApplicationStartedEvent event) |
void |
onApplicationStoppingEvent(com.atlassian.config.lifecycle.events.ApplicationStoppingEvent event) |
void |
reloadServiceState()
We need to support it's state in memory because we'd like to avoid reading this value from DB
for every request denormalised permissions receive.
|
void |
scheduled() |
public static final long MAX_ALLOWED_RELOAD_STATE_DELAY
public static final int SERVICE_STATE_RELOADING_INTERVAL_WHEN_SERVICE_IS_DISABLED
public static final int SERVICE_STATE_RELOADING_INTERVAL
public DenormalisedPermissionStateManagerImpl(com.atlassian.event.api.EventPublisher eventPublisher, DenormalisedServiceStateDao denormalisedServiceStateDao, org.springframework.transaction.PlatformTransactionManager transactionManager, DenormalisedPermissionStateLogService denormalisedPermissionStateLogService, DenormalisedLockService denormalisedLockService)
@PostConstruct public void init()
@Scheduled(fixedDelay=3000L) public void scheduled()
scheduled
in interface DenormalisedPermissionStateManager
@Internal public void reloadServiceState()
public boolean isApiReady()
isApiReady
in interface DenormalisedPermissionStateManager
public boolean isSpaceApiReady()
isSpaceApiReady
in interface DenormalisedPermissionStateManager
public boolean isContentApiReady()
isContentApiReady
in interface DenormalisedPermissionStateManager
public DenormalisedPermissionServiceState getSpaceServiceState(boolean realTimeData)
DenormalisedPermissionStateManager
getSpaceServiceState
in interface DenormalisedPermissionStateManager
realTimeData
- if true, data will be read from the DB. If false, cached data will be returned.public DenormalisedPermissionServiceState getContentServiceState(boolean realTimeData)
DenormalisedPermissionStateManager
getContentServiceState
in interface DenormalisedPermissionStateManager
realTimeData
- if true, data will be read from the DB. If false, cached data will be returned.public void enableService()
enableService
in interface DenormalisedPermissionStateManager
public void enableSpaceService()
public void enableContentService()
@Internal public void createStateRecordsIfTheyDoNotExist() throws ExecutionException, InterruptedException
public Long getSpacePermissionUpdateLag()
getSpacePermissionUpdateLag
in interface DenormalisedPermissionStateManager
public Long getContentPermissionUpdateLag()
getContentPermissionUpdateLag
in interface DenormalisedPermissionStateManager
public void disableService(boolean cleanDenormalisedData)
disableService
in interface DenormalisedPermissionStateManager
cleanDenormalisedData
- - if true, all denormalised data will be truncatedpublic List<StateChangeInformation> getStateChangeLog(int limit)
getStateChangeLog
in interface DenormalisedPermissionStateManager
limit
- limit@EventListener public void onApplicationStartedEvent(com.atlassian.config.lifecycle.events.ApplicationStartedEvent event)
@EventListener public void onApplicationStoppingEvent(com.atlassian.config.lifecycle.events.ApplicationStoppingEvent event)
Copyright © 2003–2021 Atlassian. All rights reserved.