Skip to content

Commit

Permalink
解决打开已经配置插件的项目时如果没有对应的hadoop环境,idea打开超极慢,卡死的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyuzhong2016 committed Oct 19, 2018
1 parent 6404c69 commit 45a2248
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ public class Constants
public static final String FS_FILE_IMPL_VALUE = "org.apache.hadoop.fs.LocalFileSystem";
public static final String FS_DEFAULTFS_KEY = "fs.defaultFS";
public static final String YARN_RESOURCEMANAGER_SCHEDULER_ADDRESS="yarn.resourcemanager.scheduler.address";
/**
*IPC 超时重试次数
*/
public static final String IPC_CLIENT_CONNECT_MAX_RETRIES_ON_TIMEOUTS ="ipc.client.connect.max.retries.on.timeouts";
/**
* IPC 超时设置
*/
public static final String IPC_CLIENT_CONNECT_TIMEOUT="ipc.client.connect.timeout";
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public ConnectionHandlerImpl(ConnectionBundle connectionBundle, ConnectionSettin
configurationHdfs.set(Constants.FS_FILE_IMPL_KEY,Constants.FS_FILE_IMPL_VALUE);
configurationHdfs.set(Constants.FS_DEFAULTFS_KEY, hdfsPath);
configurationHdfs.set(Constants.YARN_RESOURCEMANAGER_SCHEDULER_ADDRESS,yarnResourceAMPath);
/*************解决卡死的问题*******************************************************/
configurationHdfs.set(Constants.IPC_CLIENT_CONNECT_TIMEOUT, "3000"); //默认连接3s超时
configurationHdfs.set(Constants.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_TIMEOUTS, "1");// 超时后重试1次
/*********************************************************************************/
//通过配置初始化HDFS的FileSystem
InitiFileSystem(configurationHdfs);
}
Expand Down Expand Up @@ -187,6 +191,8 @@ public boolean createTestConnection() throws IOException
}
else
{
fileSystem.getConf().set(Constants.IPC_CLIENT_CONNECT_TIMEOUT, "3000"); //默认连接3s超时
fileSystem.getConf().set(Constants.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_TIMEOUTS, "1");// 超时后重试1次
canConnection = fileSystem.exists(new Path("/"));
}
return canConnection;
Expand Down

0 comments on commit 45a2248

Please sign in to comment.