本文整理了Java中com.tc.util.Assert.pre()
方法的一些代码示例,展示了Assert.pre()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.pre()
方法的具体详情如下:
包路径:com.tc.util.Assert
类名称:Assert
方法名:pre
[英]Assert precondition
[中]断言前提条件
代码示例来源:origin: org.terracotta/terracotta-ee
/**
* Construct new spec
*
* @param className Class name
*/
public DmiClassSpec(final String className) {
Assert.pre(className != null);
this.className = className;
}
代码示例来源:origin: org.terracotta/terracotta-ee
public DmiHandler(DmiManager dmiMgr) {
Assert.pre(dmiMgr != null);
this.dmiMgr = dmiMgr;
}
代码示例来源:origin: org.terracotta/terracotta-ee
/**
* New descriptor
*
* @param receiverId Receiver object identifier
* @param dmiCallId DMI call identifier
* @param classSpecs Classes
* @param faultReceiver True if should use local fault receiver
*/
public DmiDescriptor(ObjectID receiverId, ObjectID dmiCallId, DmiClassSpec[] classSpecs, boolean faultReceiver) {
Assert.pre(receiverId != null);
Assert.pre(dmiCallId != null);
Assert.pre(classSpecs != null);
this.receiverId = receiverId;
this.dmiCallId = dmiCallId;
this.classSpecs = classSpecs;
this.faultReceiver = faultReceiver;
}
代码示例来源:origin: org.terracotta/terracotta-ee
public DmiManagerImpl(ClassProvider cp, ClientObjectManager om) {
Assert.pre(cp != null);
Assert.pre(om != null);
this.classProvider = cp;
this.objMgr = om;
this.feedBack = new ThreadLocal();
this.nesting = new VicariousThreadLocal();
}
代码示例来源:origin: org.terracotta/terracotta-ee
@Override
public void distributedInvokeCommit() {
if (feedBack.get() != null) { return; }
Assert.pre(nesting.get() != null);
nesting.remove();
}
代码示例来源:origin: org.terracotta/terracotta-ee
private static Object getClassSpec(ClassProvider classProvider, Object obj) {
Assert.pre(classProvider != null);
Assert.pre(obj != null);
final String className = obj.getClass().getName();
return new DmiClassSpec(className);
}
代码示例来源:origin: org.terracotta/terracotta-ee
private static DmiClassSpec[] getClassSpecs(ClassProvider classProvider, Object receiver, Object[] params) {
Assert.pre(classProvider != null);
Assert.pre(receiver != null);
Assert.pre(params != null);
Set set = new HashSet();
set.add(getClassSpec(classProvider, receiver));
for (final Object p : params) {
if (p != null) set.add(getClassSpec(classProvider, p));
}
DmiClassSpec[] rv = new DmiClassSpec[set.size()];
set.toArray(rv);
return rv;
}
代码示例来源:origin: org.terracotta.modules/tim-ehcache-commons
public Object getValue() {
Object rv = entry.getValue();
Assert.pre(rv instanceof CacheData);
return ((CacheData) rv).getValue();
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.3-impl
public ConcurrentDistributedServerMapDso(final int dsoLockType, final GenericLockStrategy<L, ? super K> lockStrategy,
final int ttiSeconds, final int ttlSeconds,
final int targetMaxInMemoryCount, final int targetMaxTotalCount,
boolean invalidateOnChange, String cacheName) {
// ensure that DSO is active at construction time, i.e. fail fast
Assert.pre(!(ManagerUtil.getManager() instanceof NullManager));
this.dsoLockType = dsoLockType;
this.lockStrategy = lockStrategy;
this.maxTTISeconds = ttiSeconds;
this.maxTTLSeconds = ttlSeconds;
this.targetMaxInMemoryCount = targetMaxInMemoryCount;
this.targetMaxTotalCount = targetMaxTotalCount;
this.invalidateOnChange = invalidateOnChange;
this.nullLockStrategy = lockStrategy instanceof NullLockStrategy;
this.cacheName = cacheName;
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.4-impl
public ConcurrentDistributedServerMapDso(final int dsoLockType, final GenericLockStrategy<L, ? super K> lockStrategy,
final int ttiSeconds, final int ttlSeconds, final int targetMaxTotalCount,
boolean invalidateOnChange, String cacheName, boolean localCacheEnabled,
boolean deleteValueOnRemove) {
// ensure that DSO is active at construction time, i.e. fail fast
Assert.pre(!(ManagerUtil.getManager() instanceof NullManager));
this.dsoLockType = dsoLockType;
this.lockStrategy = lockStrategy;
this.maxTTISeconds = ttiSeconds;
this.maxTTLSeconds = ttlSeconds;
this.targetMaxTotalCount = targetMaxTotalCount;
this.invalidateOnChange = invalidateOnChange;
this.nullLockStrategy = lockStrategy instanceof NullLockStrategy;
this.cacheName = cacheName;
this.localCacheEnabled = localCacheEnabled;
this.deleteValueOnRemove = deleteValueOnRemove;
}
代码示例来源:origin: org.terracotta.modules/tim-ehcache-commons
public Lock(final String lockId, final int lockType, Manager manager) {
this.manager = manager;
if (lockType != Manager.LOCK_TYPE_SYNCHRONOUS_WRITE && lockType != Manager.LOCK_TYPE_WRITE) {
throw new AssertionError("Trying to set lockType to " + lockType
+ " -- must be either write or synchronous-write");
}
this.lockType = LockLevel.fromInt(lockType);
Assert.pre(lockId != null && lockId.length() > 0);
this.lockId = manager.generateLockIdentifier(lockId);
}
代码示例来源:origin: org.terracotta/terracotta-ee
private static void checkClassAvailability(ClassProvider classProvider, DmiClassSpec[] classSpecs)
throws ClassNotFoundException {
Assert.pre(classSpecs != null);
for (DmiClassSpec s : classSpecs) {
classProvider.getClassFor(s.getClassName());
}
}
代码示例来源:origin: org.terracotta.modules/tim-map-evictor
private void expire(Object key) {
Assert.pre(key != null);
((TCMap) data).__tc_remove_logical(key);
((TCMap) timestamps).__tc_remove_logical(key);
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.4-impl
private ConcurrentDistributedMapDso(final int lockLevel, final GenericLockStrategy<L, ? super K> lockStrategy) {
// ensure that DSO is active at construction time, ie. fail fast
Assert.pre(!(ManagerUtil.getManager() instanceof NullManager));
this.dsoLockType = lockLevel;
this.store = new SelectableConcurrentHashMap();
this.lockStrategy = lockStrategy;
this.localSize = new AtomicInteger(0);
this.nullLockStrategy = lockStrategy instanceof NullLockStrategy;
Assert.post(this.store != null);
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.3-impl
private ConcurrentDistributedMapDso(final int lockLevel, final GenericLockStrategy<L, ? super K> lockStrategy) {
// ensure that DSO is active at construction time, ie. fail fast
Assert.pre(!(ManagerUtil.getManager() instanceof NullManager));
this.dsoLockType = lockLevel;
this.store = new SelectableConcurrentHashMap();
this.lockStrategy = lockStrategy;
this.localSize = new AtomicInteger(0);
this.nullLockStrategy = lockStrategy instanceof NullLockStrategy;
Assert.post(this.store != null);
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.0-impl
private ConcurrentDistributedMapDso(final int lockLevel, final LockStrategy<? super K> lockStrategy) {
// ensure that DSO is active at construction time, ie. fail fast
Assert.pre(!(ManagerUtil.getManager() instanceof NullManager));
this.dsoLockType = lockLevel;
this.store = new SelectableConcurrentHashMap();
this.lockStrategy = lockStrategy;
this.localSize = new AtomicInteger(0);
Assert.post(this.store != null);
}
代码示例来源:origin: org.terracotta.modules/tim-wan-collections
private WANConcurrentMapDsoInstrumented(final int lockLevel) {
// ensure that DSO is active at construction time, ie. fail fast
Assert.pre(!(ManagerUtil.getManager() instanceof NullManager));
this.dsoLockType = lockLevel;
store = new NonBlockingHashMap();
Assert.post(store != null);
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.0-impl
/**
* Evict an item from the cache due to expiration. The caller is responsible for determining whether the entry has
* expired. This method will log the eviction (if logging is enabled) and remove the entry.
*/
private void evict(final K key, final TimestampedValue<V> entry, final int now) {
Assert.pre(key != null);
if (this.data.remove(key, entry)) {
onEvict(key, entry);
logEviction(key, entry, now);
}
}
代码示例来源:origin: org.terracotta.modules/tim-distributed-cache
/**
* Evict an item from the cache due to expiration. The caller is responsible for determining whether the entry has
* expired. This method will log the eviction (if logging is enabled) and remove the entry.
*/
private void evict(final K key, final TimestampedValue<V> entry, final int now) {
Assert.pre(key != null);
if (this.data.remove(key, entry)) {
onEvict(key, entry.getValue());
logEviction(key, entry, now);
}
}
代码示例来源:origin: org.terracotta.modules/tim-ehcache-commons
void updateTimestampIfNeeded(Object key, Element e) {
Assert.pre(e != null);
if (!isInvalidatorRunning() || (e.getTimeToIdle() <= 0)) {
return;
}
if (needsUpdate(key, e)) {
int storeIndex = getStoreIndex(key);
ManagerUtil.monitorEnter(store[storeIndex], Manager.LOCK_TYPE_CONCURRENT);
try {
e.updateAccessStatistics();
updateExpireTime(key, e);
} finally {
ManagerUtil.monitorExit(store[storeIndex], Manager.LOCK_TYPE_CONCURRENT);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!