org.apache.commons.lang3.mutable.MutableBoolean.isTrue()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(112)

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

MutableBoolean.isTrue介绍

[英]Checks if the current value is true.
[中]检查当前值是否为[$0$]。

代码示例

代码示例来源:origin: apache/hbase

if (retryAfterOutOfOrderException.isTrue()) {
 retryAfterOutOfOrderException.setValue(false);
} else {

代码示例来源:origin: apache/hbase

public void intercept(FastFailInterceptorContext context)
  throws PreemptiveFastFailException {
 context.setFailureInfo(repeatedFailuresMap.get(context.getServer()));
 if (inFastFailMode(context.getServer()) && !currentThreadInFastFailMode()) {
  // In Fast-fail mode, all but one thread will fast fail. Check
  // if we are that one chosen thread.
  context.setRetryDespiteFastFailMode(shouldRetryInspiteOfFastFail(context
    .getFailureInfo()));
  if (!context.isRetryDespiteFastFailMode()) { // we don't have to retry
   LOG.debug("Throwing PFFE : " + context.getFailureInfo() + " tries : "
     + context.getTries());
   throw new PreemptiveFastFailException(
     context.getFailureInfo().numConsecutiveFailures.get(),
     context.getFailureInfo().timeOfFirstFailureMilliSec,
     context.getFailureInfo().timeOfLatestAttemptMilliSec, context.getServer(),
     context.getGuaranteedClientSideOnly().isTrue());
  }
 }
 context.setDidTry(true);
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testGetSet() {
  assertFalse(new MutableBoolean().booleanValue());
  assertEquals(Boolean.FALSE, new MutableBoolean().getValue());
  final MutableBoolean mutBool = new MutableBoolean(false);
  assertEquals(Boolean.FALSE, mutBool.toBoolean());
  assertFalse(mutBool.booleanValue());
  assertTrue(mutBool.isFalse());
  assertFalse(mutBool.isTrue());
  mutBool.setValue(Boolean.TRUE);
  assertEquals(Boolean.TRUE, mutBool.toBoolean());
  assertTrue(mutBool.booleanValue());
  assertFalse(mutBool.isFalse());
  assertTrue(mutBool.isTrue());
  mutBool.setValue(false);
  assertFalse(mutBool.booleanValue());
  mutBool.setValue(true);
  assertTrue(mutBool.booleanValue());
  mutBool.setFalse();
  assertFalse(mutBool.booleanValue());
  mutBool.setTrue();
  assertTrue(mutBool.booleanValue());
}

代码示例来源:origin: org.apache.hbase/hbase-client

if (retryAfterOutOfOrderException.isTrue()) {
 retryAfterOutOfOrderException.setValue(false);
} else {

代码示例来源:origin: org.apache.hbase/hbase-client

public void intercept(FastFailInterceptorContext context)
  throws PreemptiveFastFailException {
 context.setFailureInfo(repeatedFailuresMap.get(context.getServer()));
 if (inFastFailMode(context.getServer()) && !currentThreadInFastFailMode()) {
  // In Fast-fail mode, all but one thread will fast fail. Check
  // if we are that one chosen thread.
  context.setRetryDespiteFastFailMode(shouldRetryInspiteOfFastFail(context
    .getFailureInfo()));
  if (!context.isRetryDespiteFastFailMode()) { // we don't have to retry
   LOG.debug("Throwing PFFE : " + context.getFailureInfo() + " tries : "
     + context.getTries());
   throw new PreemptiveFastFailException(
     context.getFailureInfo().numConsecutiveFailures.get(),
     context.getFailureInfo().timeOfFirstFailureMilliSec,
     context.getFailureInfo().timeOfLatestAttemptMilliSec, context.getServer(),
     context.getGuaranteedClientSideOnly().isTrue());
  }
 }
 context.setDidTry(true);
}

代码示例来源:origin: com.atlassian.bitbucket.server.plugin/source-annotation-support

@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
  // called after all of the directory's files and subdirectories have been visited, so
  // the directory should be empty now. if an exception hasn't been thrown already, try
  // to delete the directory
  if (exc != null) {
    throw exc;
  }
  if (cacheDir.equals(dir)) {
    // only delete the cache directory if it's empty
    if (isEmpty.isTrue()) {
      log.debug("CleanupTask: Deleting cache directory {}", dir);
      Files.delete(dir);
    } else {
      log.debug("CleanupTask: Retaining non-empty cache directory {}", dir);
    }
  } else {
    // subdirectories should always be empty by this point
    log.trace("CleanupTask: Deleting cache subdirectory {}", dir);
    Files.delete(dir);
  }
  // directory deletion succeeded, so continue processing
  return FileVisitResult.CONTINUE;
}

代码示例来源:origin: com.github.endoscope/endoscope-storage-jdbc

protected List<GroupEntity> tailAfter(List<GroupEntity> groups, String lastGroupId) {
  if( lastGroupId == null ){
    return groups;
  }
  List<GroupEntity> nextGroups = new ArrayList();
  final MutableBoolean found = new MutableBoolean(false);
  groups.forEach( g -> {
    if(found.isTrue()) {
      nextGroups.add(g);
    } else if (lastGroupId.equals(g.getId()) ) {
      found.setTrue();
    }
  });
  return nextGroups;
}

代码示例来源:origin: org.wso2.carbon.auth/org.wso2.carbon.auth.oauth

private void processAuthCodeGrantRequest(String authorization, AccessTokenContext context,
                     AuthorizationCodeGrant request) throws OAuthDAOException {
  log.debug("Calling processAuthCodeGrantRequest");
  MutableBoolean haltExecution = new MutableBoolean(false);
  String clientId = (String) context.getParams().get(OAuthConstants.CLIENT_ID);
  if (haltExecution.isTrue()) {
    return;
  }
  Scope scope = getScope(clientId, request, context, haltExecution);
  if (haltExecution.isTrue()) {
    return;
  }
  TokenIssuer.generateAccessToken(scope, context);
  AccessTokenData accessTokenData = TokenDataUtil.generateTokenData(context);
  oauthDAO.addAccessTokenInfo(accessTokenData);
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core

@Override
public boolean validate(Object value, Object context) {
  MutableBoolean validated = new MutableBoolean();
  resolve(value, context, (session, docRef) -> {
    if (session.exists(docRef)) {
      validated.setTrue();
    }
  });
  return validated.isTrue();
}

代码示例来源:origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-core

@Override
public void afterBulk(long executionId, BulkRequest request, BulkResponse response) {
  if (log.isDebugEnabled()) {
    log.debug(String.format("After bulk: %s, actions: %d, status: %s", executionId, request.numberOfActions(),
        response.status()));
  }
  if (!response.hasFailures()) {
    return;
  }
  MutableBoolean inError = new MutableBoolean(false);
  Arrays.stream(response.getItems()).filter(BulkItemResponse::isFailed).forEach(item -> {
    if (item.getFailure().getStatus() != RestStatus.CONFLICT) {
      log.warn("Failure in bulk indexing: " + item.getFailureMessage());
      inError.setTrue();
    } else if (log.isDebugEnabled()) {
      log.debug("Skipping version conflict: " + item.getFailureMessage());
    }
  });
  if (inError.isTrue()) {
    log.error(String.format("Elasticsearch bulk %s returns with failures: %s", executionId,
        response.buildFailureMessage()));
    if (!continueOnFailure) {
      abort = true;
    }
  }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-client

if (retryAfterOutOfOrderException.isTrue()) {
 retryAfterOutOfOrderException.setValue(false);
} else {

代码示例来源:origin: com.atlassian.diagnostics/atlassian-diagnostics-core

done.setValue(done.isTrue() || emittedRow.getValue() > end);
    return done.isTrue() ? DONE : CONTINUE;
  }, PageRequest.of(entityRow.getValue(), daoPageSize));
  done.setValue(done.isTrue() || pageSize.getValue() <= daoPageSize);
  return null;
});

代码示例来源:origin: com.aliyun.hbase/alihbase-client

public void intercept(FastFailInterceptorContext context)
  throws PreemptiveFastFailException {
 context.setFailureInfo(repeatedFailuresMap.get(context.getServer()));
 if (inFastFailMode(context.getServer()) && !currentThreadInFastFailMode()) {
  // In Fast-fail mode, all but one thread will fast fail. Check
  // if we are that one chosen thread.
  context.setRetryDespiteFastFailMode(shouldRetryInspiteOfFastFail(context
    .getFailureInfo()));
  if (!context.isRetryDespiteFastFailMode()) { // we don't have to retry
   LOG.debug("Throwing PFFE : " + context.getFailureInfo() + " tries : "
     + context.getTries());
   throw new PreemptiveFastFailException(
     context.getFailureInfo().numConsecutiveFailures.get(),
     context.getFailureInfo().timeOfFirstFailureMilliSec,
     context.getFailureInfo().timeOfLatestAttemptMilliSec, context.getServer(),
     context.getGuaranteedClientSideOnly().isTrue());
  }
 }
 context.setDidTry(true);
}

代码示例来源:origin: com.atlassian.diagnostics/atlassian-diagnostics-core

if (!done.isTrue()) {
  for (AlertWithElisions alert : collector.onEndAlertResolution()) {
    if (count.incrementAndGet() > limit || callback.onItem(alert) == DONE) {

代码示例来源:origin: org.wso2.carbon.auth/org.wso2.carbon.auth.oauth

private AuthResponseContext processAuthRequest(AuthorizationRequest request) {
  log.debug("Calling processAuthRequest");
  AuthResponseContext context = new AuthResponseContext();
  context.setState(request.getState());
  MutableBoolean haltExecution = new MutableBoolean(false);
  updateRedirectUriIfNotSent(context, request, haltExecution);
  if (haltExecution.isTrue()) {
    return context;
  }
  if (request.getResponseType().equals(new ResponseType(ResponseType.Value.CODE))) { // Auth Code grant
    generateAuthCode(context, request);
  } else if (request.getResponseType().equals(new ResponseType(ResponseType.Value.TOKEN))) { // Implicit grant
    generateAccessToken(context, request);
  } else {
    String responseType = request.getResponseType().toString();
    String clientId = request.getClientID().getValue();
    log.info("Value of response_type: " + responseType + " is invalid(client Id: " + clientId);
    ErrorObject error = new ErrorObject(OAuth2Error.INVALID_REQUEST.getCode());
    context.setErrorObject(error);
  }
  return context;
}

相关文章