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

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

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

MutableBoolean.setValue介绍

[英]Sets the value from any Boolean instance.
[中]设置任何布尔实例的值。

代码示例

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

@Override
public void clear() {
 server = null;
 fInfo = null;
 didTry = false;
 couldNotCommunicateWithServer.setValue(false);
 guaranteedClientSideOnly.setValue(false);
 retryDespiteFastFailMode = false;
 tries = 0;
}

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

public void handleThrowable(Throwable t1, ServerName serverName,
  MutableBoolean couldNotCommunicateWithServer,
  MutableBoolean guaranteedClientSideOnly) throws IOException {
 Throwable t2 = ClientExceptionsUtil.translatePFFE(t1);
 boolean isLocalException = !(t2 instanceof RemoteException);
 if ((isLocalException && ClientExceptionsUtil.isConnectionException(t2))) {
  couldNotCommunicateWithServer.setValue(true);
  guaranteedClientSideOnly.setValue(!(t2 instanceof CallTimeoutException));
  handleFailureToServer(serverName, t2);
 }
}

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

/**
 * Check to see if the client should try to connnect to the server, inspite of
 * knowing that it is in the fast fail mode.
 *
 * The idea here is that we want just one client thread to be actively trying
 * to reconnect, while all the other threads trying to reach the server will
 * short circuit.
 *
 * @param fInfo
 * @return true if the client should try to connect to the server.
 */
protected boolean shouldRetryInspiteOfFastFail(FailureInfo fInfo) {
 // We believe that the server is down, But, we want to have just one
 // client
 // actively trying to connect. If we are the chosen one, we will retry
 // and not throw an exception.
 if (fInfo != null
   && fInfo.exclusivelyRetringInspiteOfFastFail.compareAndSet(false, true)) {
  MutableBoolean threadAlreadyInFF = this.threadRetryingInFastFailMode
    .get();
  if (threadAlreadyInFF == null) {
   threadAlreadyInFF = new MutableBoolean();
   this.threadRetryingInFastFailMode.set(threadAlreadyInFF);
  }
  threadAlreadyInFF.setValue(true);
  return true;
 } else {
  return false;
 }
}

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

threadRetryingInFastFailMode.get().setValue(false);

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

@Test(expected=NullPointerException.class)
public void testSetNull() {
  final MutableBoolean mutBool = new MutableBoolean(false);
  mutBool.setValue(null);
}

代码示例来源:origin: Netflix/conductor

private boolean verifyTaskInputParameters(ConstraintValidatorContext context, WorkflowDef workflow) {
  MutableBoolean valid = new MutableBoolean();
  valid.setValue(true);
  if (workflow.getTasks() == null) {
    return valid.getValue();
  }
  workflow.getTasks()
      .stream()
      .filter(workflowTask -> workflowTask.getInputParameters() != null)
      .forEach(workflowTask -> {
        List<String> errors = ConstraintParamUtil.validateInputParam(workflowTask.getInputParameters(), workflowTask.getName(), workflow);
        errors.forEach(message -> context.buildConstraintViolationWithTemplate(message).addConstraintViolation());
        if(errors.size() > 0) {
          valid.setValue(false);
        }
      });
  return valid.getValue();
}

代码示例来源:origin: neo4j/neo4j

/**
 * @return true if instantiated tree needs to be rebuilt.
 */
private boolean instantiateTree() throws IOException
{
  monitors.addMonitorListener( treeMonitor() );
  GBPTree.Monitor monitor = monitors.newMonitor( GBPTree.Monitor.class );
  MutableBoolean isRebuilding = new MutableBoolean();
  Header.Reader readRebuilding =
      headerData -> isRebuilding.setValue( headerData.get() == NEEDS_REBUILDING );
  index = new GBPTree<>( pageCache, storeFile, new LabelScanLayout(), pageSize, monitor, readRebuilding,
      needsRebuildingWriter, recoveryCleanupWorkCollector );
  return isRebuilding.getValue();
}

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

