Java Code Examples for java.net.URI#compareTo()

The following examples show how to use java.net.URI#compareTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Test.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 2
Source File: Test.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 3
Source File: Test.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static void cmp0(URI u, URI v, boolean same)
    throws URISyntaxException
{
    int c = u.compareTo(v);
    if ((c == 0) != same)
        throw new RuntimeException("Comparison inconsistent: " + u + " " + v
                                   + " " + c);
}
 
Example 4
Source File: Test.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 5
Source File: Test.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
static void cmp0(URI u, URI v, boolean same)
    throws URISyntaxException
{
    int c = u.compareTo(v);
    if ((c == 0) != same)
        throw new RuntimeException("Comparison inconsistent: " + u + " " + v
                                   + " " + c);
}
 
Example 6
Source File: Test.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 7
Source File: Test.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static void cmp0(URI u, URI v, boolean same)
    throws URISyntaxException
{
    int c = u.compareTo(v);
    if ((c == 0) != same)
        throw new RuntimeException("Comparison inconsistent: " + u + " " + v
                                   + " " + c);
}
 
Example 8
Source File: Test.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void cmp0(URI u, URI v, boolean same)
    throws URISyntaxException
{
    int c = u.compareTo(v);
    if ((c == 0) != same)
        throw new RuntimeException("Comparison inconsistent: " + u + " " + v
                                   + " " + c);
}
 
Example 9
Source File: Test.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 10
Source File: Test.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void cmp0(URI u, URI v, boolean same)
    throws URISyntaxException
{
    int c = u.compareTo(v);
    if ((c == 0) != same)
        throw new RuntimeException("Comparison inconsistent: " + u + " " + v
                                   + " " + c);
}
 
Example 11
Source File: Test.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 12
Source File: Test.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static void cmp0(URI u, URI v, boolean same)
    throws URISyntaxException
{
    int c = u.compareTo(v);
    if ((c == 0) != same)
        throw new RuntimeException("Comparison inconsistent: " + u + " " + v
                                   + " " + c);
}
 
Example 13
Source File: Test.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 14
Source File: Test.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static void cmp0(URI u, URI v, boolean same)
    throws URISyntaxException
{
    int c = u.compareTo(v);
    if ((c == 0) != same)
        throw new RuntimeException("Comparison inconsistent: " + u + " " + v
                                   + " " + c);
}
 
Example 15
Source File: Test.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void cmp0(URI u, URI v, boolean same)
    throws URISyntaxException
{
    int c = u.compareTo(v);
    if ((c == 0) != same)
        throw new RuntimeException("Comparison inconsistent: " + u + " " + v
                                   + " " + c);
}
 
Example 16
Source File: Test.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static void cmp0(URI u, URI v, boolean same)
    throws URISyntaxException
{
    int c = u.compareTo(v);
    if ((c == 0) != same)
        throw new RuntimeException("Comparison inconsistent: " + u + " " + v
                                   + " " + c);
}
 
Example 17
Source File: Test.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 18
Source File: Test.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 19
Source File: Test.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void lt(URI u, URI v) throws URISyntaxException {
    ne0(u, v);
    int c = u.compareTo(v);
    if (c >= 0) {
        show(u);
        show(v);
        throw new RuntimeException("Not less than: " + u + " " + v
                                   + " " + c);
    }
    out.println(u + " < " + v);
}
 
Example 20
Source File: JobHistory.java    From RDFS with Apache License 2.0 4 votes vote down vote up
void moveToDone(final JobID id, boolean sync) {
  final List<Path> paths = new ArrayList<Path>();
  final Path historyFile = getHistoryFile(id);
  if (historyFile == null) {
    LOG.info("No file for job-history with " + id + " found in cache!");
  } else {
    paths.add(historyFile);
  }

  final Path confPath = getConfFileWriters(id);
  if (confPath == null) {
    LOG.info("No file for jobconf with " + id + " found in cache!");
  } else {
    paths.add(confPath);
  }

  Runnable r = new Runnable() {

    public void run() {
      //move the files to doneDir folder
      try {
        List<PrintWriter> writers = getWriters(id);
        synchronized (writers) {
          while (writers.size() > 0) {
            writers.wait();
          }
        }

        URI srcURI = logFs.getUri();
        URI doneURI = doneFs.getUri();
        boolean useRename = (srcURI.compareTo(doneURI) == 0);

        for (Path path : paths) {
          //check if path exists, in case of retries it may not exist
          if (logFs.exists(path)) {
            LOG.info("Moving " + path.toString() + " to " + 
                doneDir.toString()); 

            Path dstPath = new Path(doneDir, path.getName());
            if (useRename) {
              doneFs.rename(path, doneDir);
            } else {
              FileUtil.copy(logFs, path, doneFs, dstPath, true, true, conf);
            }

            doneFs.setPermission(dstPath,
                                     new FsPermission(HISTORY_FILE_PERMISSION));

          }
        }
      } catch (Throwable e) {
        LOG.error("Unable to move history file to DONE folder:\n"
                  + StringUtils.stringifyException(e));
      }

      String historyFileDonePath = null;
      if (historyFile != null) {
        historyFileDonePath = new Path(doneDir, 
            historyFile.getName()).toString();
      }

      jobHistoryFileMap.put(id, new MovedFileInfo(historyFileDonePath,
          System.currentTimeMillis()));
      jobTracker.historyFileCopied(id, historyFileDonePath);
      
      //purge the job from the cache
      purgeJob(id);
    }

  };

  if (sync) {
    r.run();
  } else {
    executor.execute(r);
  }
}