本文整理匯總了Java中net.openhft.chronicle.core.OS.TARGET屬性的典型用法代碼示例。如果您正苦於以下問題:Java OS.TARGET屬性的具體用法?Java OS.TARGET怎麽用?Java OS.TARGET使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類net.openhft.chronicle.core.OS
的用法示例。
在下文中一共展示了OS.TARGET屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: test
@Test
public void test() throws IOException {
final File cacheRoot = new File(OS.TARGET + "/test.cm3");
ChronicleMapBuilder<byte[], byte[]> shaToNodeBuilder =
ChronicleMapBuilder.of(byte[].class, byte[].class)
// .name("bytes-to-bytes")
.entries(1000000).
averageKeySize(20).
averageValueSize(30);
ChronicleMap<byte[], byte[]> shaToNode =
shaToNodeBuilder.createPersistedTo(cacheRoot);
shaToNode.put("1".getBytes(), "2".getBytes());
shaToNodeBuilder.createPersistedTo(cacheRoot);
}
示例2: testWithAsQueueService
@Test
public void testWithAsQueueService() {
// acts as three processes in one test
// process A writes to the HelloWorld interface.
// process B read fromt he HelloWorld interface and writes to the
String input = OS.TARGET + "/input-" + System.nanoTime();
String output = OS.TARGET + "/output-" + System.nanoTime();
HelloReplier replier = createMock(HelloReplier.class);
replier.reply("Hello April");
replier.reply("Hello June");
replay(replier);
ServiceWrapperBuilder<HelloReplier> builder = ServiceWrapperBuilder
.serviceBuilder(input, output, HelloReplier.class, HelloWorldImpl::new)
.inputSourceId(1).outputSourceId(2);
try (CloseableHelloWorld helloWorld = builder.inputWriter(CloseableHelloWorld.class);
MethodReader replyReader = builder.outputReader(replier);
ServiceWrapper helloWorldService = builder.get()) {
helloWorld.hello("April");
helloWorld.hello("June");
System.out.println(helloWorldService.inputQueues()[0].dump());
for (int i = 0; i < 2; i++) {
while (!replyReader.readOne()) {
Thread.yield();
}
}
System.out.println(helloWorldService.outputQueue().dump());
verify(replier);
} finally {
IOTools.deleteDirWithFiles(new File(input), 2);
IOTools.deleteDirWithFiles(new File(output), 2);
}
}