You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/12/23 16:25:36 UTC
[1/4] ignite git commit: IGNITE-2206: Cleanup.
Repository: ignite
Updated Branches:
refs/heads/ignite-2206 04827ca7f -> c8755e874
IGNITE-2206: Cleanup.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0effa108
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0effa108
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0effa108
Branch: refs/heads/ignite-2206
Commit: 0effa10864fa3b8407d9d744077802b5fd930df4
Parents: 04827ca
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 23 17:28:45 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 23 17:28:45 2015 +0300
----------------------------------------------------------------------
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 50 ++++++++++----------
1 file changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0effa108/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
index 20cd9ca..14b6294 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
@@ -244,8 +244,6 @@ public class IgniteHadoopFileSystem extends FileSystem {
@Override public void initialize(URI name, Configuration cfg) throws IOException {
enterBusy();
- assert !closeGuard.get();
-
try {
if (rmtClient != null)
throw new IOException("File system is already initialized: " + rmtClient);
@@ -297,7 +295,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
igfsGrpBlockSize = handshake.blockSize();
- final IgfsPaths paths = handshake.secondaryPaths();
+ IgfsPaths paths = handshake.secondaryPaths();
// Initialize client logger.
Boolean logEnabled = parameter(cfg, PARAM_IGFS_LOG_ENABLED, uriAuthority, false);
@@ -338,7 +336,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
throw new IOException("Failed to get secondary file system factory.", e);
}
- A.ensure(factory != null, "Secondary file system factory should not be null.");
+ assert factory != null;
if (factory instanceof LifecycleAware)
((LifecycleAware) factory).start();
@@ -436,7 +434,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
A.notNull(p, "p");
if (mode(p) == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -466,7 +464,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
A.notNull(p, "p");
if (mode(p) == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -497,7 +495,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
try {
if (mode(p) == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -528,7 +526,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
IgfsMode mode = mode(path);
if (mode == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -602,7 +600,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
path + ", overwrite=" + overwrite + ", bufSize=" + bufSize + ']');
if (mode == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -685,7 +683,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
", path=" + path + ", bufSize=" + bufSize + ']');
if (mode == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -750,7 +748,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
IgfsMode mode = mode(srcPath);
if (mode == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -812,7 +810,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
IgfsMode mode = mode(path);
if (mode == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -859,7 +857,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
IgfsMode mode = mode(path);
if (mode == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -925,7 +923,14 @@ public class IgniteHadoopFileSystem extends FileSystem {
/** {@inheritDoc} */
@Override public void setWorkingDirectory(Path newPath) {
- final FileSystem secondaryFs = secondaryFs();
+ FileSystem secondaryFs;
+
+ try {
+ secondaryFs = secondaryFileSystem();
+ }
+ catch (IOException e) {
+ throw new RuntimeException("Failed to obtain secondary file system instance.", e);
+ }
if (newPath == null) {
Path homeDir = getHomeDirectory();
@@ -967,7 +972,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
IgfsMode mode = mode(path);
if (mode == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -1010,7 +1015,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
try {
if (mode(f) == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -1042,7 +1047,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
try {
if (mode(f) == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -1075,7 +1080,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
IgfsPath path = convert(status.getPath());
if (mode(status.getPath()) == PROXY) {
- final FileSystem secondaryFs = secondaryFs();
+ final FileSystem secondaryFs = secondaryFileSystem();
if (secondaryFs == null) {
assert mgmt;
@@ -1336,15 +1341,10 @@ public class IgniteHadoopFileSystem extends FileSystem {
*
* @return The secondary file system.
*/
- private @Nullable FileSystem secondaryFs() {
+ private @Nullable FileSystem secondaryFileSystem() throws IOException{
if (factory == null)
return null;
- try {
- return factory.create(user);
- }
- catch (IOException ioe) {
- throw new IgniteException();
- }
+ return factory.create(user);
}
}
\ No newline at end of file
[3/4] ignite git commit: IGNITE-2206: Finalization.
Posted by vo...@apache.org.
IGNITE-2206: Finalization.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7915c12e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7915c12e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7915c12e
Branch: refs/heads/ignite-2206
Commit: 7915c12e615faa33bb2761d5cd928b3442b2110c
Parents: 262af69
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 23 18:24:13 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 23 18:24:13 2015 +0300
----------------------------------------------------------------------
.../hadoop/fs/BasicHadoopFileSystemFactory.java | 30 +++++------
.../hadoop/fs/HadoopFileSystemFactory.java | 6 +--
.../fs/IgniteHadoopIgfsSecondaryFileSystem.java | 55 ++++++++++----------
3 files changed, 45 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7915c12e/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/BasicHadoopFileSystemFactory.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/BasicHadoopFileSystemFactory.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/BasicHadoopFileSystemFactory.java
index a2317cf..bc22da8 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/BasicHadoopFileSystemFactory.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/BasicHadoopFileSystemFactory.java
@@ -36,7 +36,7 @@ import java.net.URL;
import java.util.Arrays;
/**
- * Caching Hadoop file system factory. File systems are cache on per-user basis.
+ * Simple Hadoop file system factory factory which delegates to {@code FileSystem.get()}.
*/
public class BasicHadoopFileSystemFactory implements HadoopFileSystemFactory, Externalizable, LifecycleAware {
/** File system URI. */
@@ -46,10 +46,10 @@ public class BasicHadoopFileSystemFactory implements HadoopFileSystemFactory, Ex
protected String[] cfgPaths;
/** Configuration of the secondary filesystem, never null. */
- protected Configuration cfg;
+ protected transient Configuration cfg;
/** */
- protected URI fullUri;
+ protected transient URI fullUri;
/**
* Public non-arg constructor.
@@ -121,18 +121,6 @@ public class BasicHadoopFileSystemFactory implements HadoopFileSystemFactory, Ex
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
- // if secondary fs URI is not given explicitly, try to get it from the configuration:
- if (uri == null)
- fullUri = FileSystem.getDefaultUri(cfg);
- else {
- try {
- fullUri = new URI(uri);
- }
- catch (URISyntaxException use) {
- throw new IgniteException("Failed to resolve secondary file system URI: " + uri);
- }
- }
-
cfg = HadoopUtils.safeCreateConfiguration();
if (cfgPaths != null) {
@@ -152,6 +140,18 @@ public class BasicHadoopFileSystemFactory implements HadoopFileSystemFactory, Ex
}
}
}
+
+ // If secondary fs URI is not given explicitly, try to get it from the configuration:
+ if (uri == null)
+ fullUri = FileSystem.getDefaultUri(cfg);
+ else {
+ try {
+ fullUri = new URI(uri);
+ }
+ catch (URISyntaxException use) {
+ throw new IgniteException("Failed to resolve secondary file system URI: " + uri);
+ }
+ }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7915c12e/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java
index b4edab8..3298ddd 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java
@@ -22,7 +22,7 @@ import java.io.Serializable;
import org.apache.hadoop.fs.FileSystem;
/**
- * This factory is {@link Serializable} because it should be transferable over the network.
+ * Hadoop file system factory. Used to construct instance of {@link FileSystem} for Ignite.
* <p>
* Implementations may choose not to construct a new instance, but instead
* return a previously created instance.
@@ -33,9 +33,9 @@ public interface HadoopFileSystemFactory extends Serializable {
* All the other data needed for the file system creation are expected to be contained
* in this object instance.
*
- * @param userName The user name
+ * @param usrName The user name
* @return The file system.
* @throws IOException On error.
*/
- public FileSystem create(String userName) throws IOException;
+ public FileSystem create(String usrName) throws IOException;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7915c12e/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
index 99b8f5a..98dc20e 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
@@ -43,7 +43,6 @@ import org.apache.ignite.internal.processors.igfs.IgfsFileImpl;
import org.apache.ignite.internal.processors.igfs.IgfsFileInfo;
import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.jetbrains.annotations.Nullable;
@@ -68,16 +67,16 @@ import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_USER_NAME;
public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem, LifecycleAware,
HadoopPayloadAware {
/** The default user name. It is used if no user context is set. */
- private @Nullable String dfltUsrName;
+ private String dfltUsrName;
- /** */
+ /** Factory. */
private HadoopFileSystemFactory fsFactory;
/**
* Default constructor for Spring.
*/
public IgniteHadoopIgfsSecondaryFileSystem() {
- // noop.
+ // No-op.
}
/**
@@ -109,14 +108,16 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
*
* @param uri URI of file system.
* @param cfgPath Additional path to Hadoop configuration.
- * @param userName User name.
+ * @param usrName User name.
* @throws IgniteCheckedException In case of error.
* @deprecated Arg-less constructor should be used instead, + setters. This constructor is
* supported for compatibility only.
*/
@Deprecated
public IgniteHadoopIgfsSecondaryFileSystem(@Nullable String uri, @Nullable String cfgPath,
- @Nullable String userName) throws IgniteCheckedException {
+ @Nullable String usrName) throws IgniteCheckedException {
+ setDefaultUserName(usrName);
+
CachingHadoopFileSystemFactory fac = new CachingHadoopFileSystemFactory();
fac.setUri(uri);
@@ -125,45 +126,42 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
fac.setConfigPaths(cfgPath);
setFileSystemFactory(fac);
- setDefaultUserName(userName);
}
/**
- * Sets secondary file system factory.
+ * Gets the default user name.
*
- * @param factory The factory to set.
+ * @return The default user name.
*/
- public void setFileSystemFactory(HadoopFileSystemFactory factory) {
- A.ensure(factory != null, "Factory value must not be null.");
-
- this.fsFactory = factory;
+ public String getDefaultUserName() {
+ return dfltUsrName;
}
/**
- * Gets the secondary file system factory.
+ * Sets the default user name.
*
- * @return The secondary file system factory.
+ * @param dfltUsrName The user name to set.
*/
- public HadoopFileSystemFactory getFileSystemFactory() {
- return fsFactory;
+ public void setDefaultUserName(String dfltUsrName) {
+ this.dfltUsrName = dfltUsrName;
}
/**
- * Sets the default user name.
+ * Gets the secondary file system factory.
*
- * @param usrName The user name to set.
+ * @return The secondary file system factory.
*/
- public void setDefaultUserName(String usrName) {
- this.dfltUsrName = usrName;
+ public HadoopFileSystemFactory getFileSystemFactory() {
+ return fsFactory;
}
/**
- * Gets the default user name.
+ * Sets secondary file system factory.
*
- * @return The default user name.
+ * @param factory The factory to set.
*/
- public String getDefaultUserName() {
- return dfltUsrName;
+ public void setFileSystemFactory(HadoopFileSystemFactory factory) {
+ this.fsFactory = factory;
}
/**
@@ -510,9 +508,10 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
- // #start() should not ever be invoked if these properties are not set:
- A.ensure(fsFactory != null, "factory");
- A.ensure(dfltUsrName != null, "userName");
+ dfltUsrName = IgfsUtils.fixUserName(dfltUsrName);
+
+ if (fsFactory == null)
+ fsFactory = new CachingHadoopFileSystemFactory();
if (fsFactory instanceof LifecycleAware)
((LifecycleAware) fsFactory).start();
[2/4] ignite git commit: IGNITE-2206: Decoupled caching and
non-caching impls.
Posted by vo...@apache.org.
IGNITE-2206: Decoupled caching and non-caching impls.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/262af698
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/262af698
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/262af698
Branch: refs/heads/ignite-2206
Commit: 262af69886387dece31dfe76d3cedfa48a20e384
Parents: 0effa10
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 23 18:11:43 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 23 18:11:43 2015 +0300
----------------------------------------------------------------------
.../hadoop/fs/BasicHadoopFileSystemFactory.java | 189 +++++++++++++++++++
.../fs/CachingHadoopFileSystemFactory.java | 171 ++---------------
.../fs/IgniteHadoopIgfsSecondaryFileSystem.java | 2 +-
.../hadoop/fs/HadoopFileSystemCacheUtils.java | 8 +-
.../hadoop/fs/HadoopLazyConcurrentMap.java | 5 +-
...oopSecondaryFileSystemConfigurationTest.java | 16 +-
.../IgniteHadoopFileSystemAbstractSelfTest.java | 52 ++---
7 files changed, 247 insertions(+), 196 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/262af698/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/BasicHadoopFileSystemFactory.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/BasicHadoopFileSystemFactory.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/BasicHadoopFileSystemFactory.java
new file mode 100644
index 0000000..a2317cf
--- /dev/null
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/BasicHadoopFileSystemFactory.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.hadoop.fs;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.hadoop.HadoopUtils;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lifecycle.LifecycleAware;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Arrays;
+
+/**
+ * Caching Hadoop file system factory. File systems are cache on per-user basis.
+ */
+public class BasicHadoopFileSystemFactory implements HadoopFileSystemFactory, Externalizable, LifecycleAware {
+ /** File system URI. */
+ protected String uri;
+
+ /** File system config paths. */
+ protected String[] cfgPaths;
+
+ /** Configuration of the secondary filesystem, never null. */
+ protected Configuration cfg;
+
+ /** */
+ protected URI fullUri;
+
+ /**
+ * Public non-arg constructor.
+ */
+ public BasicHadoopFileSystemFactory() {
+ // noop
+ }
+
+ /** {@inheritDoc} */
+ @Override public FileSystem create(String usrName) throws IOException {
+ return create0(IgfsUtils.fixUserName(usrName));
+ }
+
+ /**
+ * Internal file system create routine.
+ *
+ * @param usrName User name.
+ * @return File system.
+ * @throws IOException If failed.
+ */
+ protected FileSystem create0(String usrName) throws IOException {
+ assert cfg != null;
+
+ try {
+ return FileSystem.get(fullUri, cfg, usrName);
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+
+ throw new IOException("Failed to create file system due to interrupt.", e);
+ }
+ }
+
+ /**
+ * Gets file system URI.
+ *
+ * @return File system URI.
+ */
+ @Nullable public String getUri() {
+ return uri;
+ }
+
+ /**
+ * Sets file system URI.
+ *
+ * @param uri File system URI.
+ */
+ public void setUri(@Nullable String uri) {
+ this.uri = uri;
+ }
+
+ /**
+ * Gets paths to additional file system configuration files (e.g. core-site.xml).
+ *
+ * @return Paths to file system configuration files.
+ */
+ @Nullable public String[] getConfigPaths() {
+ return cfgPaths;
+ }
+
+ /**
+ * Set paths to additional file system configuration files (e.g. core-site.xml).
+ *
+ * @param cfgPaths Paths to file system configuration files.
+ */
+ public void setConfigPaths(String... cfgPaths) {
+ this.cfgPaths = cfgPaths;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void start() throws IgniteException {
+ // if secondary fs URI is not given explicitly, try to get it from the configuration:
+ if (uri == null)
+ fullUri = FileSystem.getDefaultUri(cfg);
+ else {
+ try {
+ fullUri = new URI(uri);
+ }
+ catch (URISyntaxException use) {
+ throw new IgniteException("Failed to resolve secondary file system URI: " + uri);
+ }
+ }
+
+ cfg = HadoopUtils.safeCreateConfiguration();
+
+ if (cfgPaths != null) {
+ for (String cfgPath : cfgPaths) {
+ if (cfgPath == null)
+ throw new IgniteException("Configuration path cannot be null: " + Arrays.toString(cfgPaths));
+ else {
+ URL url = U.resolveIgniteUrl(cfgPath);
+
+ if (url == null) {
+ // If secConfPath is given, it should be resolvable:
+ throw new IgniteException("Failed to resolve secondary file system configuration path " +
+ "(ensure that it exists locally and you have read access to it): " + cfgPath);
+ }
+
+ cfg.addResource(url);
+ }
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stop() throws IgniteException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeString(out, uri);
+
+ if (cfgPaths != null) {
+ out.writeInt(cfgPaths.length);
+
+ for (String cfgPath : cfgPaths)
+ U.writeString(out, cfgPath);
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ uri = U.readString(in);
+
+ int cfgPathsCnt = in.readInt();
+
+ if (cfgPathsCnt != -1) {
+ cfgPaths = new String[cfgPathsCnt];
+
+ for (int i = 0; i < cfgPathsCnt; i++)
+ cfgPaths[i] = U.readString(in);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/262af698/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/CachingHadoopFileSystemFactory.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/CachingHadoopFileSystemFactory.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/CachingHadoopFileSystemFactory.java
index 52d4db5..baad1fc 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/CachingHadoopFileSystemFactory.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/CachingHadoopFileSystemFactory.java
@@ -17,62 +17,28 @@
package org.apache.ignite.hadoop.fs;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.processors.hadoop.HadoopUtils;
import org.apache.ignite.internal.processors.hadoop.fs.HadoopFileSystemsUtils;
import org.apache.ignite.internal.processors.hadoop.fs.HadoopLazyConcurrentMap;
-import org.apache.ignite.internal.processors.igfs.IgfsPaths;
import org.apache.ignite.internal.processors.igfs.IgfsUtils;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lifecycle.LifecycleAware;
+
+import java.io.IOException;
/**
- * The class is to be instantiated as a Spring beans, so it must have public zero-arg constructor.
- * The class is serializable as it will be transferred over the network as a part of {@link IgfsPaths} object.
+ * Caching Hadoop file system factory. File systems are cache on per-user basis.
*/
-public class CachingHadoopFileSystemFactory implements HadoopFileSystemFactory, Externalizable, LifecycleAware {
+public class CachingHadoopFileSystemFactory extends BasicHadoopFileSystemFactory {
/** Lazy per-user cache for the file systems. It is cleared and nulled in #close() method. */
- private final transient HadoopLazyConcurrentMap<String, FileSystem> fileSysLazyMap = new HadoopLazyConcurrentMap<>(
+ private final transient HadoopLazyConcurrentMap<String, FileSystem> cache = new HadoopLazyConcurrentMap<>(
new HadoopLazyConcurrentMap.ValueFactory<String, FileSystem>() {
- @Override public FileSystem createValue(String key) {
- try {
- assert !F.isEmpty(key);
-
- return createFileSystem(key);
- }
- catch (IOException ioe) {
- throw new IgniteException(ioe);
- }
+ @Override public FileSystem createValue(String key) throws IOException {
+ return create0(key);
}
}
);
- /** Configuration of the secondary filesystem, never null. */
- protected transient Configuration cfg;
-
- /** */
- protected transient URI uri;
-
- /** */
- protected String uriStr;
-
- /** */
- protected List<String> cfgPathStr;
-
/**
* Public non-arg constructor.
*/
@@ -81,131 +47,24 @@ public class CachingHadoopFileSystemFactory implements HadoopFileSystemFactory,
}
/** {@inheritDoc} */
- @Override public FileSystem create(String userName) throws IOException {
- A.ensure(cfg != null, "cfg");
-
- return fileSysLazyMap.getOrCreate(userName);
- }
-
- /**
- * Uri setter.
- *
- * @param uriStr The URI to set.
- */
- public void setUri(String uriStr) {
- this.uriStr = uriStr;
- }
-
- /**
- * Gets the URI.
- *
- * @return The URI.
- */
- public URI getUri() {
- return uri;
- }
-
- /**
- * Configuration(s) setter, to be invoked from Spring config.
- *
- * @param cfgPaths The config paths collection to set.
- */
- public void setConfigPaths(List<String> cfgPaths) {
- this.cfgPathStr = cfgPaths;
- }
-
- /**
- * Gets the config paths collection.
- *
- * @return The config paths collection.
- */
- public List<String> getConfigPaths() {
- return cfgPathStr;
- }
-
- /**
- * @return {@link org.apache.hadoop.fs.FileSystem} instance for this secondary Fs.
- * @throws IOException
- */
- protected FileSystem createFileSystem(String userName) throws IOException {
- userName = IgfsUtils.fixUserName(userName);
-
- assert cfg != null;
-
- final FileSystem fileSys;
-
- try {
- fileSys = FileSystem.get(uri, cfg, userName);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
-
- throw new IOException("Failed to create file system due to interrupt.", e);
- }
-
- return fileSys;
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeString(out, uriStr);
-
- U.writeCollection(out, cfgPathStr);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- uriStr = U.readString(in);
-
- cfgPathStr = new ArrayList(U.readCollection(in));
+ @Override public FileSystem create(String usrName) throws IOException {
+ return cache.getOrCreate(IgfsUtils.fixUserName(usrName));
}
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
- cfg = HadoopUtils.safeCreateConfiguration();
-
- if (cfgPathStr != null) {
- for (String confPath : cfgPathStr) {
- if (confPath == null)
- throw new IgniteException("Null config path encountered.");
- else {
- URL url = U.resolveIgniteUrl(confPath);
-
- if (url == null) {
- // If secConfPath is given, it should be resolvable:
- throw new IgniteException("Failed to resolve secondary file system configuration path " +
- "(ensure that it exists locally and you have read access to it): " + confPath);
- }
-
- cfg.addResource(url);
- }
- }
- }
+ super.start();
- // if secondary fs URI is not given explicitly, try to get it from the configuration:
- if (uriStr == null)
- uri = FileSystem.getDefaultUri(cfg);
- else {
- try {
- uri = new URI(uriStr);
- }
- catch (URISyntaxException use) {
- throw new IgniteException("Failed to resolve secondary file system URI: " + uriStr);
- }
- }
-
- assert uriStr != null;
-
- // Disable caching:
- String prop = HadoopFileSystemsUtils.disableFsCachePropertyName(uri.getScheme());
-
- cfg.setBoolean(prop, true);
+ // Disable caching.
+ cfg.setBoolean(HadoopFileSystemsUtils.disableFsCachePropertyName(fullUri.getScheme()), true);
}
/** {@inheritDoc} */
@Override public void stop() throws IgniteException {
+ super.stop();
+
try {
- fileSysLazyMap.close();
+ cache.close();
}
catch (IgniteCheckedException ice) {
throw new IgniteException(ice);
http://git-wip-us.apache.org/repos/asf/ignite/blob/262af698/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
index 9942ec4..99b8f5a 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
@@ -122,7 +122,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
fac.setUri(uri);
if (cfgPath != null)
- fac.setConfigPaths(Collections.singletonList(cfgPath));
+ fac.setConfigPaths(cfgPath);
setFileSystemFactory(fac);
setDefaultUserName(userName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/262af698/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemCacheUtils.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemCacheUtils.java
index 48ade79..1ecbee5 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemCacheUtils.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemCacheUtils.java
@@ -39,7 +39,7 @@ public class HadoopFileSystemCacheUtils {
public static HadoopLazyConcurrentMap<FsCacheKey, FileSystem> createHadoopLazyConcurrentMap() {
return new HadoopLazyConcurrentMap<>(
new HadoopLazyConcurrentMap.ValueFactory<FsCacheKey, FileSystem>() {
- @Override public FileSystem createValue(FsCacheKey key) {
+ @Override public FileSystem createValue(FsCacheKey key) throws IOException {
try {
assert key != null;
@@ -57,8 +57,10 @@ public class HadoopFileSystemCacheUtils {
return FileSystem.get(uri, cfg, key.user());
}
- catch (IOException | InterruptedException ioe) {
- throw new IgniteException(ioe);
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+
+ throw new IOException("Failed to create file system due to interrupt.", e);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/262af698/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java
index 5808d01..e399a4a 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.hadoop.fs;
import java.io.Closeable;
+import java.io.IOException;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.ReadWriteLock;
@@ -204,8 +205,8 @@ public class HadoopLazyConcurrentMap<K, V extends Closeable> {
*
* @param key the key to create value for
* @return the value.
- * @throws IgniteException on failure.
+ * @throws IOException On failure.
*/
- public V createValue(K key);
+ public V createValue(K key) throws IOException;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/262af698/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java
index 98ab317..59bf7ee 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java
@@ -17,13 +17,6 @@
package org.apache.ignite.igfs;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Collections;
-import java.util.concurrent.Callable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileStatus;
@@ -49,6 +42,13 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.util.concurrent.Callable;
+
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -176,7 +176,7 @@ public class HadoopSecondaryFileSystemConfigurationTest extends IgfsCommonAbstra
CachingHadoopFileSystemFactory fac = new CachingHadoopFileSystemFactory();
- fac.setConfigPaths(Collections.singletonList(primaryConfFullPath));
+ fac.setConfigPaths(primaryConfFullPath);
fac.setUri(primaryFsUriStr);
fac.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/262af698/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java
index d473592..14ff25d 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java
@@ -17,30 +17,6 @@
package org.apache.ignite.igfs;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.reflect.Field;
-import java.net.URI;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayDeque;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Deque;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.ContentSummary;
@@ -60,9 +36,9 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.hadoop.fs.CachingHadoopFileSystemFactory;
import org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem;
import org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem;
-import org.apache.ignite.hadoop.fs.CachingHadoopFileSystemFactory;
import org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsEx;
import org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsIpcIo;
import org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsOutProc;
@@ -81,6 +57,30 @@ import org.apache.ignite.testframework.GridTestUtils;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ThreadLocalRandom8;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.net.URI;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayDeque;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Deque;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -386,7 +386,7 @@ public abstract class IgniteHadoopFileSystemAbstractSelfTest extends IgfsCommonA
CachingHadoopFileSystemFactory fac = new CachingHadoopFileSystemFactory();
fac.setUri(SECONDARY_URI);
- fac.setConfigPaths(Collections.singletonList(SECONDARY_CFG_PATH));
+ fac.setConfigPaths(SECONDARY_CFG_PATH);
IgniteHadoopIgfsSecondaryFileSystem sec = new IgniteHadoopIgfsSecondaryFileSystem();
[4/4] ignite git commit: IGNITE-2206: Finalization for V2.
Posted by vo...@apache.org.
IGNITE-2206: Finalization for V2.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c8755e87
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c8755e87
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c8755e87
Branch: refs/heads/ignite-2206
Commit: c8755e8747fe076373401e60cc89d3439e89ce41
Parents: 7915c12
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 23 18:26:31 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 23 18:26:31 2015 +0300
----------------------------------------------------------------------
.../fs/v2/HadoopAbstractFileSystemFactory.java | 21 ---------
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 47 ++++++++++----------
2 files changed, 23 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c8755e87/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/HadoopAbstractFileSystemFactory.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/HadoopAbstractFileSystemFactory.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/HadoopAbstractFileSystemFactory.java
deleted file mode 100644
index cf81e57..0000000
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/HadoopAbstractFileSystemFactory.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.apache.ignite.hadoop.fs.v2;
-
-import java.io.IOException;
-import java.io.Serializable;
-import org.apache.hadoop.fs.AbstractFileSystem;
-
-/**
- * This factory is {@link Serializable} because it should be transferable over the network.
- */
-interface HadoopAbstractFileSystemFactory extends Serializable {
- /**
- * Gets the file system, possibly creating it or taking a cached instance.
- * All the other data needed for the file system creation are expected to be contained
- * in this object instance.
- *
- * @param userName The user name
- * @return The file system.
- * @throws IOException On error.
- */
- public AbstractFileSystem get(String userName) throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c8755e87/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
index 59d870c..347f2ae 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
@@ -35,7 +35,6 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.util.DataChecksum;
import org.apache.hadoop.util.Progressable;
-import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.igfs.IgfsBlockLocation;
import org.apache.ignite.igfs.IgfsFile;
@@ -58,7 +57,6 @@ import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lifecycle.LifecycleAware;
import org.jetbrains.annotations.Nullable;
import java.io.BufferedOutputStream;
@@ -171,9 +169,6 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
/** Secondary file system instance. */
private AbstractFileSystem secondaryFs;
- /** Secondary file system factory. */
- private HadoopAbstractFileSystemFactory factory;
-
/** Whether custom sequential reads before prefetch value is provided. */
private boolean seqReadsBeforePrefetchOverride;
@@ -338,23 +333,26 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
}
if (initSecondary) {
- try {
- factory = (HadoopAbstractFileSystemFactory) paths.getPayload();
- }
- catch (IgniteCheckedException e) {
- throw new IOException("Failed to get secondary file system factory.", e);
- }
-
- A.ensure(secondaryUri != null, "File system factory uri should not be null.");
-
- try {
- secondaryFs = factory.get(user);
-
- secondaryUri = secondaryFs.getUri();
- }
- catch (IOException e) {
- throw new IOException("Failed to connect to the secondary file system: " + secondaryUri, e);
- }
+ throw new IOException("Proxy mode is not supported for the V2 file system.");
+
+ // TODO: Enable.
+// try {
+// factory = (HadoopAbstractFileSystemFactory) paths.getPayload();
+// }
+// catch (IgniteCheckedException e) {
+// throw new IOException("Failed to get secondary file system factory.", e);
+// }
+//
+// A.ensure(secondaryUri != null, "File system factory uri should not be null.");
+//
+// try {
+// secondaryFs = factory.get(user);
+//
+// secondaryUri = secondaryFs.getUri();
+// }
+// catch (IOException e) {
+// throw new IOException("Failed to connect to the secondary file system: " + secondaryUri, e);
+// }
}
}
finally {
@@ -373,8 +371,9 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
if (clientLog.isLogEnabled())
clientLog.close();
- if (factory instanceof LifecycleAware)
- ((LifecycleAware) factory).stop();
+ // TODO: Enable.
+// if (factory instanceof LifecycleAware)
+// ((LifecycleAware) factory).stop();
// Reset initialized resources.
rmtClient = null;