Results 1 to 10 of 71

Hybrid View

  1. #1
    Player
    Yurai's Avatar
    Join Date
    Mar 2011
    Location
    Ul'dah
    Posts
    65
    Character
    Yurai Kago
    World
    Ragnarok
    Main Class
    Archer Lv 90
    Hmm, now that I look at the monitoring thread again, I think I see why this is happening. Pretty gross oversight on my behalf. Could you try doing the following changes and see if it fixes the problem in a live setting for you:

    Add the following global variable in LogMonitor.java and initialize it in the constructor:
    HashMap<String, Long> timestamps = null;

    Constructor:
    timestamps = new HashMap<String, Long>();

    Replace the entire contents of the run() method with the following:

    do {
    for (File f : logDir.listFiles()) {
    if (f.isFile() && !alreadyParsed.containsKey(f.getName())) {
    Log.INSTANCE.addFileToLog(f);
    alreadyParsed.put(f.getName(), f);
    timestamps.put(f.getName(), f.lastModified());
    } else if (f.isFile() && f.lastModified() > timestamps.get(f.getName())) {
    Log.INSTANCE.removeFileFromLog((File) alreadyParsed.get(f.getName()));
    Log.INSTANCE.addFileToLog(f);
    timestamps.put(f.getName(), f.lastModified());
    }
    }

    try {
    Thread.sleep(1000L);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    } while (true);
    (1)
    Author of lrParser

  2. #2
    Player

    Join Date
    Mar 2011
    Location
    Gridania
    Posts
    295
    I noticed the time stamp funny business last night myself, I was confused about how you were comparing with that systemtimestamp value which is always older then the file that has already been read. Either way I will test this change out today and let you know. Your changes seem to make sense to me. See if the file has changed, if it has reparse if not leave it alone.

    I'm using this program to teach myself threading, I do a lot of this work where I run SQL on intervals to parse and move around data =) thanks for sharing this with everyone.
    (0)
    Last edited by tachikoma; 09-16-2011 at 09:37 PM.

Tags for this Thread