Package java.util

Examples of java.util.TimerTask.run()


      if (r == null) {
        this.cancel();
        return;
      }
     
      r.run();
    }
   
  }

  public static Log log() {
View Full Code Here


            // start the new one
            monitor = new URLMonitorTask();
            TimerTask task = monitor;
            timer.schedule(monitor, 1000 * refreshPeriod, 1000 * refreshPeriod);
            task.run();
        }
    }

    public void doStart() {
        LogFactory logFactory = LogFactory.getFactory();
View Full Code Here

            // start the new one
            monitor = new URLMonitorTask();
            TimerTask task = monitor;
            timer.schedule(monitor, 1000 * refreshPeriod, 1000 * refreshPeriod);
            task.run();
        }
    }

    public void doStart() {
        LogFactory logFactory = LogFactory.getFactory();
View Full Code Here

        // create a file
        File addFile = new File(dir,testFile);
        addFile.createNewFile();
        long createdTS = addFile.lastModified();
        // should run the timertask once
        scanner.run();
        assertFalse(tsp.getTimestamps().isEmpty());
        assertTrue("expect the added file in the Timestamp persistence",
                   tsp.getTimestamps().containsKey(testFile));
        long modifiedTS = createdTS + 1000;
        addFile.setLastModified(modifiedTS);
View Full Code Here

        assertTrue("expect the added file in the Timestamp persistence",
                   tsp.getTimestamps().containsKey(testFile));
        long modifiedTS = createdTS + 1000;
        addFile.setLastModified(modifiedTS);
        // should run the timertask once
        scanner.run();
        Long persistedTS = new Long(tsp.getTimestamps().getProperty(testFile));
        assertTrue("expect the new Timestamp in the persistence object",
                   persistedTS.longValue() > createdTS);
        addFile.delete();
        // should run the timertask once
View Full Code Here

        Long persistedTS = new Long(tsp.getTimestamps().getProperty(testFile));
        assertTrue("expect the new Timestamp in the persistence object",
                   persistedTS.longValue() > createdTS);
        addFile.delete();
        // should run the timertask once
        scanner.run();
        Thread.sleep(500);
        assertTrue("timestamps should be empty", tsp.getTimestamps().isEmpty());
    }

    public void testAddDirectory() throws Exception {
View Full Code Here

        addDir.delete();
        addDir.mkdirs();
        long createdTS = addDir.lastModified();

        // Check that it's been noticed -  should run the timertask once
        scanner.run();
        assertFalse(rootTSP.getTimestamps().isEmpty());
        assertTrue("expect the added directory in the Timestamp persistence",
                   rootTSP.getTimestamps().containsKey(testDir));
        long modifiedTS = createdTS + 1000;
        addDir.setLastModified(modifiedTS);
View Full Code Here

        assertTrue("expect the added directory in the Timestamp persistence",
                   rootTSP.getTimestamps().containsKey(testDir));
        long modifiedTS = createdTS + 1000;
        addDir.setLastModified(modifiedTS);
        // should run the timertask once
        scanner.run();
        Long persistedTS = new Long(rootTSP.getTimestamps().getProperty(testDir));
        assertTrue("expect the new Timestamp in the persistence object",
                   persistedTS.longValue() > createdTS);

        // Add a file to the nested directory, and check it gets noticed.
View Full Code Here

        addFile.createNewFile();
        long createdFileTS = addFile.lastModified();
        TimestampPersistence nestedTSP =
                getPersistence(dmr, addDir.getCanonicalPath());
        // should run the timertask once
        scanner.run();
        assertFalse(rootTSP.getTimestamps().isEmpty());
        assertTrue("expect the added directory in the Timestamp persistence",
                   rootTSP.getTimestamps().containsKey(testDir));
        assertTrue("expect the added file in the Timestamp persistence",
                   nestedTSP.getTimestamps().containsKey(testFile));
View Full Code Here

        assertTrue("expect the added file in the Timestamp persistence",
                   nestedTSP.getTimestamps().containsKey(testFile));
        long modifiedFileTS = createdTS + 1000;
        addFile.setLastModified(modifiedFileTS);
        // should run the timertask once
        scanner.run();
        Long persistedFileTS = new Long(nestedTSP.getTimestamps().getProperty(testFile));
        assertTrue("expect the new Timestamp in the persistence object",
                   persistedFileTS.longValue() > createdFileTS);

        // Delete the file and check it is noticed - should run the timertask once
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.