/*
private boolean isLoadingOnWorkerNode() {
String jarLoc = Utils.jarLoc();
if (jarLoc != null && sparkHome != null) {
return jarLoc.indexOf(sparkHome, 0) > -1;
}
return false;
}
168441
public void load(ScriptEngine engine) {
        try {
            //module loading
            engine.eval("load('" + getResourceAsURLStirng("/eclairjs/EclairJS_Globals.js") + "');");
            engine.eval("load('" + getResourceAsURLStirng("/eclairjs/ModuleUtils.js") + "');");
            engine.eval("load('" + getResourceAsURLStirng("/eclairjs/jvm-npm/jvm-npm.js") + "');");
            engine.eval("load('" + getResourceAsURLStirng("/eclairjs/Serialize.js") + "');");

            NashornEngineSingleton.setEngine(engine);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
827993
private static boolean checkDownloadPath() {
        if (Checker.isNotEmpty(storageFolder)) {
            File file = new File(storageFolder);
            if (!file.exists() && file.mkdirs()) {
                logger.info("mkdir '" + storageFolder + "' success");
            }
            return true;
        }
        return false;
    }
1022621
@Nullable
  public boolean loadLibraries() {
    synchronized (mLock) {
      if (mLoadLibraries == false) {
        return mLibrariesLoaded;
      }
      try {
        if (mLibraryNames != null) {
          for (String name : mLibraryNames) {
            SoLoader.loadLibrary(name);
          }
        }
        initialNativeCheck();
        mLibrariesLoaded = true;
        mLibraryNames = null;
      } catch (UnsatisfiedLinkError error) {
        Log.e(TAG, "Failed to load native lib (initial check): ", error);
        mLinkError = error;
        mLibrariesLoaded = false;
      } catch (Throwable other) {
        Log.e(TAG, "Failed to load native lib (other error): ", other);
        mLinkError = new UnsatisfiedLinkError("Failed loading libraries");
        mLinkError.initCause(other);
        mLibrariesLoaded = false;
      }
      mLoadLibraries = false;
      return mLibrariesLoaded;
    }
  }
362427
public Integer getLoadOnStartup()
   {
      if (childNode.getTextValueForPatternName("load-on-startup") != null && !childNode.getTextValueForPatternName("load-on-startup").equals("null")) {
         return Integer.valueOf(childNode.getTextValueForPatternName("load-on-startup"));
      }
      return null;
   }
1366260
boolean onSplitWork(int bytesMoved) {
        if (_splitTargetRemaining <= 0) {
            _splitTargetRemaining = _splitTargetSize - bytesMoved;
            return true;
        } else {
            _splitTargetRemaining -= bytesMoved;
            return false;
        }
    }
342581
@Override
    public boolean isDirectory() {
        final ArchivePath archivePath = ArchivePaths.create(path.toString());
        Node node = archive.get(archivePath);
        return node.getAsset() == null;
    }
586093
boolean corralIfNeeded(Collection<Unit> working) {
        if (isRecoverable()
                && si.corralled() != null) {
            activeGuts = si.corralled();
            setWrap(working, working);
            return isAttemptingCorral = true;
        }
        return isAttemptingCorral = false;
    }
112387
public synchronized boolean isAlive() {
        if(original!=null && original.isAlive())
            return true;

        for (Entry<String,RangeSet> e : usages.entrySet()) {
            Job j = Jenkins.getInstance().getItemByFullName(e.getKey(),Job.class);
            if(j==null)
                continue;

            Run firstBuild = j.getFirstBuild();
            if(firstBuild==null)
                continue;

            int oldest = firstBuild.getNumber();
            if(!e.getValue().isSmallerThan(oldest))
                return true;
        }
        return false;
    }
507983
public int run() throws IOException {
    List<WorkerLostStorageInfo> workerLostStorageList = mBlockMasterClient.getWorkerLostStorage();
    if (workerLostStorageList.size() == 0) {
      mPrintStream.println("All worker storage paths are in working state.");
      return 0;
    }
    for (WorkerLostStorageInfo info : workerLostStorageList) {
      Map<String, StorageList> lostStorageMap = info.getLostStorageMap();
      if (lostStorageMap.size() != 0) {
        mPrintStream.printf("The following storage paths are lost in worker %s: %n",
            info.getAddress().getHost());
        for (Map.Entry<String, StorageList> tierStorage : lostStorageMap.entrySet()) {
          for (String storage : tierStorage.getValue().getStorageList()) {
            mPrintStream.printf("%s (%s)%n", storage, tierStorage.getKey());
          }
        }
      }
    }
    return 0;
  }
237992
public boolean isDirectory() {
        if (this.file != null) {
            return this.file.isDirectory();
        }

        if (this.header != null) {
            if (this.header.linkFlag == TarHeader.LF_DIR) {
                return true;
            }

            if (this.header.name.toString().endsWith("/")) {
                return true;
            }
        }

        return false;
    }
1041637
public boolean isFileServingEnabled() {
        // PK54499 START
        disallowAllFileServingProp = WCCustomProperties.DISALLOW_ALL_FILE_SERVING;
        if (disallowAllFileServingProp != null && !this.getApplicationName().equalsIgnoreCase("isclite")) {
            try
            {
                if (Boolean.valueOf(disallowAllFileServingProp).booleanValue())
                {
                    this.fileServingEnabled = Boolean.FALSE;
                }
                if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
                {
                    logger.logp(Level.FINE, CLASS_NAME, "isFileServing", "PK54499: disallowAllFileServingProp set to " + disallowAllFileServingProp + " for application: "
                                    + this.getApplicationName());
                }
            }
            catch (Exception x)
            {
                logger.logp(Level.SEVERE, CLASS_NAME, "isFileServing", "Illegal value set for property com.ibm.ws.webcontainer.disallowallfileserving");
            }
        }
        // PK54499 END

        if (this.fileServingEnabled != null)
            return this.fileServingEnabled.booleanValue();

        return WCCustomProperties.FILE_SERVING_ENABLED;
    }
808578
public boolean loadPrecompiled() {
        if (null == _loadPrecompiled) {
            Boolean b = get(ENGINE_LOAD_PRECOMPILED_ENABLED);
            _loadPrecompiled = b || gae();
        }
        return _loadPrecompiled;
    }
614277
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
                                                     String targetFolder) {
        String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
        // Include architecture name in temporary filename in order to avoid conflicts
        // when multiple JVMs with different architectures running at the same time
        String uuid = UUID.randomUUID().toString();
        String extractedLibFileName = String.format("secp256k1-%s-%s", uuid, libraryFileName);
        String extractedLckFileName = extractedLibFileName + ".lck";

        File extractedLibFile = new File(targetFolder, extractedLibFileName);
        File extractedLckFile = new File(targetFolder, extractedLckFileName);

        try {
            // Extract a native library file into the target directory
            InputStream reader = Secp256k1Loader.class.getResourceAsStream(nativeLibraryFilePath);
            if(!extractedLckFile.exists()) {
                new FileOutputStream(extractedLckFile).close();
            }
            FileOutputStream writer = new FileOutputStream(extractedLibFile);
            try {
                byte[] buffer = new byte[8192];
                int bytesRead = 0;
                while((bytesRead = reader.read(buffer)) != -1) {
                    writer.write(buffer, 0, bytesRead);
                }
            }
            finally {
                // Delete the extracted lib file on JVM exit.
                extractedLibFile.deleteOnExit();
                extractedLckFile.deleteOnExit();


                if(writer != null) {
                    writer.close();
                }
                if(reader != null) {
                    reader.close();
                }
            }

            // Set executable (x) flag to enable Java to load the native library
            extractedLibFile.setReadable(true);
            extractedLibFile.setWritable(true, true);
            extractedLibFile.setExecutable(true);

            // Check whether the contents are properly copied from the resource folder
            {
                InputStream nativeIn = Secp256k1Loader.class.getResourceAsStream(nativeLibraryFilePath);
                InputStream extractedLibIn = new FileInputStream(extractedLibFile);
                try {
                    if(!contentsEquals(nativeIn, extractedLibIn)) {
                        throw new RuntimeException(String.format("Failed to write a native library file at %s", extractedLibFile));
                    }
                }
                finally {
                    if(nativeIn != null) {
                        nativeIn.close();
                    }
                    if(extractedLibIn != null) {
                        extractedLibIn.close();
                    }
                }
            }
            return loadNativeLibrary(targetFolder, extractedLibFileName);
        }
        catch(IOException e) {
            System.err.println(e.getMessage());
            return false;
        }

    }
702781
public static synchronized boolean isNativeLoaded() {
        try {
            return isSigarAlreadyLoaded();
        } catch (final Throwable e) {
            try {
                final Sigar sigar = new Sigar();
                sigar.getPid();
                sigar.close();
                return true;
            } catch (final Throwable ex) {
                return false;
            }
        }
    }
620480
private static boolean isSigarAlreadyLoaded() throws Exception {
        final String libraryName = new SigarLoader(Sigar.class).getLibraryName();
        final Field loadedLibraryNames = ClassLoader.class.getDeclaredField("loadedLibraryNames");
		loadedLibraryNames.setAccessible(true);
        final Collection<String> libraries = (Collection<String>) loadedLibraryNames.get(SigarProvisioner.class.getClassLoader());

        for (String library: libraries) {
            if(library.contains(libraryName)) return true;
        }
        return false;
    }
260317
private boolean bufferLocalFileHeader() throws IOException {
        buffer.reset();
        JarEntry jarEntry = virtualJarInputStream.getNextJarEntry();

        if (jarEntry == null) { return false; }

        currentEntry = new ProcessedEntry(jarEntry, totalRead);
        processedEntries.add(currentEntry);


        bufferInt(ZipEntry.LOCSIG);    // Local file header signature
        bufferShort(10);               // Extraction version
        bufferShort(0);                // Flags
        bufferShort(ZipEntry.STORED);  // Compression type
        bufferInt(jarEntry.getTime()); // Entry time
        bufferInt(0);                  // CRC
        bufferInt(0);                  // Compressed size
        bufferInt(0);                  // Uncompressed size
        byte[] nameBytes = jarEntry.getName().getBytes("UTF8");
        bufferShort(nameBytes.length); // Entry name length
        bufferShort(0);                // Extra length
        buffer(nameBytes);
        return true;
    }
556120
public boolean reloadIsModified()
  {
    if (_classIsModified) {
      return true;
    }

    if (! _hasJNIReload || ! _classPath.canRead()) {
      return true;
    }
    
    try {
      long length = _classPath.length();

      Class<?> cl = _clRef != null ? _clRef.get() : null;

      if (cl == null) {
        return false;
      }

      /*
      if (cl.isAnnotationPresent(RequireReload.class))
        return true;
        */

      byte []bytecode = new byte[(int) length];
      try (InputStream is = _classPath.inputStream()) {
        IoUtil.readAll(is, bytecode, 0, bytecode.length);
      }

      int result = reloadNative(cl, bytecode, 0, bytecode.length);

      if (result != 0) {
        _classIsModified = true;
        return true;
      }

      // XXX: setDependPath(_classPath);

      if (_sourcePath != null) {
        _sourceLastModified = _sourcePath.getLastModified();
        _sourceLength = _sourcePath.length();
      }

      log.info("Reloading " + cl.getName());

      return false;
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
      _classIsModified = true;

      return true;
    }
  }