From: Mailing l. f. C. c. m. <jtc...@li...> - 2007-01-25 18:14:46
|
Update of /cvsroot/jtcfrost/frost-wot/source/frost/fileTransfer In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32736/source/frost/fileTransfer Modified Files: FileTransferManager.java PersistenceManager.java Log Message: several fixes, redesigned 07 persistence, new persistence code is still mainly untested (especially the direct transfers) PLEASE HELP TO TEST! Index: FileTransferManager.java =================================================================== RCS file: /cvsroot/jtcfrost/frost-wot/source/frost/fileTransfer/FileTransferManager.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** FileTransferManager.java 15 Jan 2007 18:15:26 -0000 1.15 --- FileTransferManager.java 25 Jan 2007 18:14:36 -0000 1.16 *************** *** 36,39 **** --- 36,41 ---- private SharedFilesManager sharedFilesManager; private NewUploadFilesManager newUploadFilesManager; + + private PersistenceManager persistenceManager = null; private static FileTransferManager instance = null; *************** *** 56,60 **** getUploadManager().initialize( getSharedFilesManager().getModel().getItems() ); getNewUploadFilesManager().initialize(); ! PersistenceManager.initialize(getUploadManager().getModel(), getDownloadManager().getModel()); // call order is order of panels in gui --- 58,71 ---- getUploadManager().initialize( getSharedFilesManager().getModel().getItems() ); getNewUploadFilesManager().initialize(); ! ! if( PersistenceManager.isPersistenceEnabled() && Core.isFreenetOnline() ) { ! ! boolean wasOk = ((FcpHandler07)FcpHandler.inst()).initializePersistence(); ! if( !wasOk ) { ! System.out.println("FAILED TO ESTABLISH THE PERSISTENT CONNECTION!"); ! } else { ! persistenceManager = new PersistenceManager(getUploadManager().getModel(), getDownloadManager().getModel()); ! } ! } // call order is order of panels in gui *************** *** 65,68 **** --- 76,86 ---- getSharedFilesManager().addPanelToMainFrame(mainFrame); } + + /** + * @return null if not using persistence + */ + public PersistenceManager getPersistenceManager() { + return persistenceManager; + } public void startTickers() { *************** *** 72,85 **** // maybe start persistence threads ! if( FcpHandler.isFreenet07() ! && Core.isFreenetOnline() ! && Core.frostSettings.getBoolValue(SettingsClass.FCP2_USE_PERSISTENCE) ) ! { ! boolean wasOk = ((FcpHandler07)FcpHandler.inst()).initializePersistence(); ! if( !wasOk ) { ! System.out.println("FAILED TO ESTABLISH THE PERSISTENT CONNECTION!"); ! } else { ! PersistenceManager.startThreads(); // was initialized by FileTransferManager ! } } } --- 90,95 ---- // maybe start persistence threads ! if( getPersistenceManager() != null ) { ! getPersistenceManager().startThreads(); } } Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/jtcfrost/frost-wot/source/frost/fileTransfer/PersistenceManager.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PersistenceManager.java 16 Jan 2007 14:02:29 -0000 1.6 --- PersistenceManager.java 25 Jan 2007 18:14:36 -0000 1.7 *************** *** 22,26 **** import java.io.*; import java.util.*; - import java.util.concurrent.*; import java.util.logging.*; --- 22,25 ---- *************** *** 28,31 **** --- 27,31 ---- import frost.fcp.*; [...1070 lines suppressed...] ! String id = item.getGqIdentifier(); ! directGETsInProgress.add(id); ! queue.addLast(item); notifyAll(); // notify all waiters (if any) of new record } ! public synchronized void appendItemToQueue(FrostUploadItem item) { ! String id = item.getGqIdentifier(); ! directPUTsInProgress.add(id); ! queue.addLast(item); ! notifyAll(); // notify all waiters (if any) of new record } ! ! public synchronized int getQueueSize() { ! return queue.size(); } } |