private void flush(final String fileName, final Object object) { if (this.configuration.isAsyncWrite()) { this.executorService.execute(new Runnable() { @Override public void run() { performFlush(fileName, object); } }); } else { performFlush(fileName, object); } }
private void flush(final String fileName, final Object object) { if (this.configuration.isAsyncWrite()) { this.executorService.execute(new Runnable() { @Override public void run() { performFlush(fileName, object); } }); } else { performFlush(fileName, object); } }
@Override protected FileStoreConfigurationBuilder readFrom(FileIdentityStoreConfiguration configuration) { super.readFrom(configuration); this.workingDirectory = configuration.getWorkingDir(); this.preserveState = !configuration.isAlwaysCreateFiles(); this.asyncWrite = configuration.isAsyncWrite(); this.asyncWriteThreadPool = configuration.getAsyncThreadPool(); return this; } }
@Override protected FileStoreConfigurationBuilder readFrom(FileIdentityStoreConfiguration configuration) { super.readFrom(configuration); this.workingDirectory = configuration.getWorkingDir(); this.preserveState = !configuration.isAlwaysCreateFiles(); this.asyncWrite = configuration.isAsyncWrite(); this.asyncWriteThreadPool = configuration.getAsyncThreadPool(); return this; } }
private void init() { initWorkingDirectory(); File partitionsFile = createFileIfNotExists(getWorkingDirFile(PARTITIONS_FILE_NAME)); loadPartitions(partitionsFile); Map<String, Map<String, FileRelationship>> relationships = readObject(createFileIfNotExists(getWorkingDirFile(RELATIONSHIPS_FILE_NAME))); if (relationships == null) { relationships = new ConcurrentHashMap<String, Map<String, FileRelationship>>(); } this.relationships = relationships; Map<String, FileAttribute> attributes = readObject(createFileIfNotExists(getWorkingDirFile(ATTRIBUTES_FILE_NAME))); if (attributes == null) { attributes = new ConcurrentHashMap<String, FileAttribute>(); } this.attributes = attributes; Map<String, FileAttributedType> attrubtedTypes = readObject(createFileIfNotExists(getWorkingDirFile(ATTRIBUTED_TYPES__FILE_NAME))); if (attrubtedTypes == null) { attrubtedTypes = new ConcurrentHashMap<String, FileAttributedType>(); } this.attributedTypes = attrubtedTypes; if (this.configuration.isAsyncWrite()) { FILE_STORE_LOGGER.fileAsyncWriteEnabled(this.configuration.getAsyncThreadPool()); this.executorService = Executors.newFixedThreadPool(this.configuration.getAsyncThreadPool()); } }
private void init() { initWorkingDirectory(); File partitionsFile = createFileIfNotExists(getWorkingDirFile(PARTITIONS_FILE_NAME)); loadPartitions(partitionsFile); Map<String, Map<String, FileRelationship>> relationships = readObject(createFileIfNotExists(getWorkingDirFile(RELATIONSHIPS_FILE_NAME))); if (relationships == null) { relationships = new ConcurrentHashMap<String, Map<String, FileRelationship>>(); } this.relationships = relationships; Map<String, FileAttribute> attributes = readObject(createFileIfNotExists(getWorkingDirFile(ATTRIBUTES_FILE_NAME))); if (attributes == null) { attributes = new ConcurrentHashMap<String, FileAttribute>(); } this.attributes = attributes; Map<String, FileAttributedType> attrubtedTypes = readObject(createFileIfNotExists(getWorkingDirFile(ATTRIBUTED_TYPES__FILE_NAME))); if (attrubtedTypes == null) { attrubtedTypes = new ConcurrentHashMap<String, FileAttributedType>(); } this.attributedTypes = attrubtedTypes; if (this.configuration.isAsyncWrite()) { FILE_STORE_LOGGER.fileAsyncWriteEnabled(this.configuration.getAsyncThreadPool()); this.executorService = Executors.newFixedThreadPool(this.configuration.getAsyncThreadPool()); } }