2009-06-04 65 views

回答

3

我想你會發現大多數人會認爲在Windows上Redhat的可靠性。 Glassfish本身也應該運行相同的。

你或許應該問這對Server Fault

16

如果您檢查GlassFish的來源,特別是./appserv-commons/src/java/com/sun/enterprise/util/io/FileUtils.java,你會查看Glassfish爲了在Windows上刪除/重命名文件和目錄而經歷的所有扭曲。

這是一個Windows問題,它對刪除和重命名打開文件有限制。

這裏有各種各樣的技巧,包括多次從JVM請求GC,希望關閉文​​件流,「僞」重命名,睡眠嘗試循環。

一些例子:

/** 
*Attempts to delete files that could not be deleted earlier and were not overwritten. 
*<p> 
*On Windows, the method requests garbage collection which may unlock locked 
*files. (The JarFile finalizer closes the file.) 

/* 
    *On Windows, as long as not all leftover files have been cleaned and we have not 
    *run the max. number of retries, try again to trigger gc and delete 
    *each remaining leftover file. 
    */ 

/** 
* Windows has BIG issues renaming a directory that is open somnewhere -- e.g. if 
* a DOS box is opened anywhere in that directory. 
* This method will try to do a "virtual renaming" if there are problems 
* I.e. it attempts to do a simple rename, if that fails it will copy everything under 
* the original directory to the renamed directory. Then it will delete everything 
* under the original directory that the OS will allow it to. 

在實踐中,這有時會轉化爲borked在Windows部署或重新部署,因爲一些文件不能被刪除或移動,並最終被拋在後面。在我運行的50個Glassfish實例中,我從來沒有在Solaris 10上遇到任何問題,並且在Windows上總是遇到與此相關的問題。

總之,任何* NIX都會因爲這個原因而更好,除了其他平臺管理方面的考慮。