本文整理了Java中org.uberfire.java.nio.file.WatchService
类的一些代码示例,展示了WatchService
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WatchService
类的具体详情如下:
包路径:org.uberfire.java.nio.file.WatchService
类名称:WatchService
暂无
代码示例来源:origin: kiegroup/appformer
@PreDestroy
private void shutdown() {
executorService.shutdown();
active = false;
if (ws != null) {
ws.close();
}
}
代码示例来源:origin: kiegroup/appformer
@Override
public void run() {
while (!isDisposed && !ws.isClose()) {
final WatchKey wk;
try {
wk = ws.take();
} catch (final Exception ex) {
break;
代码示例来源:origin: org.uberfire/uberfire-nio2-model
@Override
public WatchKey register(WatchService watcher,
Kind<?>... events)
throws UnsupportedOperationException, IllegalArgumentException,
ClosedWatchServiceException, IOException, SecurityException {
return watcher.poll();
}
代码示例来源:origin: org.uberfire/uberfire-metadata-commons-io
private void cleanupDeletedFS(FileSystem fs) {
WatchService ws = watchServicesByFS.remove(fs.getName());
if (ws != null && !ws.isClose()) {
ws.close();
}
fs.getRootDirectories().forEach(rootPath -> indexEngine.delete(KObjectUtil.toKCluster(rootPath)));
}
代码示例来源:origin: kiegroup/appformer
@Override
public void execute(final IOWatchServiceExecutor wsExecutor) {
while (!isDisposed) {
final WatchKey wk;
try {
wk = ws.take();
} catch (final Exception ex) {
break;
}
try {
wsExecutor.execute(wk,
AbstractIOWatchService.this);
} catch (final Exception ex) {
LOG.error("Unexpected error during WatchService execution",
ex);
}
// Reset the key -- this step is critical if you want to
// receive further watch events. If the key is no longer valid,
// the directory is inaccessible so exit the loop.
boolean valid = wk.reset();
if (!valid) {
break;
}
}
}
代码示例来源:origin: org.guvnor/guvnor-structure-backend
wk = ws.take();
} catch (final Exception ex) {
break;
代码示例来源:origin: kiegroup/appformer
private void cleanupDeletedFS(FileSystem fs) {
WatchService ws = watchServicesByFS.remove(fs.getName());
if (ws != null && !ws.isClose()) {
ws.close();
}
fs.getRootDirectories().forEach(rootPath -> indexEngine.delete(KObjectUtil.toKCluster(rootPath)));
}
代码示例来源:origin: org.uberfire/uberfire-metadata-commons-io
@Override
public void dispose() {
watchServicesByFS.values()
.forEach(ws -> ws.close());
activeIndexerDispatchers.forEach(d -> d.dispose());
super.dispose();
}
代码示例来源:origin: kiegroup/appformer
wk = ws.take();
} catch (final Exception ex) {
break;
代码示例来源:origin: org.uberfire/uberfire-nio2-model
@Override
public WatchKey register(WatchService watcher,
Kind<?>[] events,
Modifier... modifiers)
throws UnsupportedOperationException, IllegalArgumentException,
ClosedWatchServiceException, IOException, SecurityException {
return watcher.poll();
}
代码示例来源:origin: org.uberfire/uberfire-metadata-commons-io
@Override
public void run() {
while (!isDisposed && !ws.isClose()) {
final WatchKey wk;
try {
wk = ws.take();
} catch (final Exception ex) {
break;
代码示例来源:origin: kiegroup/appformer
@Override
public void dispose() {
watchServicesByFS.values()
.forEach(ws -> ws.close());
activeIndexerDispatchers.forEach(d -> d.dispose());
super.dispose();
}
代码示例来源:origin: kiegroup/appformer
wk = ws.take();
} catch (final Exception ex) {
break;
代码示例来源:origin: kiegroup/appformer
@Override
public WatchKey register(WatchService watcher,
Kind<?>... events)
throws UnsupportedOperationException, IllegalArgumentException,
ClosedWatchServiceException, IOException, SecurityException {
return watcher.poll();
}
代码示例来源:origin: org.guvnor/guvnor-structure-backend
watchService.close();
代码示例来源:origin: kiegroup/appformer
StandardWatchEventKind.ENTRY_RENAME);
final WatchKey k = ws.take();
代码示例来源:origin: kiegroup/appformer
@Override
public WatchKey register(WatchService watcher,
Kind<?>[] events,
Modifier... modifiers)
throws UnsupportedOperationException, IllegalArgumentException,
ClosedWatchServiceException, IOException, SecurityException {
return watcher.poll();
}
代码示例来源:origin: kiegroup/appformer
@PreDestroy
protected void dispose() {
isDisposed = true;
for (final WatchService watchService : watchServices) {
watchService.close();
}
for (final Future<?> job : jobs) {
if (!job.isCancelled() && !job.isDone()) {
job.cancel(true);
}
}
executorService.shutdown(); // Disable new tasks from being submitted
try {
// Wait a while for existing tasks to terminate
if (!executorService.awaitTermination(AWAIT_TERMINATION_TIMEOUT,
TimeUnit.SECONDS)) {
executorService.shutdownNow(); // Cancel currently executing tasks
// Wait a while for tasks to respond to being cancelled
if (!executorService.awaitTermination(AWAIT_TERMINATION_TIMEOUT,
TimeUnit.SECONDS)) {
LOG.error("Thread pool did not terminate");
}
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
executorService.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
}
代码示例来源:origin: org.uberfire/uberfire-nio2-jgit
StandardWatchEventKind.ENTRY_RENAME);
final WatchKey k = ws.take();
代码示例来源:origin: kiegroup/appformer
false);
List<WatchEvent<?>> watchEvents = fsDora1.poll().pollEvents();
assertEquals(3,
watchEvents.size());
watchEvents = fsDora2.poll().pollEvents();
assertEquals(3,
watchEvents.size());
false);
watchEvents = fsDora2.poll().pollEvents();
assertEquals(3,
watchEvents.size());
watchEvents = fsDora2.poll().pollEvents();
assertEquals(2,
watchEvents.size());
watchEvents = fsDora1.poll().pollEvents();
assertEquals(3,
watchEvents.size());
watchEvents = fsDora1.poll().pollEvents();
assertEquals(2,
watchEvents.size());
内容来源于网络,如有侵权,请联系作者删除!