本文整理汇总了Java中scala.runtime.BoxedUnit类的典型用法代码示例。如果您正苦于以下问题:Java BoxedUnit类的具体用法?Java BoxedUnit怎么用?Java BoxedUnit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BoxedUnit类属于scala.runtime包,在下文中一共展示了BoxedUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: letOverridesDefault
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Test public void letOverridesDefault() {
final String override = "localhost:9410";
final AtomicBoolean ran = new AtomicBoolean();
Function0<BoxedUnit> fn0 = new AbstractFunction0<BoxedUnit>() {
@Override public BoxedUnit apply() {
ran.set(true); // used to verify this block is executed.
assertThat(host$.Flag.isDefined()).isTrue();
assertThat(host$.Flag.apply()).isEqualTo(override);
return BoxedUnit.UNIT;
}
};
host$.Flag.let(override, fn0);
assertThat(ran.get()).isTrue();
}
示例2: letOverridesDefault
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Test public void letOverridesDefault() {
final String override = "amazon";
final AtomicBoolean ran = new AtomicBoolean();
Function0<BoxedUnit> fn0 = new AbstractFunction0<BoxedUnit>() {
@Override public BoxedUnit apply() {
ran.set(true); // used to verify this block is executed.
assertThat(hostHeader$.Flag.isDefined()).isTrue();
assertThat(hostHeader$.Flag.apply()).isEqualTo(override);
return BoxedUnit.UNIT;
}
};
hostHeader$.Flag.let(override, fn0);
assertThat(ran.get()).isTrue();
}
示例3: letOverridesDefault
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Test public void letOverridesDefault() {
final String override = "foo:9411";
final AtomicBoolean ran = new AtomicBoolean();
Function0<BoxedUnit> fn0 = new AbstractFunction0<BoxedUnit>() {
@Override public BoxedUnit apply() {
ran.set(true); // used to verify this block is executed.
assertThat(host$.Flag.isDefined()).isTrue();
assertThat(host$.Flag.apply()).isEqualTo(override);
return BoxedUnit.UNIT;
}
};
host$.Flag.let(override, fn0);
assertThat(ran.get()).isTrue();
}
示例4: letOverridesDefault
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Test public void letOverridesDefault() {
final boolean override = false;
final AtomicBoolean ran = new AtomicBoolean();
Function0<BoxedUnit> fn0 = new AbstractFunction0<BoxedUnit>() {
@Override public BoxedUnit apply() {
ran.set(true); // used to verify this block is executed.
assertThat(compressionEnabled$.Flag.isDefined()).isTrue();
assertThat(compressionEnabled$.Flag.apply()).isEqualTo(override);
return BoxedUnit.UNIT;
}
};
compressionEnabled$.Flag.let(override, fn0);
assertThat(ran.get()).isTrue();
}
示例5: sendSpans
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Override public void sendSpans(final List<byte[]> spans, final Callback callback) {
Trace.letClear(new AbstractFunction0<Void>() {
@Override public Void apply() {
try {
if (closeCalled) throw new IllegalStateException("closed");
client.apply(makeRequest(spans)).respond(new AbstractFunction1<Try<Rep>, BoxedUnit>() {
@Override public BoxedUnit apply(Try<Rep> result) {
if (result.isReturn()) {
callback.onComplete();
} else {
callback.onError(result.throwable());
}
return BoxedUnit.UNIT;
}
});
} catch (Throwable e) {
callback.onError(e);
if (e instanceof Error) throw (Error) e;
}
return null;
}
});
}
示例6: letOverridesDefault
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Test public void letOverridesDefault() {
final float override = 1.0f;
final AtomicBoolean ran = new AtomicBoolean();
Function0<BoxedUnit> fn0 = new AbstractFunction0<BoxedUnit>() {
@Override public BoxedUnit apply() {
ran.set(true); // used to verify this block is executed.
assertThat(initialSampleRate$.Flag.isDefined()).isTrue();
assertThat(initialSampleRate$.Flag.apply()).isEqualTo(override);
return BoxedUnit.UNIT;
}
};
initialSampleRate$.Flag.let(override, fn0);
assertThat(ran.get()).isTrue();
}
示例7: letOverridesDefault
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Test public void letOverridesDefault() {
final String override = "zipkin-dev";
final AtomicBoolean ran = new AtomicBoolean();
Function0<BoxedUnit> fn0 = new AbstractFunction0<BoxedUnit>() {
@Override public BoxedUnit apply() {
ran.set(true); // used to verify this block is executed.
assertThat(topic$.Flag.isDefined()).isTrue();
assertThat(topic$.Flag.apply()).isEqualTo(override);
return BoxedUnit.UNIT;
}
};
topic$.Flag.let(override, fn0);
assertThat(ran.get()).isTrue();
}
示例8: letOverridesDefault
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Test public void letOverridesDefault() {
final List<InetSocketAddress> override = singletonList(new InetSocketAddress("zipkin", 9092));
final AtomicBoolean ran = new AtomicBoolean();
Function0<BoxedUnit> fn0 = new AbstractFunction0<BoxedUnit>() {
@Override public BoxedUnit apply() {
ran.set(true); // used to verify this block is executed.
assertThat(bootstrapServers$.Flag.isDefined()).isTrue();
assertThat(bootstrapServers$.Flag.apply()).isEqualTo(override);
return BoxedUnit.UNIT;
}
};
bootstrapServers$.Flag.let(override, fn0);
assertThat(ran.get()).isTrue();
}
示例9: handleMessage
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Override
public PartialFunction<Object, BoxedUnit> handleMessage() {
return ReceiveBuilder.match(
JobManagerMessages.RecoverSubmittedJob.class,
new FI.UnitApply<JobManagerMessages.RecoverSubmittedJob>() {
@Override
public void apply(JobManagerMessages.RecoverSubmittedJob submitJob) throws Exception {
recoveredJobs.add(submitJob.submittedJobGraph().getJobId());
}
}).matchAny(new FI.UnitApply<Object>() {
@Override
public void apply(Object o) throws Exception {
TestingFailingHAJobManager.super.handleMessage().apply(o);
}
}).build();
}
示例10: deleteLedger
import scala.runtime.BoxedUnit; //导入依赖的package包/类
void deleteLedger(final long ledgerId) {
final Future<Void> deleteFuture = bkc.deleteLedger(ledgerId, true);
synchronized (ledgerDeletions) {
ledgerDeletions.add(deleteFuture);
}
deleteFuture.onFailure(new AbstractFunction1<Throwable, BoxedUnit>() {
@Override
public BoxedUnit apply(Throwable cause) {
LOG.error("Error deleting ledger {} for ledger allocator {}, retrying : ",
new Object[] { ledgerId, allocatePath, cause });
if (!isClosing()) {
deleteLedger(ledgerId);
}
return BoxedUnit.UNIT;
}
}).ensure(new AbstractFunction0<BoxedUnit>() {
@Override
public BoxedUnit apply() {
synchronized (ledgerDeletions) {
ledgerDeletions.remove(deleteFuture);
}
return BoxedUnit.UNIT;
}
});
}
示例11: createLock
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Override
public Future<SessionLock> createLock(String lockPath,
DistributedLockContext context) {
AtomicInteger numRetries = new AtomicInteger(lockCreationRetries);
final AtomicReference<Throwable> interruptedException = new AtomicReference<Throwable>(null);
Promise<SessionLock> createPromise =
new Promise<SessionLock>(new com.twitter.util.Function<Throwable, BoxedUnit>() {
@Override
public BoxedUnit apply(Throwable t) {
interruptedException.set(t);
return BoxedUnit.UNIT;
}
});
createLock(
lockPath,
context,
interruptedException,
numRetries,
createPromise,
0L);
return createPromise;
}
示例12: asyncUnlock
import scala.runtime.BoxedUnit; //导入依赖的package包/类
Future<BoxedUnit> asyncUnlock(final Throwable cause) {
final Promise<BoxedUnit> promise = new Promise<BoxedUnit>();
// Use lock executor here rather than lock action, because we want this opertaion to be applied
// whether the epoch has changed or not. The member node is EPHEMERAL_SEQUENTIAL so there's no
// risk of an ABA problem where we delete and recreate a node and then delete it again here.
lockStateExecutor.submit(lockPath, new SafeRunnable() {
@Override
public void safeRun() {
acquireFuture.updateIfEmpty(new Throw<Boolean>(cause));
unlockInternal(promise);
promise.addEventListener(new OpStatsListener<BoxedUnit>(unlockStats));
}
});
return promise;
}
示例13: apply
import scala.runtime.BoxedUnit; //导入依赖的package包/类
@Override
public <T> Future<T> apply(Function0<T> function0) {
if (traceTaskExecution) {
taskPendingCounter.inc();
Stopwatch taskEnqueueStopwatch = Stopwatch.createStarted();
Future<T> futureResult = futurePool.apply(new TimedFunction0<T>(function0));
taskEnqueueTime.registerSuccessfulEvent(taskEnqueueStopwatch.elapsed(TimeUnit.MICROSECONDS));
futureResult.ensure(new com.twitter.util.Function0<BoxedUnit>() {
@Override
public BoxedUnit apply() {
taskPendingCounter.dec();
return null;
}
});
return futureResult;
} else {
return futurePool.apply(function0);
}
}
示例14: apply
import scala.runtime.BoxedUnit; //导入依赖的package包/类
public synchronized Future<T> apply(final Function0<T> fn) {
Preconditions.checkNotNull(fn);
if (closed) {
return Future.exception(new RejectedExecutionException("Operation submitted to closed SafeQueueingFuturePool"));
}
++outstanding;
queue.add(fn);
Future<T> result = orderedFuturePool.apply(new Function0<T>() {
@Override
public T apply() {
return queue.poll().apply();
}
@Override
public String toString() {
return fn.toString();
}
}).ensure(new Function0<BoxedUnit>() {
public BoxedUnit apply() {
if (decrOutstandingAndCheckDone()) {
applyAll();
}
return null;
}
});
return result;
}
示例15: zkAsyncCreateFullPathOptimistic
import scala.runtime.BoxedUnit; //导入依赖的package包/类
/**
* Asynchronously create zookeeper path recursively and optimistically.
*
* @param zkc Zookeeper client
* @param pathToCreate Zookeeper full path
* @param data Zookeeper data
* @param acl Acl of the zk path
* @param createMode Create mode of zk path
*/
public static Future<BoxedUnit> zkAsyncCreateFullPathOptimistic(
final ZooKeeperClient zkc,
final String pathToCreate,
final byte[] data,
final List<ACL> acl,
final CreateMode createMode) {
Optional<String> parentPathShouldNotCreate = Optional.absent();
return zkAsyncCreateFullPathOptimistic(
zkc,
pathToCreate,
parentPathShouldNotCreate,
data,
acl,
createMode);
}