com.atlassian.jira.user
Class CachingExternalEntityStore

java.lang.Object
  extended by com.atlassian.jira.user.CachingExternalEntityStore
All Implemented Interfaces:
Startable, ExternalEntityStore

public class CachingExternalEntityStore
extends Object
implements ExternalEntityStore, Startable

A caching wrapper around the delegateEntityStore.


Field Summary
protected  ConcurrentHashMap<String,Long> nameIdMap
           
 
Constructor Summary
CachingExternalEntityStore(ExternalEntityStore delegateEntityStore, com.atlassian.event.api.EventPublisher eventPublisher)
          Creates a new instance of this class wrapping and caching the given ExternalEntityStore
 
Method Summary
 Long createIfDoesNotExist(String name)
          Checks the cache first and if does not exist in the cache, delegates to the wrapped entity store.
 void onClearCache(ClearCacheEvent event)
           
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nameIdMap

protected final ConcurrentHashMap<String,Long> nameIdMap
Constructor Detail

CachingExternalEntityStore

public CachingExternalEntityStore(ExternalEntityStore delegateEntityStore,
                                  com.atlassian.event.api.EventPublisher eventPublisher)
Creates a new instance of this class wrapping and caching the given ExternalEntityStore

Parameters:
delegateEntityStore - ExternalEntityStore to cache and delegate to
eventPublisher -
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

createIfDoesNotExist

public Long createIfDoesNotExist(String name)
                          throws IllegalArgumentException
Checks the cache first and if does not exist in the cache, delegates to the wrapped entity store.

Specified by:
createIfDoesNotExist in interface ExternalEntityStore
Parameters:
name - profile name to create
Returns:
Long id, this is the created or existing id for the name.
Throws:
IllegalArgumentException - if the given name is null


Copyright © 2002-2011 Atlassian. All Rights Reserved.