ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/client/WebFeeder.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/WebFeeder.java (file contents):
Revision 1.15 by tdb, Fri Mar 16 16:47:33 2001 UTC vs.
Revision 1.17 by tdb, Thu Mar 22 18:08:38 2001 UTC

# Line 47 | Line 47 | public class WebFeeder extends Thread {
47       * Return a reference to the single class.
48       * Construct it if it does not already exist, otherwise just return the reference.
49       */
50 <    public static WebFeeder getInstance() {
50 >    public synchronized static WebFeeder getInstance() {
51          if (_instance == null){
52              _instance = new WebFeeder();
53          }
# Line 170 | Line 170 | public class WebFeeder extends Thread {
170                              long age = System.currentTimeMillis() - lastModified;
171                              if(age > ((long) deleteOlderThan*1000)) {
172                                  // it's also older than our age to delete older than
173 <                                if(!alertFile.delete()) {
173 >                                if(alertFile.delete()) {
174 >                                    // do a quick check to see if the directory is now empty
175 >                                    File[] newHostdirContents = hostdir.listFiles();
176 >                                    if(newHostdirContents.length == 0) {
177 >                                        // it does seem to be, try and delete it
178 >                                        // this will fail anyway if files still remain
179 >                                        if(!hostdir.delete()) {
180 >                                            _logger.write(this.toString(), Logger.WARNING, "Failed to delete the following empty host directory: "+hostdir.getPath());
181 >                                        }
182 >                                    }
183 >                                }
184 >                                else {
185                                      _logger.write(this.toString(), Logger.WARNING, "Failed to delete the following 'old' alert file: "+alertFile.getPath());
186                                  }
187                              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines