Package com.sun.jna

Examples of com.sun.jna.LastErrorException


            logger.info("mlockall() on JVM Heap successful");
        } catch(Exception e) {
            if(!(e instanceof LastErrorException))
                logger.error("Unexpected error during mlock of server heap", e);

            LastErrorException le = (LastErrorException) e;
            if(le.getErrorCode() == ENOMEM && isOperatingSystem("linux")) {
                logger.warn("Unable to lock JVM memory (ENOMEM)."
                            + " This can result in part of the JVM being swapped out with higher Young gen stalls"
                            + " Increase RLIMIT_MEMLOCK or run Voldemort as root.");
            } else if(!isOperatingSystem("mac")) {
                // fixes a OS X oddity, where it still throws an error, even
                // though mlockall succeeds
                logger.warn("Unknown mlockall error " + le.getErrorCode());
            }
        }
    }
View Full Code Here


            munlockall();
            logger.info("munlockall() on JVM Heap successful");
        } catch(Exception e) {
            if(!(e instanceof LastErrorException))
                logger.error("Unexpected error during mlock of server heap", e);
            LastErrorException le = (LastErrorException) e;
            logger.warn("Error unlocking JVM heap  " + le.getErrorCode());
        }
    }
View Full Code Here

                        | WinBase.FORMAT_MESSAGE_FROM_SYSTEM
                        | WinBase.FORMAT_MESSAGE_IGNORE_INSERTS, null, code, 0, // TODO:
                                                                                // MAKELANGID(LANG_NEUTRAL,
                                                                                // SUBLANG_DEFAULT)
                buffer, 0, null)) {
            throw new LastErrorException(Kernel32.INSTANCE.GetLastError());
        }
        String s = buffer.getValue().getWideString(0);
        Kernel32.INSTANCE.LocalFree(buffer.getValue());
        return s.trim();
    }
View Full Code Here

                code.intValue(),
                0, // TODO: MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)
                buffer,
                0,
                null)) {
          throw new LastErrorException(Kernel32.INSTANCE.GetLastError());
        }        
      String s = buffer.getValue().getString(0, ! Boolean.getBoolean("w32.ascii"));
      s = s.replace(".\r",".").replace(".\n",".");
      Kernel32.INSTANCE.LocalFree(buffer.getValue());
      return s;   
View Full Code Here

    }

    public File opendir(String path) throws LastErrorException {
        File dir = new File(path);
        if (!dir.exists())
            throw new LastErrorException(ENOENT);
        return dir;
    }
View Full Code Here

        boolean result = false;
        try {
            result = file.createNewFile();
        } catch (IOException e) {
            if (e.getMessage().equals("No such file or directory"))
                throw new LastErrorException(ENOENT);
            throw new LastErrorException(e.getMessage());
        }
        if (result)
            if (file.canWrite())
                return file;
            else
                throw new LastErrorException(EACCES);
        else
            throw new LastErrorException(EEXIST);
    }
View Full Code Here

  }

  public File opendir(String path) throws LastErrorException {
    File dir = new File(path);
    if (!dir.exists())
      throw new LastErrorException(2);
    return dir;
  }
View Full Code Here

    boolean result = false;
    try {
      result = file.createNewFile();
    } catch (IOException e) {
      if (e.getMessage().equals("No such file or directory"))
        throw new LastErrorException(2);
      throw new LastErrorException(e.getMessage());
    }
    if (result)
      if (file.canWrite())
        return file;
      else
        throw new LastErrorException(13);
    else
      throw new LastErrorException(17);
  }
View Full Code Here

                        | WinBase.FORMAT_MESSAGE_FROM_SYSTEM
                        | WinBase.FORMAT_MESSAGE_IGNORE_INSERTS, null, code, 0, // TODO:
                                                                                // MAKELANGID(LANG_NEUTRAL,
                                                                                // SUBLANG_DEFAULT)
                buffer, 0, null)) {
            throw new LastErrorException(Kernel32.INSTANCE.GetLastError());
        }
        String s = buffer.getValue().getWideString(0);
        Kernel32.INSTANCE.LocalFree(buffer.getValue());
        return s.trim();
    }
View Full Code Here

TOP

Related Classes of com.sun.jna.LastErrorException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.