retryAfterOutOfOrderException.setValue(false);
} else {

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

@Override
 public FlushResult answer(InvocationOnMock invocation) throws Throwable {
  synchronized (flushed) {
   flushed.setValue(true);
   flushed.notifyAll();
  }
  synchronized (reported) {
   while (!reported.booleanValue()) {
    reported.wait();
   }
  }
  rs.getWAL(region.getRegionInfo()).abortCacheFlush(
   region.getRegionInfo().getEncodedNameAsBytes());
  throw new DroppedSnapshotException("testcase");
 }
}).when(spiedRegion).internalFlushCacheAndCommit(Matchers.<WAL> any(),

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

@Override
public void clear() {
 server = null;
 fInfo = null;
 didTry = false;
 couldNotCommunicateWithServer.setValue(false);
 guaranteedClientSideOnly.setValue(false);
 retryDespiteFastFailMode = false;
 tries = 0;
}

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

rs.tryRegionServerReport(now - 500, now);
synchronized (reported) {
 reported.setValue(true);
 reported.notifyAll();

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

this.currentRegion = callable.getHRegionInfo();
 retryAfterOutOfOrderException.setValue(true);
} catch (DoNotRetryIOException e) {
 handleScanError(e, retryAfterOutOfOrderException, retriesLeft--);

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

@Test
public void testCompareTo() {
  final MutableBoolean mutBool = new MutableBoolean(false);
  assertEquals(0, mutBool.compareTo(new MutableBoolean(false)));
  assertEquals(-1, mutBool.compareTo(new MutableBoolean(true)));
  mutBool.setValue(true);
  assertEquals(+1, mutBool.compareTo(new MutableBoolean(false)));
  assertEquals(0, mutBool.compareTo(new MutableBoolean(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

public void handleThrowable(Throwable t1, ServerName serverName,
  MutableBoolean couldNotCommunicateWithServer,
  MutableBoolean guaranteedClientSideOnly) throws IOException {
 Throwable t2 = ClientExceptionsUtil.translatePFFE(t1);
 boolean isLocalException = !(t2 instanceof RemoteException);
 if ((isLocalException && ClientExceptionsUtil.isConnectionException(t2))) {
  couldNotCommunicateWithServer.setValue(true);
  guaranteedClientSideOnly.setValue(!(t2 instanceof CallTimeoutException));
  handleFailureToServer(serverName, t2);
 }
}

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

/**
 * Check to see if the client should try to connnect to the server, inspite of
 * knowing that it is in the fast fail mode.
 *
 * The idea here is that we want just one client thread to be actively trying
 * to reconnect, while all the other threads trying to reach the server will
 * short circuit.
 *
 * @param fInfo
 * @return true if the client should try to connect to the server.
 */
protected boolean shouldRetryInspiteOfFastFail(FailureInfo fInfo) {
 // We believe that the server is down, But, we want to have just one
 // client
 // actively trying to connect. If we are the chosen one, we will retry
 // and not throw an exception.
 if (fInfo != null
   && fInfo.exclusivelyRetringInspiteOfFastFail.compareAndSet(false, true)) {
  MutableBoolean threadAlreadyInFF = this.threadRetryingInFastFailMode
    .get();
  if (threadAlreadyInFF == null) {
   threadAlreadyInFF = new MutableBoolean();
   this.threadRetryingInFastFailMode.set(threadAlreadyInFF);
  }
  threadAlreadyInFF.setValue(true);
  return true;
 } else {
  return false;
 }
}

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

threadRetryingInFastFailMode.get().setValue(false);

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

retryAfterOutOfOrderException.setValue(false);
} else {

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl

@Override
public void doWithFile(YContentFile yfile) {
  if (isFileAcceptable(yfile)) {
    result.setValue(true);
  }
}

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

this.currentRegion = callable.getHRegionInfo();
 retryAfterOutOfOrderException.setValue(true);
} catch (DoNotRetryIOException e) {
 handleScanError(e, retryAfterOutOfOrderException, retriesLeft--);

相关文章