com.tc.util.Assert.assertTrue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中com.tc.util.Assert.assertTrue()方法的一些代码示例,展示了Assert.assertTrue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertTrue()方法的具体详情如下:
包路径:com.tc.util.Assert
类名称:Assert
方法名:assertTrue

Assert.assertTrue介绍

[英]Evaluate the boolean exception and throw an assertion error if false
[中]计算布尔异常,如果为false,则抛出断言错误

代码示例

代码示例来源:origin: org.terracotta/terracotta-ee

@Override
public BatchSequenceReceiver getBatchReceiver(final BatchSequence[] sequences) {
 Assert.assertTrue(sequences.length == 1);
 return sequences[0];
}

代码示例来源:origin: org.terracotta/terracotta-ee

private long bit(int bitIndex) {
 Assert.assertTrue("Bit index out of range", bitIndex >= 0);
 Assert.assertTrue("Bit index out of range", bitIndex < BITS_PER_LONG);
 return 1L << bitIndex;
}

代码示例来源:origin: org.terracotta/terracotta-l1-ee

@Override
public BatchSequenceReceiver getBatchReceiver(final BatchSequence[] sequences) {
 Assert.assertTrue(sequences.length == 1);
 return sequences[0];
}

代码示例来源:origin: org.terracotta/terracotta-ee

public synchronized void syncCompleteFor(final NodeID nodeID) {
 final Object val = syncingPassives.remove(nodeID);
 // value could be null if the node disconnects before fully synching up.
 Assert.assertTrue(val == WAITING_FOR_TXN || val == ADDED || val == null);
 if (val != null) {
  syncedPassives.add(nodeID);
  Assert.assertTrue(this.disabled);
  enableGCIfNecessary();
 }
}

代码示例来源:origin: org.terracotta/terracotta-ee

@Override
public ObjectIDProvider createObjectIdProvider(final BatchSequence[] sequences, final ClientIDProvider cidProvider) {
 Assert.assertTrue(sequences.length == 1);
 return new ObjectIDProviderImpl(sequences[0]);
}

代码示例来源:origin: org.terracotta/terracotta-ee

public LFUConfigImpl(TCProperties lfuProperties) {
 agingFactor = lfuProperties.getFloat("agingFactor");
 Assert.assertTrue("Invalid agingFactor in properties file", agingFactor >= 0.0 && agingFactor <= 1.0);
 ignorePercentage = lfuProperties.getInt("recentlyAccessedIgnorePercentage");
 Assert.assertTrue("Invalid recentlyAccessedIgnorePercentage in properties file", ignorePercentage >= 0
                                          && ignorePercentage <= 100);
}

代码示例来源:origin: org.terracotta/terracotta-ee

public void setDehydratedBytes(ObjectIDSet synced, ObjectIDSet notSynced, TCByteBuffer[] buffers, int count,
                ObjectStringSerializer os, final ObjectIDSet deletedObjects) {
 this.syncedOids = synced;
 this.notSyncedOids = notSynced;
 this.dnas = buffers;
 this.dnaCount = count;
 this.serializer = os;
 this.deletedOids = deletedObjects;
 Assert.assertTrue(deletedObjects.size() + dnaCount > 0);
}

代码示例来源:origin: org.terracotta/terracotta-ee

public ServerConfigurationSource(final String host, final int port, final SecurityInfo securityInfo, final PwProvider pwProvider) {
  this.securityInfo = securityInfo;
 Assert.assertNotBlank(host);
 Assert.assertTrue(port > 0);
 this.host = host;
 this.port = port;
 this.pwProvider = pwProvider;
}

代码示例来源:origin: org.terracotta/terracotta-ee

@Override
public void handleNotification(Notification notification, Object handback) {
 Assert.assertTrue(TerracottaOperatorEventsMBean.TERRACOTTA_OPERATOR_EVENT.equals(notification.getType()));
 TerracottaOperatorEvent operatorEvent = (TerracottaOperatorEvent) notification.getUserData();
 tcEventLogger.fireOperatorEvent(operatorEvent);
}

代码示例来源:origin: org.terracotta/terracotta-ee

private State moveToWaiter(State oldState) {
 Assert.assertNotNull(oldState);
 Assert.assertTrue(oldState.getType() == Type.HOLDER);
 Assert.assertTrue(oldState.getLockLevel() == ServerLockLevel.WRITE);
 switch (oldState.getLockLevel()) {
  case WRITE:
   return State.WAITER;
  default:
   // should never come here
   throw new IllegalStateException("Should never come here");
 }
}

代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.3-impl

