本文整理汇总了Java中net.openhft.chronicle.core.io.IOTools类的典型用法代码示例。如果您正苦于以下问题:Java IOTools类的具体用法?Java IOTools怎么用?Java IOTools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOTools类属于net.openhft.chronicle.core.io包,在下文中一共展示了IOTools类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWithAsQueueService
import net.openhft.chronicle.core.io.IOTools; //导入依赖的package包/类
@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);
}
}
示例2: complete
import net.openhft.chronicle.core.io.IOTools; //导入依赖的package包/类
@Override
public void complete() {
System.out.println("Cleaning up");
IOTools.deleteDirWithFiles(queueIn, 2);
IOTools.deleteDirWithFiles(queue2, 2);
IOTools.deleteDirWithFiles(queue3, 2);
IOTools.deleteDirWithFiles(queueOut, 2);
}
示例3: tearDown
import net.openhft.chronicle.core.io.IOTools; //导入依赖的package包/类
@TearDown
public void tearDown() {
upQueue.close();
downQueue.close();
try {
IOTools.shallowDeleteDirWithFiles(upQueuePath);
IOTools.shallowDeleteDirWithFiles(downQueuePath);
} catch (Exception e) {
}
}
示例4: clean
import net.openhft.chronicle.core.io.IOTools; //导入依赖的package包/类
private synchronized void clean() {
if (isCleaned)
return;
isCleaned = true;
final long usedDirectMemory = Jvm.usedDirectMemory();
IOTools.clean(inBBB.underlyingObject());
IOTools.clean(outBBB.underlyingObject());
if (usedDirectMemory == Jvm.usedDirectMemory())
Jvm.warn().on(getClass(), "nothing cleaned");
}