void loadLayers()

in atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosStorage.java [51:88]


    void loadLayers(File root) throws IOException
    {
        atomos.lockWrite();
        try (DataInputStream in = new DataInputStream(
            new BufferedInputStream(new FileInputStream(new File(root, ATOMOS_STORE)))))
        {
            atomos.debug("Found %s in %s", ATOMOS_STORE, root);
            int persistentVersion = in.readInt();
            if (persistentVersion > VERSION)
            {
                throw new IOException(
                    "Atomos persistent version is greater than supported version: "
                        + VERSION + "<" + persistentVersion);
            }
            long nextLayerId = in.readLong();
            int numLayers = in.readInt();
            if (numLayers > 1 && !atomos.getBootLayer().isAddLayerSupported())
            {
                System.out.println(
                    "Atomos persistent layers are ignored because Atomos is not loaded as a module.");
                return;
            }
            for (int i = 0; i < numLayers; i++)
            {
                readLayer(in);
            }
            atomos.nextLayerId.set(nextLayerId);
        }
        catch (FileNotFoundException e)
        {
            // ignore no file
            atomos.debug("No %s found in %s", ATOMOS_STORE, root);
        }
        finally
        {
            atomos.unlockWrite();
        }
    }