本文整理汇总了Java中org.apache.commons.lang.mutable.MutableObject类的典型用法代码示例。如果您正苦于以下问题:Java MutableObject类的具体用法?Java MutableObject怎么用?Java MutableObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MutableObject类属于org.apache.commons.lang.mutable包,在下文中一共展示了MutableObject类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assignNodeLocalContainers
import org.apache.commons.lang.mutable.MutableObject; //导入依赖的package包/类
private Resource assignNodeLocalContainers(Resource clusterResource,
ResourceRequest nodeLocalResourceRequest, FiCaSchedulerNode node,
FiCaSchedulerApp application, Priority priority,
RMContainer reservedContainer, MutableObject allocatedContainer,
ResourceLimits currentResoureLimits) {
if (canAssign(application, priority, node, NodeType.NODE_LOCAL,
reservedContainer)) {
return assignContainer(clusterResource, node, application, priority,
nodeLocalResourceRequest, NodeType.NODE_LOCAL, reservedContainer,
allocatedContainer, currentResoureLimits);
}
return Resources.none();
}
示例2: assignRackLocalContainers
import org.apache.commons.lang.mutable.MutableObject; //导入依赖的package包/类
private Resource assignRackLocalContainers(Resource clusterResource,
ResourceRequest rackLocalResourceRequest, FiCaSchedulerNode node,
FiCaSchedulerApp application, Priority priority,
RMContainer reservedContainer, MutableObject allocatedContainer,
ResourceLimits currentResoureLimits) {
if (canAssign(application, priority, node, NodeType.RACK_LOCAL,
reservedContainer)) {
return assignContainer(clusterResource, node, application, priority,
rackLocalResourceRequest, NodeType.RACK_LOCAL, reservedContainer,
allocatedContainer, currentResoureLimits);
}
return Resources.none();
}
示例3: assignOffSwitchContainers
import org.apache.commons.lang.mutable.MutableObject; //导入依赖的package包/类
private Resource assignOffSwitchContainers(Resource clusterResource,
ResourceRequest offSwitchResourceRequest, FiCaSchedulerNode node,
FiCaSchedulerApp application, Priority priority,
RMContainer reservedContainer, MutableObject allocatedContainer,
ResourceLimits currentResoureLimits) {
if (canAssign(application, priority, node, NodeType.OFF_SWITCH,
reservedContainer)) {
return assignContainer(clusterResource, node, application, priority,
offSwitchResourceRequest, NodeType.OFF_SWITCH, reservedContainer,
allocatedContainer, currentResoureLimits);
}
return Resources.none();
}
示例4: queryByExpiryTime
import org.apache.commons.lang.mutable.MutableObject; //导入依赖的package包/类
@Override
public ActivityQueryResponse queryByExpiryTime(CallingContext context, final String nextBatchId, Long batchSize, final Long lastSeen) {
if (batchSize > MAX_BATCH_SIZE) {
log.warn(String.format("Batch size %s is too large, resetting to maximum of %s", batchSize, MAX_BATCH_SIZE));
batchSize = MAX_BATCH_SIZE;
}
final MutableObject lastId = new MutableObject();
final long finalBatchSize = batchSize;
final List<Activity> activities = new LinkedList<>();
ActivityStorage.visitAll(new RepoVisitor() {
@Override
public boolean visit(String name, JsonContent content, boolean isFolder) {
if (activities.size() < finalBatchSize) {
Activity activity = ActivityStorage.readFromJson(content);
String currentId = activity.getId();
if ((nextBatchId.length() == 0 || currentId.compareTo(nextBatchId) > 0) && activity.getLastSeen() > lastSeen) {
activities.add(activity);
lastId.setValue(currentId);
}
return true;
} else {
return false;
}
}
});
ActivityQueryResponse response = new ActivityQueryResponse();
response.setActivities(activities);
boolean isLast = activities.size() < batchSize;
response.setIsLast(isLast);
if (!isLast) {
String responseNextId = lastId.getValue().toString();
response.setNextBatchId(responseNextId);
}
return response;
}
示例5: run
import org.apache.commons.lang.mutable.MutableObject; //导入依赖的package包/类
@Override
public <R> R run(Supplier<R> function) {
// runBackground synchronously on JavaFX thread
if (Platform.isFxApplicationThread()) {
return function.get();
}
// queue on JavaFX thread and wait for completion
final CountDownLatch doneLatch = new CountDownLatch(1);
final MutableObject result = new MutableObject();
Platform.runLater(() -> {
try {
result.setValue(function.get());
} finally {
doneLatch.countDown();
}
});
try {
doneLatch.await();
} catch (InterruptedException e) {
// ignore exception
}
return (R) result.getValue();
}
示例6: shell
import org.apache.commons.lang.mutable.MutableObject; //导入依赖的package包/类
public static int shell(String[] command, final StringBuilder stdout, final StringBuilder stderr, MutableObject processCapture) throws InterruptedException, IOException {
return shell(Collections.EMPTY_MAP, command, stdout, stderr, processCapture);
}
示例7: doTestReplace
import org.apache.commons.lang.mutable.MutableObject; //导入依赖的package包/类
private void doTestReplace(String expectedResult, String replaceTemplate, boolean substring) {
String expectedShortResult = expectedResult.substring(1, expectedResult.length() - 1);
StrSubstitutor sub = new StrSubstitutor(values);
// replace using String
assertEquals(expectedResult, sub.replace(replaceTemplate));
if (substring) {
assertEquals(expectedShortResult, sub.replace(replaceTemplate, 1, replaceTemplate.length() - 2));
}
// replace using char[]
char[] chars = replaceTemplate.toCharArray();
assertEquals(expectedResult, sub.replace(chars));
if (substring) {
assertEquals(expectedShortResult, sub.replace(chars, 1, chars.length - 2));
}
// replace using StringBuffer
StringBuffer buf = new StringBuffer(replaceTemplate);
assertEquals(expectedResult, sub.replace(buf));
if (substring) {
assertEquals(expectedShortResult, sub.replace(buf, 1, buf.length() - 2));
}
// replace using StrBuilder
StrBuilder bld = new StrBuilder(replaceTemplate);
assertEquals(expectedResult, sub.replace(bld));
if (substring) {
assertEquals(expectedShortResult, sub.replace(bld, 1, bld.length() - 2));
}
// replace using object
MutableObject obj = new MutableObject(replaceTemplate); // toString returns template
assertEquals(expectedResult, sub.replace(obj));
// replace in StringBuffer
buf = new StringBuffer(replaceTemplate);
assertEquals(true, sub.replaceIn(buf));
assertEquals(expectedResult, buf.toString());
if (substring) {
buf = new StringBuffer(replaceTemplate);
assertEquals(true, sub.replaceIn(buf, 1, buf.length() - 2));
assertEquals(expectedResult, buf.toString()); // expect full result as remainder is untouched
}
// replace in StrBuilder
bld = new StrBuilder(replaceTemplate);
assertEquals(true, sub.replaceIn(bld));
assertEquals(expectedResult, bld.toString());
if (substring) {
bld = new StrBuilder(replaceTemplate);
assertEquals(true, sub.replaceIn(bld, 1, bld.length() - 2));
assertEquals(expectedResult, bld.toString()); // expect full result as remainder is untouched
}
}