Search in sources :

Example 11 with UncheckedIOException

use of java.io.UncheckedIOException in project neo4j by neo4j.

the class NativeLabelScanReader method nodesWithLabel.

@Override
public PrimitiveLongIterator nodesWithLabel(int labelId) {
    RawCursor<Hit<LabelScanKey, LabelScanValue>, IOException> cursor;
    try {
        ensureOpenCursorsClosed();
        cursor = seekerForLabel(labelId);
        openCursors.offer(cursor);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return new LabelScanValueIterator(cursor);
}
Also used : Hit(org.neo4j.index.internal.gbptree.Hit) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException)

Example 12 with UncheckedIOException

use of java.io.UncheckedIOException in project neo4j by neo4j.

the class NativeLabelScanReader method iteratorsForLabels.

private List<PrimitiveLongIterator> iteratorsForLabels(int[] labelIds) {
    List<PrimitiveLongIterator> iterators = new ArrayList<>();
    try {
        ensureOpenCursorsClosed();
        for (int labelId : labelIds) {
            RawCursor<Hit<LabelScanKey, LabelScanValue>, IOException> cursor = seekerForLabel(labelId);
            openCursors.offer(cursor);
            iterators.add(new LabelScanValueIterator(cursor));
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return iterators;
}
Also used : PrimitiveLongIterator(org.neo4j.collection.primitive.PrimitiveLongIterator) Hit(org.neo4j.index.internal.gbptree.Hit) ArrayList(java.util.ArrayList) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException)

Example 13 with UncheckedIOException

use of java.io.UncheckedIOException in project neo4j by neo4j.

the class RestartableFileSystemWatcher method stopWatching.

@Override
public void stopWatching() {
    try {
        IOUtils.closeAll(watchedResources);
        watchedResources.clear();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    } finally {
        delegate.stopWatching();
    }
}
Also used : UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException)

Example 14 with UncheckedIOException

use of java.io.UncheckedIOException in project neo4j by neo4j.

the class GraphStoreFixture method startLabelScanStore.

private LabelScanStore startLabelScanStore(Config config, Dependencies dependencies, KernelContext kernelContext) {
    // Load correct LSS from kernel extensions
    LifeSupport life = new LifeSupport();
    KernelExtensions extensions = life.add(new KernelExtensions(kernelContext, (Iterable) load(KernelExtensionFactory.class), dependencies, ignore()));
    life.start();
    LabelScanStore labelScanStore = extensions.resolveDependency(LabelScanStoreProvider.class, new NamedLabelScanStoreSelectionStrategy(config)).getLabelScanStore();
    life.shutdown();
    // Start the selected LSS
    try {
        labelScanStore.init();
        labelScanStore.start();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return labelScanStore;
}
Also used : LabelScanStore(org.neo4j.kernel.api.labelscan.LabelScanStore) LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) KernelExtensions(org.neo4j.kernel.extension.KernelExtensions) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) UncheckedIOException(java.io.UncheckedIOException) KernelExtensionFactory(org.neo4j.kernel.extension.KernelExtensionFactory) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) NamedLabelScanStoreSelectionStrategy(org.neo4j.kernel.extension.dependency.NamedLabelScanStoreSelectionStrategy)

Example 15 with UncheckedIOException

use of java.io.UncheckedIOException in project es6draft by anba.

the class ChakraTest method readSettings.

private static Map<String, TestSetting> readSettings(Path dir) {
    Path settingsFile = dir.resolve("rlexe.xml");
    if (Files.isRegularFile(settingsFile)) {
        try (Reader reader = bomReader(Files.newInputStream(settingsFile))) {
            Document doc = Resources.xml(reader);
            NodeList elements = doc.getElementsByTagName("default");
            HashMap<String, TestSetting> settingMap = new HashMap<>();
            for (int i = 0, length = elements.getLength(); i < length; ++i) {
                Element element = (Element) elements.item(i);
                String files = element.getElementsByTagName("files").item(0).getTextContent();
                TestSetting setting = new TestSetting();
                NodeList baseline = element.getElementsByTagName("baseline");
                if (baseline.getLength() > 0) {
                    setting.baseline = baseline.item(0).getTextContent();
                }
                NodeList compileFlags = element.getElementsByTagName("compile-flags");
                if (compileFlags.getLength() > 0) {
                    String flags = compileFlags.item(0).getTextContent();
                    setting.disabled = flags.contains("-verbose") || flags.contains("-dump:") || flags.contains("-trace:") || flags.contains("-testtrace:") || flags.contains("-testTrace:");
                }
                settingMap.putIfAbsent(files, setting);
            }
            return settingMap;
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
    return Collections.emptyMap();
}
Also used : Path(java.nio.file.Path) HashMap(java.util.HashMap) NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) Document(org.w3c.dom.Document)

Aggregations

UncheckedIOException (java.io.UncheckedIOException)64 IOException (java.io.IOException)60 Path (java.nio.file.Path)12 File (java.io.File)6 ArrayList (java.util.ArrayList)6 Arrays (java.util.Arrays)6 Test (org.junit.Test)6 InputStream (java.io.InputStream)5 HashMap (java.util.HashMap)5 BufferedReader (java.io.BufferedReader)4 URL (java.net.URL)4 List (java.util.List)4 Map (java.util.Map)4 Collectors (java.util.stream.Collectors)4 IntStream (java.util.stream.IntStream)4 Protein (de.bioforscher.jstructure.model.structure.Protein)3 InterruptedIOException (java.io.InterruptedIOException)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Stream (java.util.stream.Stream)3 ServletException (javax.servlet.ServletException)3