better failure when trying to obtain a native lock on the node data location, and reduce the tries from 100 to 50.
This commit is contained in:
parent
e1c86b86e5
commit
3e624bf9e0
|
@ -56,7 +56,8 @@ public class NodeEnvironment extends AbstractComponent {
|
||||||
Lock lock = null;
|
Lock lock = null;
|
||||||
File dir = null;
|
File dir = null;
|
||||||
int localNodeId = -1;
|
int localNodeId = -1;
|
||||||
for (int i = 0; i < 100; i++) {
|
IOException lastException = null;
|
||||||
|
for (int i = 0; i < 50; i++) {
|
||||||
dir = new File(new File(environment.dataWithClusterFile(), "nodes"), Integer.toString(i));
|
dir = new File(new File(environment.dataWithClusterFile(), "nodes"), Integer.toString(i));
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
|
@ -71,11 +72,11 @@ public class NodeEnvironment extends AbstractComponent {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// ignore
|
lastException = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lock == null) {
|
if (lock == null) {
|
||||||
throw new IOException("Failed to obtain node lock");
|
throw new IOException("Failed to obtain node lock", lastException);
|
||||||
}
|
}
|
||||||
this.localNodeId = localNodeId;
|
this.localNodeId = localNodeId;
|
||||||
this.lock = lock;
|
this.lock = lock;
|
||||||
|
|
Loading…
Reference in New Issue