本文整理匯總了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");
}