1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.remote.json.processor;
|
11
|
|
12
|
import java.util.HashSet;
|
13
|
import java.util.Set;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
|
17
|
import net.sf.json.CycleSetAcess;
|
18
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
19
|
|
20
|
/**
|
21
|
* @author a.kohlbecker
|
22
|
* @date 30.03.2009
|
23
|
* @deprecated class is not beeing used but kept as reference
|
24
|
*/
|
25
|
@Deprecated
|
26
|
public class CdmBeanProcessingRegistry extends CycleSetAcess {
|
27
|
|
28
|
public static final Logger logger = Logger.getLogger(CdmBeanProcessingRegistry.class);
|
29
|
|
30
|
protected static ThreadLocal<Set<CdmBase>> processedBeans = new ThreadLocal<Set<CdmBase>>(){
|
31
|
protected synchronized Set<CdmBase> initialValue() {
|
32
|
return new HashSet<CdmBase>();
|
33
|
}
|
34
|
};
|
35
|
|
36
|
protected static boolean isBeingProcessed(Object bean) {
|
37
|
if(logger.isDebugEnabled()){
|
38
|
logger.debug("looking for: " + bean.getClass() + " with hash: " + bean.hashCode());
|
39
|
}
|
40
|
return processedBeans.get().contains(bean);
|
41
|
}
|
42
|
|
43
|
protected static void register(CdmBase bean){
|
44
|
if(logger.isDebugEnabled()){
|
45
|
logger.debug("registering: " + bean.getClass() + " with hash: " + bean.hashCode());
|
46
|
}
|
47
|
processedBeans.get().add(bean);
|
48
|
}
|
49
|
|
50
|
protected static void unregister(CdmBase bean){
|
51
|
if(logger.isDebugEnabled()){
|
52
|
logger.debug("un-registering: " + bean.getClass() + " with hash: " + bean.hashCode());
|
53
|
}
|
54
|
processedBeans.get().remove(bean);
|
55
|
}
|
56
|
|
57
|
}
|