当前位置: 首页>>代码示例>>Java>>正文


Java MutableBoolean.booleanValue方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.mutable.MutableBoolean.booleanValue方法的典型用法代码示例。如果您正苦于以下问题:Java MutableBoolean.booleanValue方法的具体用法?Java MutableBoolean.booleanValue怎么用?Java MutableBoolean.booleanValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.mutable.MutableBoolean的用法示例。


在下文中一共展示了MutableBoolean.booleanValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
@Override
protected ActivityResultContext execute() throws Exception {

    // on attend sur un lock, si nécessaire
    final String lockKey = getStringVariable(WAIT_LOCK_KEY);
    if (lockKey != null) {
        final MutableBoolean lock = (MutableBoolean) datastore.get(lockKey);
        if (lock != null) {
            //noinspection SynchronizationOnLocalVariableOrMethodParameter
            synchronized (lock) {
                while (lock.booleanValue()) {
                    lock.wait();
                }
            }
        }
    }

    // on stocke un pseudo-résultat dans le datastore global (pour simuler la database dans le cas ordinaire)
    final String key = getStringVariable(RESULTS_KEY);
    datastore.put(key, true);

    return new FinishedActivityResultContext();
}
 
开发者ID:shared-vd,项目名称:tipi-engine,代码行数:24,代码来源:MaxTopConcurrentTest.java

