本文整理汇总了Java中org.apache.ojb.broker.PersistenceBroker.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java PersistenceBroker.addListener方法的具体用法?Java PersistenceBroker.addListener怎么用?Java PersistenceBroker.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ojb.broker.PersistenceBroker
的用法示例。
在下文中一共展示了PersistenceBroker.addListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ObjectCacheTwoLevelImpl
import org.apache.ojb.broker.PersistenceBroker; //导入方法依赖的package包/类
public ObjectCacheTwoLevelImpl(final PersistenceBroker broker, Properties prop)
{
// TODO: Fix cast. Cast is needed to get access to ReferenceBroker class in PBImpl, see method #lookup
if(broker instanceof PersistenceBrokerImpl)
{
this.broker = (PersistenceBrokerImpl) broker;
}
else if(broker instanceof DelegatingPersistenceBroker)
{
this.broker = (PersistenceBrokerImpl) ((DelegatingPersistenceBroker) broker).getInnermostDelegate();
}
else
{
throw new RuntimeCacheException("Can't initialize two level cache, expect instance of"
+ PersistenceBrokerImpl.class + " or of " + DelegatingPersistenceBroker.class
+ " to setup application cache, but was " + broker);
}
this.sessionCache = new HashMap(100);
// this.enabledReadCache = false;
setupApplicationCache(this.broker, prop);
// we add this instance as a permanent PBStateListener
broker.addListener(this, true);
}
示例2: ObjectCachePerBrokerImpl
import org.apache.ojb.broker.PersistenceBroker; //导入方法依赖的package包/类
/**
* public Default Constructor
*/
public ObjectCachePerBrokerImpl(PersistenceBroker broker, Properties prop)
{
objectTable = new HashMap();
// add this cache as permanent listener
broker.addListener(this, true);
}
示例3: ObjectCacheDefaultImpl
import org.apache.ojb.broker.PersistenceBroker; //导入方法依赖的package包/类
public ObjectCacheDefaultImpl(PersistenceBroker broker, Properties prop)
{
this.broker = broker;
timeout = prop == null ? timeout : (Long.parseLong(prop.getProperty(TIMEOUT_PROP, "" + (60 * 15))) * 1000);
useSoftReferences = prop != null && (Boolean.valueOf((prop.getProperty(SOFT_REFERENCES_PROP, "true")).trim())).booleanValue();
cachingKeyType = prop == null ? 0 : (Integer.parseInt(prop.getProperty(CACHING_KEY_TYPE_PROP, "0")));
useAutoSync = prop != null && (Boolean.valueOf((prop.getProperty(AUTOSYNC_PROP, "false")).trim())).booleanValue();
if(useAutoSync)
{
if(broker != null)
{
// we add this instance as a permanent PBStateListener
broker.addListener(this, true);
}
else
{
log.info("Can't enable property '" + AUTOSYNC_PROP + "', because given PB instance is null");
}
}
identitiesInWork = new ArrayList();
if(log.isEnabledFor(Logger.INFO))
{
ToStringBuilder buf = new ToStringBuilder(this);
buf.append("timeout", timeout)
.append("useSoftReferences", useSoftReferences)
.append("cachingKeyType", cachingKeyType)
.append("useAutoSync", useAutoSync);
log.info("Setup cache: " + buf.toString());
}
}
示例4: IdentityFactoryImpl
import org.apache.ojb.broker.PersistenceBroker; //导入方法依赖的package包/类
public IdentityFactoryImpl(PersistenceBroker broker)
{
this.broker = broker;
this.objectToIdentityMap = new ReferenceIdentityMap(ReferenceIdentityMap.WEAK, ReferenceIdentityMap.HARD, true);
this.transientSequenceManager = new SequenceManagerTransientImpl(broker);
broker.addListener(this, true);
}