private void saveTableConfigs() { if (tablesConfig instanceof Map) { FileUtil.writeResilientConfigFile(CONFIG_FILE, (Map) tablesConfig); } }
private void writeStubConfig() { if ( download_stubs.size() == 0 ){ FileUtil.deleteResilientConfigFile( STUB_CONFIG_FILE ); }else{ Map map = new HashMap(); List list = new ArrayList( download_stubs.size()); map.put( "stubs", list ); for ( DownloadStubImpl stub: download_stubs ){ list.add( stub.exportToMap()); } FileUtil.writeResilientConfigFile( STUB_CONFIG_FILE, map ); } dirty_stubs = false; }
private void save(String filename) { Map<String, Object> map = new HashMap<>(); synchronized (mapData) { map.put("data", new ArrayList(mapData.values())); map.put("bloomfilter", bloomFilter.serialiseToMap()); map.put("bloomfilterPeerId", bloomFilterPeerId.serialiseToMap()); map.put("lastadd", SystemTime.getCurrentTime()); if (startedListeningOn > 0) { map.put("time", totalTime + (SystemTime.getCurrentTime() - startedListeningOn)); } else { map.put("time", totalTime); } } FileUtil.writeResilientConfigFile(filename, map); }
private void save(String filename, Map map ) { try{ this_mon.enter(); FileUtil.writeResilientConfigFile( filename, map ); }finally{ this_mon.exit(); } }
private void saveHistory( String file, Map<Long,DownloadHistoryImpl> records ) { // System.out.println( "saving " + file ); try{ Map<String,Object> map = new HashMap<>(); List<Map<String,Object>> list = new ArrayList<>(records.size()); map.put( "records", list ); for ( DownloadHistoryImpl record: records.values()){ try{ Map<String,Object> m = record.exportToMap(); list.add( m ); }catch( Throwable e ){ Debug.out( e ); } } FileUtil.writeResilientConfigFile( file, map ); }catch( Throwable e ){ Debug.out( e ); } }
FileUtil.writeResilientConfigFile( CONFIG_FILE, map );
FileUtil.writeResilientConfigFile(closeableConfigFile, map );
protected void saveConfig() { log( "Saving configuration" ); synchronized( this ){ config_dirty = false; if ( subscriptions.size() == 0 ){ FileUtil.deleteResilientConfigFile( CONFIG_FILE ); }else{ Map map = new HashMap(); List l_subs = new ArrayList(); map.put( "subs", l_subs ); Iterator it = subscriptions.iterator(); while( it.hasNext()){ SubscriptionImpl sub = (SubscriptionImpl)it.next(); try{ l_subs.add( sub.toMap()); }catch( Throwable e ){ log( "Failed to save subscription " + sub.getString(), e ); } } FileUtil.writeResilientConfigFile( CONFIG_FILE, map ); } } }
protected void saveConfig() throws ShareException { try{ this_mon.enter(); if ( suspend_level > 0 ){ save_outstanding = true; return; } Map map = new HashMap(); List list = new ArrayList(); map.put("resources", list); ShareResource[] shares = manager.getShares(); for (int i=0;i<shares.length;i++){ Map m = new HashMap(); ((ShareResourceImpl)shares[i]).serialiseResource( m ); list.add( m ); } FileUtil.writeResilientConfigFile("sharing.config", map); }finally{ this_mon.exit(); } }
private void writeConfig() { if ( !enabled ){ Debug.out( "TagManager is disabled" ); } synchronized( this ){ if ( !config_dirty ){ return; } config_dirty = false; if ( config_change_queue.size() > 0 ){ applyConfigUpdates( getConfig()); } if ( config != null ){ FileUtil.writeResilientConfigFile( CONFIG_FILE, config ); config_ref = new WeakReference<>(config); config = null; } } }
protected void saveConfig() { synchronized( this ){ config_dirty = false; if ( queue.size() == 0 ){ FileUtil.deleteResilientConfigFile( CONFIG_FILE ); }else{ Map<String,Object> map = new HashMap<>(); List<Map<String,Object>> l_jobs = new ArrayList<>(); map.put( "jobs", l_jobs ); for ( TranscodeJobImpl job: queue ){ if ( job.isStream()){ continue; } try{ l_jobs.add( job.toMap()); }catch( Throwable e ){ log( "Failed to save job", e ); } } FileUtil.writeResilientConfigFile( CONFIG_FILE, map ); } } }
protected void saveConfig() { log( "Saving configuration" ); synchronized( this ){ config_dirty = false; Map<String,Object> map = new HashMap<>(); List<Map<String,Object>> l_engines = new ArrayList<>(); map.put( "engines", l_engines ); Iterator<EngineImpl> it = engines.iterator(); while( it.hasNext()){ Engine e = it.next(); try{ l_engines.add( e.exportToBencodedMap()); }catch( Throwable f ){ log( "Failed to export engine " + e.getName(), f ); } } if ( plugin_map != null ){ map.put( "plugin_map", plugin_map ); } FileUtil.writeResilientConfigFile( CONFIG_FILE, map ); } }
FileUtil.writeResilientConfigFile( CONFIG_FILE, map );
protected void saveBannedIPs() { if ( !COConfigurationManager.getBooleanParameter("Ip Filter Banning Persistent" )){ return; } try{ class_mon.enter(); Map map = new HashMap(); List ips = new ArrayList(); Iterator it = bannedIps.values().iterator(); while( it.hasNext()){ BannedIpImpl bip = (BannedIpImpl)it.next(); if ( bip.isTemporary()){ continue; } Map entry = new HashMap(); entry.put( "ip", bip.getIp()); entry.put( "desc", bip.getTorrentName().getBytes( "UTF-8" )); entry.put( "time", new Long( bip.getBanningTime())); ips.add( entry ); } map.put( "ips", ips ); FileUtil.writeResilientConfigFile( "banips.config", map ); }catch( Throwable e ){ Debug.printStackTrace(e); }finally{ class_mon.exit(); } }
@Override public Object skinObjectHidden(SWTSkinObject skinObject, Object params) { if (mapConfig != null) { FileUtil.writeResilientConfigFile(CONFIG_FILE, mapConfig); } if (tv != null) { tv.delete(); tv = null; } Utils.disposeSWTObjects(new Object[] { table_parent, }); return super.skinObjectHidden(skinObject, params); }
FileUtil.writeResilientConfigFile(SAVE_FILENAME, mapSave);
FileUtil.writeResilientConfigFile( filename, properties_clone );
FileUtil.writeResilientConfigFile("downloads.config", map );
protected void addPersistentlyDeleted( RelatedContent[] content ) { if ( content.length == 0 ){ return; } List<byte[]> entries = loadPersistentlyDeleted(); List<byte[]> new_keys = new ArrayList<>(content.length); for ( RelatedContent rc: content ){ byte[] key = getPermDelKey( rc ); new_keys.add( key ); entries.add( key ); } Map<String,Object> map = new HashMap<>(); map.put( "entries", entries ); FileUtil.writeResilientConfigFile( PERSIST_DEL_FILE, map ); if ( persist_del_bloom != null ){ if ( persist_del_bloom.getSize() / ( persist_del_bloom.getEntryCount() + content.length ) < 10 ){ persist_del_bloom = BloomFilterFactory.createAddOnly( Math.max( PD_BLOOM_INITIAL_SIZE, persist_del_bloom.getSize() *10 + PD_BLOOM_INCREMENT_SIZE + content.length )); for ( byte[] k: entries ){ persist_del_bloom.add( k ); } }else{ for ( byte[] k: new_keys ){ persist_del_bloom.add( k ); } } } }
FileUtil.writeResilientConfigFile( CONFIG_FILE, map );