Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-WIC-Cnf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-WIC-Cnf
Commits
b1f9cdb1
Commit
b1f9cdb1
authored
Oct 22, 2020
by
Elf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
放在kvm中
问题 可能会出现sateIP.txt这个文件找不到的情况
parent
f6bd61a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
19 deletions
+32
-19
apps/cnf-distributed-business-computing/dbc-business-client/pom.xml
...istributed-business-computing/dbc-business-client/pom.xml
+0
-6
apps/cnf-distributed-business-computing/dbc-business-client/src/main/java/top/ninwoo/dbc/client/service/FileService.java
.../main/java/top/ninwoo/dbc/client/service/FileService.java
+32
-13
No files found.
apps/cnf-distributed-business-computing/dbc-business-client/pom.xml
View file @
b1f9cdb1
...
...
@@ -37,12 +37,6 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
top.ninwoo
</groupId>
<artifactId>
cnf-client-starter
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
apps/cnf-distributed-business-computing/dbc-business-client/src/main/java/top/ninwoo/dbc/client/service/FileService.java
View file @
b1f9cdb1
package
top.ninwoo.dbc.client.service
;
import
top.ninwoo.bishe.starter.service.NetworkService
;
import
top.ninwoo.dbc.api.po.*
;
import
top.ninwoo.dbc.api.service.DistributedComService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -11,11 +8,17 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
top.ninwoo.dbc.api.po.ComputingResult
;
import
top.ninwoo.dbc.api.po.FileSlice
;
import
top.ninwoo.dbc.api.po.MergeResult
;
import
top.ninwoo.dbc.api.po.SplitResult
;
import
top.ninwoo.dbc.api.service.DistributedComService
;
import
javax.annotation.PostConstruct
;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.FileReader
;
import
java.io.IOException
;
import
java.util.*
;
...
...
@@ -35,17 +38,15 @@ public class FileService{
@Autowired
private
RestTemplate
restTemplate
;
@Autowired
private
NetworkService
networkService
;
@Autowired
private
DistributedComService
distributedComService
;
//不需要了,我懒得改
Long
clusterId
=
11113L
;
//docker集群ID
String
[]
wxName_list
=
new
String
[]{
"sate1"
,
"sate2"
,
"sate3"
,
"sate4"
,
"sate5"
,
"sate6"
,
"sate7"
,
"sate8"
,
"sate9"
,
"sate10"
,
"sate11"
,
"sate12"
,
"sate13"
,
"sate14"
,
"sate15"
,
"sate16"
,
"sate17"
,
"sate18"
,
"sate19"
,
"sate20"
,
"sate21"
,
"sate22"
,
"sate23"
,
"sate24"
,
"sate25"
,
"sate26"
,
"sate27"
,
"sate28"
,
"sate29
"
};
//获取卫星名字
String
[]
wxName_list
=
new
String
[]{
"sate1"
,
"sate2"
,
"sate3"
,
"sate4
"
};
//获取卫星名字
private
String
[]
ipList
=
new
String
[
29
];
...
...
@@ -62,7 +63,7 @@ public class FileService{
/*获取容器ip*/
/* String[] ipList = new String[]{"127.0.0.1:8080","127.0.0.1:8081","127.0.0.1:8082","127.0.0.1:8083","127.0.0.1:8084",
"127.0.0.1:8085","127.0.0.1:8086"};*/
public
String
[]
getIpList
(
Long
clusterId
,
String
appName
)
{
/*
public String[] getIpList(Long clusterId, String appName) {
List<String> ipListS = networkService.getIpListByAppName(clusterId, appName);//用于存储容器ip的list集合
String[] containerIp = new String[ipListS.size()];//将集合中的元素存在数组里,因为下边用的是数组
for (int i = 0; i < ipListS.size(); i++) {
...
...
@@ -74,9 +75,9 @@ public class FileService{
}
}
return containerIp;
}
}
*/
public
String
getIpByAppName
(
Long
clusterId
,
String
appName
)
{
/*
public String getIpByAppName(Long clusterId,String appName) {
List<String> ipList = networkService.getIpListByAppName(clusterId, appName);
if(!ipList.isEmpty()){
String ip_tmp = ipList.get(0);
...
...
@@ -84,6 +85,24 @@ public class FileService{
return split_list[0] + ":8082";
}
return null;
}*/
//todo 可能会有找不到文件的情况
public
String
getIpByAppName
(
Long
clusterId
,
String
appName
)
{
String
str
;
File
file
=
new
File
(
directoryOutput
+
"sateIP.txt"
);
try
{
BufferedReader
br
=
new
BufferedReader
(
new
FileReader
(
file
));
while
((
str
=
br
.
readLine
())
!=
null
){
if
(
str
.
startsWith
(
appName
)){
String
sateIp
=
str
.
split
(
":"
)[
1
];
return
sateIp
+
":8082"
;
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
null
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment