kill cleaner thread on service stop
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/oauth@141891 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
807cea8e60
commit
cd61182ac6
|
@ -43,6 +43,11 @@ public class OauthService {
|
|||
*/
|
||||
private Map<String, CacheBean> entries;
|
||||
|
||||
/**
|
||||
* Cleaner thread
|
||||
*/
|
||||
CacheCleaner cleaner;
|
||||
|
||||
/**
|
||||
* Since this is a singleton sub-service, there will be just one call to this constructor and one running thread
|
||||
* to clean up expired codes.
|
||||
|
@ -50,10 +55,16 @@ public class OauthService {
|
|||
public OauthService() {
|
||||
logger.info("Singleton gcube-oauth service built.");
|
||||
entries = new ConcurrentHashMap<String, CacheBean>();
|
||||
CacheCleaner cleaner = new CacheCleaner(entries);
|
||||
cleaner = new CacheCleaner(entries);
|
||||
cleaner.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize(){
|
||||
if(cleaner != null)
|
||||
cleaner.interrupt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check that the token type is of type user
|
||||
* @param clientType
|
||||
|
|
Loading…
Reference in New Issue