/** * Returns Executor used to execute asynchronous write or touch jobs. * @return Executor used to execute asynchronous write or touch jobs */ protected Executor getAsyncWriteExecutor() { Executor executor = asyncWriteExecutor; if (executor == null) { synchronized (this) { executor = asyncWriteExecutor; if (executor == null) { asyncWriteExecutor = executor = createAsyncWriteExecutor(); } } } return executor; }
/** * {@inheritDoc} */ @Override public void close() throws DataStoreException { Executor asyncExecutor = getAsyncWriteExecutor(); if (asyncExecutor != null && asyncExecutor instanceof ExecutorService) { ((ExecutorService) asyncExecutor).shutdownNow(); } }
/** * {@inheritDoc} */ @Override public void init(CachingDataStore store, String homeDir, String config) throws DataStoreException { super.init(store, homeDir, config); // When it's local file system, no need to use a separate touch file. if ("file".equals(baseFolder.getName().getScheme())) { touchFilePreferred = false; } }
/** * Creates an {@link Executor}. * This method is invoked during the initialization for asynchronous write/touch job executions. * @return an {@link Executor} */ protected Executor createAsyncWriteExecutor() { Executor asyncExecutor; if (dataStore.getAsyncUploadLimit() > 0 && getAsyncWritePoolSize() > 0) { asyncExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(getAsyncWritePoolSize(), new NamedThreadFactory(getClass().getSimpleName() + "-write-worker")); } else { asyncExecutor = new ImmediateExecutor(); } return asyncExecutor; }
@Override public void close() throws DataStoreException { super.close(); // backend is closing. abort all mulitpart uploads from start. if(s3service.doesBucketExist(bucket)) { tmx.abortMultipartUploads(bucket, startTime); } tmx.shutdownNow(); s3service.shutdown(); LOG.info("S3Backend closed."); }
@Override public void init(CachingDataStore store, String homeDir, String config) throws DataStoreException { super.init(store, homeDir, config); Properties initProps = null; // Check is configuration is already provided. That takes precedence // over config provided via file based config if (this.properties != null) { initProps = this.properties; } else { initProps = new Properties(); InputStream in = null; try { in = new FileInputStream(config); initProps.load(in); } catch (IOException e) { throw new DataStoreException( "Could not initialize FSBackend from " + config, e); } finally { IOUtils.closeQuietly(in); } this.properties = initProps; } init(store, homeDir, initProps); }
/** * Creates an {@link Executor}. * This method is invoked during the initialization for asynchronous write/touch job executions. * @return an {@link Executor} */ protected Executor createAsyncWriteExecutor() { Executor asyncExecutor; if (dataStore.getAsyncUploadLimit() > 0 && getAsyncWritePoolSize() > 0) { asyncExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(getAsyncWritePoolSize(), new NamedThreadFactory(getClass().getSimpleName() + "-write-worker")); } else { asyncExecutor = new ImmediateExecutor(); } return asyncExecutor; }
@Override public void close() throws DataStoreException { super.close(); // backend is closing. abort all mulitpart uploads from start. if(s3service.doesBucketExist(bucket)) { tmx.abortMultipartUploads(bucket, startTime); } tmx.shutdownNow(); s3service.shutdown(); LOG.info("S3Backend closed."); }
@Override public void init(CachingDataStore store, String homeDir, String config) throws DataStoreException { super.init(store, homeDir, config); Properties initProps = null; // Check is configuration is already provided. That takes precedence // over config provided via file based config if (this.properties != null) { initProps = this.properties; } else { initProps = new Properties(); InputStream in = null; try { in = new FileInputStream(config); initProps.load(in); } catch (IOException e) { throw new DataStoreException( "Could not initialize FSBackend from " + config, e); } finally { IOUtils.closeQuietly(in); } this.properties = initProps; } init(store, homeDir, initProps); }
/** * {@inheritDoc} */ @Override public void close() throws DataStoreException { Executor asyncExecutor = getAsyncWriteExecutor(); if (asyncExecutor != null && asyncExecutor instanceof ExecutorService) { ((ExecutorService) asyncExecutor).shutdownNow(); } }
/** * Creates an {@link Executor}. * This method is invoked during the initialization for asynchronous write/touch job executions. * @return an {@link Executor} */ protected Executor createAsyncWriteExecutor() { Executor asyncExecutor; if (dataStore.getAsyncUploadLimit() > 0 && getAsyncWritePoolSize() > 0) { asyncExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(getAsyncWritePoolSize(), new NamedThreadFactory(getClass().getSimpleName() + "-write-worker")); } else { asyncExecutor = new ImmediateExecutor(); } return asyncExecutor; }
/** * Returns Executor used to execute asynchronous write or touch jobs. * @return Executor used to execute asynchronous write or touch jobs */ protected Executor getAsyncWriteExecutor() { Executor executor = asyncWriteExecutor; if (executor == null) { synchronized (this) { executor = asyncWriteExecutor; if (executor == null) { asyncWriteExecutor = executor = createAsyncWriteExecutor(); } } } return executor; }
@Override public void init(CachingDataStore store, String homeDir, String config) throws DataStoreException { super.init(store, homeDir, config); Properties initProps = null; // Check is configuration is already provided. That takes precedence // over config provided via file based config if (this.properties != null) { initProps = this.properties; } else { initProps = new Properties(); InputStream in = null; try { in = new FileInputStream(config); initProps.load(in); } catch (IOException e) { throw new DataStoreException( "Could not initialize FSBackend from " + config, e); } finally { IOUtils.closeQuietly(in); } this.properties = initProps; } init(store, homeDir, initProps); }
/** * {@inheritDoc} */ @Override public void close() throws DataStoreException { Executor asyncExecutor = getAsyncWriteExecutor(); if (asyncExecutor != null && asyncExecutor instanceof ExecutorService) { ((ExecutorService) asyncExecutor).shutdownNow(); } }
/** * Returns Executor used to execute asynchronous write or touch jobs. * @return Executor used to execute asynchronous write or touch jobs */ protected Executor getAsyncWriteExecutor() { Executor executor = asyncWriteExecutor; if (executor == null) { synchronized (this) { executor = asyncWriteExecutor; if (executor == null) { asyncWriteExecutor = executor = createAsyncWriteExecutor(); } } } return executor; }
/** * Initialize S3Backend. It creates AmazonS3Client and TransferManager from * aws.properties. It creates S3 bucket if it doesn't pre-exist in S3. */ @Override public void init(CachingDataStore store, String homeDir, String config) throws DataStoreException { super.init(store, homeDir, config); Properties initProps = null; //Check is configuration is already provided. That takes precedence //over config provided via file based config if(this.properties != null){ initProps = this.properties; } else { if(config == null){ config = Utils.DEFAULT_CONFIG_FILE; } try{ initProps = Utils.readConfig(config); }catch(IOException e){ throw new DataStoreException("Could not initialize S3 from " + config, e); } this.properties = initProps; } init(store, homeDir, initProps); }
/** * Initialize S3Backend. It creates AmazonS3Client and TransferManager from * aws.properties. It creates S3 bucket if it doesn't pre-exist in S3. */ @Override public void init(CachingDataStore store, String homeDir, String config) throws DataStoreException { super.init(store, homeDir, config); Properties initProps = null; //Check is configuration is already provided. That takes precedence //over config provided via file based config if(this.properties != null){ initProps = this.properties; } else { if(config == null){ config = Utils.DEFAULT_CONFIG_FILE; } try{ initProps = Utils.readConfig(config); }catch(IOException e){ throw new DataStoreException("Could not initialize S3 from " + config, e); } this.properties = initProps; } init(store, homeDir, initProps); }