本文整理汇总了Java中org.red5.server.api.scope.IScope.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java IScope.setAttribute方法的具体用法?Java IScope.setAttribute怎么用?Java IScope.setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.red5.server.api.scope.IScope
的用法示例。
在下文中一共展示了IScope.setAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStore
import org.red5.server.api.scope.IScope; //导入方法依赖的package包/类
/**
* Return scope store
*
* @param scope
* Scope
* @param persistent
* Persistent store or not?
* @return Scope's store
*/
private IPersistenceStore getStore(IScope scope, boolean persistent) {
IPersistenceStore store;
if (!persistent) {
// Use special store for non-persistent shared objects
if (!scope.hasAttribute(SO_TRANSIENT_STORE)) {
store = new RamPersistence(scope);
scope.setAttribute(SO_TRANSIENT_STORE, store);
return store;
}
return (IPersistenceStore) scope.getAttribute(SO_TRANSIENT_STORE);
}
// Evaluate configuration for persistent shared objects
if (!scope.hasAttribute(SO_PERSISTENCE_STORE)) {
try {
store = PersistenceUtils.getPersistenceStore(scope, persistenceClassName);
log.info("Created persistence store {} for shared objects", store);
} catch (Exception err) {
log.warn("Could not create persistence store ({}) for shared objects, falling back to Ram persistence", persistenceClassName, err);
store = new RamPersistence(scope);
}
scope.setAttribute(SO_PERSISTENCE_STORE, store);
return store;
}
return (IPersistenceStore) scope.getAttribute(SO_PERSISTENCE_STORE);
}
示例2: setRecordingId
import org.red5.server.api.scope.IScope; //导入方法依赖的package包/类
public static void setRecordingId(IScope scope, Long recordingId) {
scope.setAttribute(ConAttrs.recordingId.name(), recordingId);
}