Skip to content

Commit 45a2248

Browse files
解决打开已经配置插件的项目时如果没有对应的hadoop环境,idea打开超极慢,卡死的BUG
1 parent 6404c69 commit 45a2248

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/main/java/com/fangyuzhong/intelliJ/hadoop/core/Constants.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,12 @@ public class Constants
1111
public static final String FS_FILE_IMPL_VALUE = "org.apache.hadoop.fs.LocalFileSystem";
1212
public static final String FS_DEFAULTFS_KEY = "fs.defaultFS";
1313
public static final String YARN_RESOURCEMANAGER_SCHEDULER_ADDRESS="yarn.resourcemanager.scheduler.address";
14+
/**
15+
*IPC 超时重试次数
16+
*/
17+
public static final String IPC_CLIENT_CONNECT_MAX_RETRIES_ON_TIMEOUTS ="ipc.client.connect.max.retries.on.timeouts";
18+
/**
19+
* IPC 超时设置
20+
*/
21+
public static final String IPC_CLIENT_CONNECT_TIMEOUT="ipc.client.connect.timeout";
1422
}

src/main/java/com/fangyuzhong/intelliJ/hadoop/fsconnection/ConnectionHandlerImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ public ConnectionHandlerImpl(ConnectionBundle connectionBundle, ConnectionSettin
7171
configurationHdfs.set(Constants.FS_FILE_IMPL_KEY,Constants.FS_FILE_IMPL_VALUE);
7272
configurationHdfs.set(Constants.FS_DEFAULTFS_KEY, hdfsPath);
7373
configurationHdfs.set(Constants.YARN_RESOURCEMANAGER_SCHEDULER_ADDRESS,yarnResourceAMPath);
74+
/*************解决卡死的问题*******************************************************/
75+
configurationHdfs.set(Constants.IPC_CLIENT_CONNECT_TIMEOUT, "3000"); //默认连接3s超时
76+
configurationHdfs.set(Constants.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_TIMEOUTS, "1");// 超时后重试1次
77+
/*********************************************************************************/
7478
//通过配置初始化HDFS的FileSystem
7579
InitiFileSystem(configurationHdfs);
7680
}
@@ -187,6 +191,8 @@ public boolean createTestConnection() throws IOException
187191
}
188192
else
189193
{
194+
fileSystem.getConf().set(Constants.IPC_CLIENT_CONNECT_TIMEOUT, "3000"); //默认连接3s超时
195+
fileSystem.getConf().set(Constants.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_TIMEOUTS, "1");// 超时后重试1次
190196
canConnection = fileSystem.exists(new Path("/"));
191197
}
192198
return canConnection;

0 commit comments

Comments
 (0)