示例2: testCallTwice

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
@Test
public void testCallTwice() throws Exception {
    final MutableInt callCount = new MutableInt(0);
    final MutableBoolean called = new MutableBoolean(false);
    Polling p = new Polling() {
        @Override
        public Boolean call() throws Exception {
            callCount.increment();
            boolean b = called.booleanValue();
            called.setTrue();
            return b;
        }
    };
    p.poll(500, 10);

    assertEquals(2, callCount.intValue());
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:18,代码来源:PollingTest.java

示例3: testCallableTwice

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
@Test
public void testCallableTwice() throws Exception {
    final MutableInt callCount = new MutableInt(0);
    final MutableBoolean called = new MutableBoolean(false);
    Polling p = new Polling(new Callable<Boolean>() {
        @Override
        public Boolean call() throws Exception {
            callCount.increment();
            boolean b = called.booleanValue();
            called.setTrue();
            return b;
        }
    });
    p.poll(500, 10);

    assertEquals(2, callCount.intValue());
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:18,代码来源:PollingTest.java

示例4: isBlank

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
@Override
public boolean isBlank() {
  CsvGridSheetPane gridSheet = getGridSheet();
  MutableBoolean result = new MutableBoolean(true);
  forEachCell(new ICellConsumer() {
    @Override
    public boolean accept(int r, int c) {
      Object val = gridSheet.getValueAt(r, c);
      if (val != null && !val.toString().isEmpty()) {
        result.setFalse();
        return false;
      }
      return true;
    }
  });
  return result.booleanValue();
}
 
开发者ID:kohii,项目名称:smoothcsv,代码行数:18,代码来源:RangeImpl.java

示例5: decodeString

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
private String decodeString(ByteBuf in) throws ProtocolException {
    final StringBuilder buffer = new StringBuilder();
    final MutableBoolean reachCRLF = new MutableBoolean(false);
    setReaderIndex(in, in.forEachByte(new ByteBufProcessor() {

        @Override
        public boolean process(byte value) throws Exception {
            if (value == '\n') {
                if ((byte) buffer.charAt(buffer.length() - 1) != '\r') {
                    throw new ProtocolException("Response is not ended by CRLF");
                } else {
                    buffer.setLength(buffer.length() - 1);
                    reachCRLF.setTrue();
                    return false;
                }
            } else {
                buffer.append((char) value);
                return true;
            }
        }
    }));
    return reachCRLF.booleanValue() ? buffer.toString() : null;
}
 
开发者ID:CodisLabs,项目名称:nedis,代码行数:24,代码来源:RedisResponseDecoder.java

示例6: of

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
private static <T> VlanAllocation of(Collection<T> ports, Function<T, Optional<Integer>> sVlanId, Function<T, Optional<Vlan>> vlan) {
  MutableBoolean overlappingVlan = new MutableBoolean(false);
  Map<Optional<Integer>, Vlan> allocationsPerSVlan = ports.stream().collect(Collectors.toMap(
      sVlanId,
      port -> vlan.apply(port).orElse(Vlan.none()),
      (a, b) -> {
        if (a.overlaps(b)) {
          overlappingVlan.setTrue();
        }
        return a.union(b);
      }));
  Vlan allocatedSVlans = ports.stream()
      .map(port -> sVlanId.apply(port).map(Vlan::singleton).orElse(Vlan.none()))
      .reduce(Vlan.none(), Vlan::union);
  if (!overlappingVlan.booleanValue() && allocatedSVlans.overlaps(allocationsPerSVlan.getOrDefault(Optional.empty(), Vlan.none()))) {
    overlappingVlan.setTrue();
  };
  return new VlanAllocation(overlappingVlan.booleanValue(), allocationsPerSVlan, allocatedSVlans);
}
 
开发者ID:BandwidthOnDemand,项目名称:bandwidth-on-demand,代码行数:20,代码来源:VlanAllocation.java

示例7: writeBytesForView

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
private static boolean writeBytesForView(
        CountingOutputStream countingOutputStream, byte[] bytes, int maxLength, MutableBoolean truncated) {
    if (truncated.booleanValue()) {
        return false;
    }

    if (countingOutputStream.getTotalWrittenByteCount() + bytes.length > maxLength) {
        truncated.setTrue();
        return false;
    } else {
        try {
            countingOutputStream.write(bytes);
            return true;
        } catch (IOException ignored) {
            truncated.setTrue();
            return false;
        }
    }
}
 
开发者ID:Codeforces,项目名称:codeforces-commons,代码行数:20,代码来源:ZipUtil.java

示例8: createOrAssociate

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
public boolean createOrAssociate(final Changeset changeset, final Set<String> extractedIssues)
{
    final MutableBoolean wasCreated = new MutableBoolean(false);
    ChangesetMapping changesetMapping = activeObjects.executeInTransaction(new TransactionCallback<ChangesetMapping>()
    {
        @Override
        public ChangesetMapping doInTransaction()
        {
            ChangesetMapping chm = getChangesetMapping(changeset);
            if (chm == null)
            {
                chm = activeObjects.create(ChangesetMapping.class);
                fillProperties(changeset, chm);
                chm.save();
                wasCreated.setValue(true);
            }

            associateRepositoryToChangeset(chm, changeset.getRepositoryId());
            if (extractedIssues != null)
            {
                associateIssuesToChangeset(chm, extractedIssues);
            }

            return chm;
        }
    });

    changeset.setId(changesetMapping.getID());
    return wasCreated.booleanValue();
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:31,代码来源:ChangesetDaoImpl.java

示例9: putInternal

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
private boolean putInternal(K key, V value, Timestamp timestamp) {
    counter.incrementCount();
    Timestamp removed = removedItems.get(key);
    if (removed != null && removed.isNewerThan(timestamp)) {
        log.debug("ecmap - removed was newer {}", value);
        return false;
    }

    final MutableBoolean updated = new MutableBoolean(false);

    items.compute(key, (k, existing) -> {
        if (existing != null && existing.isNewerThan(timestamp)) {
            updated.setFalse();
            return existing;
        } else {
            updated.setTrue();
            return new Timestamped<>(value, timestamp);
        }
        });

    boolean success = updated.booleanValue();
    if (!success) {
        log.debug("ecmap - existing was newer {}", value);
    }

    if (success && removed != null) {
        removedItems.remove(key, removed);
    }

    if (success && persistent) {
        persistentStore.put(key, value, timestamp);
    }

    return success;
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:36,代码来源:EventuallyConsistentMapImpl.java

示例10: putInternal

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
private void putInternal(K key, V value, Timestamp timestamp) {
    byte[] keyBytes = serializer.encode(key);
    byte[] removedBytes = tombstones.get(keyBytes);

    Timestamp removed = removedBytes == null ? null :
                        serializer.decode(removedBytes);
    if (removed != null && removed.isNewerThan(timestamp)) {
        return;
    }

    final MutableBoolean updated = new MutableBoolean(false);

    items.compute(keyBytes, (k, existingBytes) -> {
        Timestamped<V> existing = existingBytes == null ? null :
                                  serializer.decode(existingBytes);
        if (existing != null && existing.isNewerThan(timestamp)) {
            updated.setFalse();
            return existingBytes;
        } else {
            updated.setTrue();
            return serializer.encode(new Timestamped<>(value, timestamp));
        }
    });

    boolean success = updated.booleanValue();

    if (success && removed != null) {
        tombstones.remove(keyBytes, removedBytes);
    }

    database.commit();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:33,代码来源:MapDbPersistentStore.java

示例11: removeInternal

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
private void removeInternal(K key, Timestamp timestamp) {
    byte[] keyBytes = serializer.encode(key);

    final MutableBoolean updated = new MutableBoolean(false);

    items.compute(keyBytes, (k, existingBytes) -> {
        Timestamp existing = existingBytes == null ? null :
                             serializer.decode(existingBytes);
        if (existing != null && existing.isNewerThan(timestamp)) {
            updated.setFalse();
            return existingBytes;
        } else {
            updated.setTrue();
            // remove from items map
            return null;
        }
    });

    if (!updated.booleanValue()) {
        return;
    }

    byte[] timestampBytes = serializer.encode(timestamp);
    byte[] removedBytes = tombstones.get(keyBytes);

    Timestamp removedTimestamp = removedBytes == null ? null :
                                 serializer.decode(removedBytes);
    if (removedTimestamp == null) {
        tombstones.putIfAbsent(keyBytes, timestampBytes);
    } else if (timestamp.isNewerThan(removedTimestamp)) {
        tombstones.replace(keyBytes, removedBytes, timestampBytes);
    }

    database.commit();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:36,代码来源:MapDbPersistentStore.java

示例12: iterable

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
public static <T> Iterable<T> iterable(Iterator<T> seq) {
    final MutableBoolean used = new MutableBoolean(false);
    return new Iterable<T>() {

        @Override
        public Iterator<T> iterator() {
            if (!used.booleanValue()) {
                used.setValue(true);
                return seq;
            } else {
                throw new IllegalStateException("only allowed to iterate this iterable once");
            }
        }
    };
}
 
开发者ID:mgormley,项目名称:pacaya,代码行数:16,代码来源:ScheduleUtils.java

示例13: shouldSkipField

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
@SuppressWarnings({"AccessingNonPublicFieldOfAnotherObject", "OverlyComplexMethod"})
private static boolean shouldSkipField(
        @Nullable String stringValue, ToStringOptions options, MutableBoolean quoted) {
    if (options.skipNulls && stringValue == null) {
        return true;
    }

    if (options.skipEmptyStrings) {
        if (quoted != null && quoted.booleanValue()) {
            if ("''".equals(stringValue) || "\"\"".equals(stringValue)) {
                return true;
            }
        } else {
            if (isEmpty(stringValue)) {
                return true;
            }
        }
    }

    if (options.skipBlankStrings) {
        if (quoted != null && quoted.booleanValue()) {
            return isBlank(stringValue) || isBlank(stringValue.substring(1, stringValue.length() - 1));
        } else {
            return isBlank(stringValue);
        }
    }

    return false;
}
 
开发者ID:Codeforces,项目名称:codeforces-commons,代码行数:30,代码来源:StringUtil.java

示例14: removeInternal

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
private boolean removeInternal(K key, Timestamp timestamp) {
    if (timestamp == null) {
        return false;
    }

    counter.incrementCount();
    final MutableBoolean updated = new MutableBoolean(false);

    items.compute(key, (k, existing) -> {
        if (existing != null && existing.isNewerThan(timestamp)) {
            updated.setFalse();
            return existing;
        } else {
            updated.setTrue();
            // remove from items map
            return null;
        }
    });

    if (updated.isFalse()) {
        return false;
    }

    boolean updatedTombstone = false;

    if (!tombstonesDisabled) {
        Timestamp removedTimestamp = removedItems.get(key);
        if (removedTimestamp == null) {
            //Timestamp removed = removedItems.putIfAbsent(key, timestamp);
            updatedTombstone = (removedItems.putIfAbsent(key, timestamp) == null);
        } else if (timestamp.isNewerThan(removedTimestamp)) {
            updatedTombstone = removedItems.replace(key, removedTimestamp, timestamp);
        }
    }

    if (updated.booleanValue() && persistent) {
        persistentStore.remove(key, timestamp);
    }

    return (!tombstonesDisabled && updatedTombstone) || updated.booleanValue();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:42,代码来源:EventuallyConsistentMapImpl.java

示例15: test

import org.apache.commons.lang3.mutable.MutableBoolean; //导入方法依赖的package包/类
@Test
public void test() throws IOException, InterruptedException {
  final HRegionServer rs = testUtil.getRSForFirstRegionInTable(tableName);
  final HRegion region = (HRegion) rs.getRegions(tableName).get(0);
  HRegion spiedRegion = spy(region);
  final MutableBoolean flushed = new MutableBoolean(false);
  final MutableBoolean reported = new MutableBoolean(false);
  doAnswer(new Answer<FlushResult>() {
    @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(),
    Matchers.<MonitoredTask> any(), Matchers.<PrepareFlushResult> any(),
    Matchers.<Collection<HStore>> any());
  // Find region key; don't pick up key for hbase:meta by mistake.
  String key = null;
  for (Map.Entry<String, HRegion> entry: rs.onlineRegions.entrySet()) {
    if (entry.getValue().getRegionInfo().getTable().equals(this.tableName)) {
      key = entry.getKey();
      break;
    }
  }
  rs.onlineRegions.put(key, spiedRegion);
  Connection conn = testUtil.getConnection();

  try (Table table = conn.getTable(tableName)) {
    table.put(new Put(Bytes.toBytes("row0"))
            .addColumn(family, qualifier, Bytes.toBytes("val0")));
  }
  long oldestSeqIdOfStore = region.getOldestSeqIdOfStore(family);
  LOG.info("CHANGE OLDEST " + oldestSeqIdOfStore);
  assertTrue(oldestSeqIdOfStore > HConstants.NO_SEQNUM);
  rs.cacheFlusher.requestFlush(spiedRegion, false, FlushLifeCycleTracker.DUMMY);
  synchronized (flushed) {
    while (!flushed.booleanValue()) {
      flushed.wait();
    }
  }
  try (Table table = conn.getTable(tableName)) {
    table.put(new Put(Bytes.toBytes("row1"))
            .addColumn(family, qualifier, Bytes.toBytes("val1")));
  }
  long now = EnvironmentEdgeManager.currentTime();
  rs.tryRegionServerReport(now - 500, now);
  synchronized (reported) {
    reported.setValue(true);
    reported.notifyAll();
  }
  while (testUtil.getRSForFirstRegionInTable(tableName) == rs) {
    Thread.sleep(100);
  }
  try (Table table = conn.getTable(tableName)) {
    Result result = table.get(new Get(Bytes.toBytes("row0")));
    assertArrayEquals(Bytes.toBytes("val0"), result.getValue(family, qualifier));
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:69,代码来源:TestSplitWalDataLoss.java


注:本文中的org.apache.commons.lang3.mutable.MutableBoolean.booleanValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。