private static void verifyEventLevel() {
 OperatorEventLevel operatorEventLevels[] = OperatorEventLevel.values();
 Assert.assertEquals(coreEventLevelMap.size(), operatorEventLevels.length);
 for (OperatorEventLevel operatorEventLevel : operatorEventLevels) {
  Assert.assertTrue(coreEventLevelMap.keySet().contains(operatorEventLevel.name()));
 }
}

代码示例来源:origin: org.terracotta/terracotta-l1-ee

private SearchQueryResults submitRequest(SearchRequestID reqId, SearchResultFetchContext reqCtxt, GroupID dest)
  throws AbortedOperationException {
 Assert.assertTrue(Thread.holdsLock(this));
 ConcurrentMap<GroupID, SearchResultFetchContext> contexts = Maps.newConcurrentMap();
 contexts.put(dest, reqCtxt);
 getRequestMap().put(reqId, contexts);
 final int size = getRequestMap().size();
 if ((size != 0) && ((size % 500) == 0)) {
  this.logger.warn("Many pending query requests in the system: " + size);
 }
 return waitForResult(reqId, contexts);
}

代码示例来源:origin: org.terracotta/terracotta-ee

@Override
public void sendTo(NodeID nodeID, GroupMessage msg) throws GroupException {
 Assert.assertTrue(isThisGroup(nodeID));
 groupManager.sendTo(nodeID, msg);
}

代码示例来源:origin: org.terracotta/terracotta-ee

@Override
public GroupMessage sendToAndWaitForResponse(NodeID nodeID, GroupMessage msg) throws GroupException {
 Assert.assertTrue(isThisGroup(nodeID));
 return groupManager.sendToAndWaitForResponse(nodeID, msg);
}

代码示例来源:origin: org.terracotta/terracotta-ee

private void markCreateInProgress(final ObjectLookupState ols,
                        final LocalLookupContext lookupContext) {
 Assert.assertTrue(ols.getOwner() == Thread.currentThread());
 lookupContext.getObjectCreationCount().increment();
}

代码示例来源:origin: org.terracotta/terracotta-ee

private static void initializeIndexDiretory(Server server, DefaultValueProvider defaultValueProvider,
                      File directoryLoadedFrom) {
 if (!server.isSetIndex()) {
  Assert.assertTrue(server.isSetData());
  server.setIndex(new File(server.getData(), "index").getAbsolutePath());
 } else {
  server.setIndex(getAbsolutePath(ParameterSubstituter.substitute(server.getIndex()), directoryLoadedFrom));
 }
}

代码示例来源:origin: org.terracotta/terracotta-ee

@Override
public void moveNodeToPassiveStandby(NodeID nodeID) {
 Assert.assertTrue(isActiveCoordinator());
 logger.info("Requesting node " + nodeID + " to move to " + PASSIVE_STANDBY);
 GroupMessage msg = L2StateMessageFactory.createMoveToPassiveStandbyMessage(EnrollmentFactory
   .createTrumpEnrollment(getLocalNodeID(), weightsFactory));
 try {
  this.groupManager.sendTo(nodeID, msg);
 } catch (GroupException e) {
  logger.error(e);
 }
}

代码示例来源:origin: org.terracotta/terracotta-ee

private void tryLockTimeout(ServerLockContext context, LockHelper helper) {
 Assert.assertTrue(context.isTryPending());
 cannotAward(context.getClientID(), context.getThreadID(), context.getState().getLockLevel(), helper);
 processPendingRequests(helper);
}

代码示例来源:origin: org.terracotta/terracotta-ee

private ManagedObjectSyncContext getSomeObjectsToSyncContext(final int count) {
 Assert.assertTrue(this.state == SYNC_STARTED);
 Assert.assertNull(this.syncingContext);
 if (isRootsMissing()) { return getMissingRootsSynccontext(); }
 final ObjectIDSet oids = new ObjectIDSet();
 addSomeMissingObjectIDsTo(oids, count);
 this.syncingContext = new ManagedObjectSyncContext(this.nodeID, oids, !this.missingOids.isEmpty(),
                           this.totalObjectsToSync, this.totalObjectsSynced,
                           this.sessionId);
 return this.syncingContext;
}

代码示例来源:origin: org.terracotta/terracotta-ee

private void waitTimeout(ServerLockContext context, LockHelper helper) {
 Assert.assertTrue(context.isWaiter());
 // Add a wait Timeout message
 LockResponseContext lrc = LockResponseContextFactory.createLockWaitTimeoutResponseContext(this.lockID, context
   .getClientID(), context.getThreadID(), context.getState().getLockLevel());
 helper.getLockSink().add(lrc);
 lock(context.getClientID(), context.getThreadID(), ServerLockLevel.WRITE, helper);
}

相关文章