Pārlūkot izejas kodu

增加OkHttp配置文件读取

tags/v1.0.0^2
林万龙 pirms 3 gadiem
vecāks
revīzija
009d2f0967
2 mainītis faili ar 4 papildinājumiem un 13 dzēšanām
  1. +1
    -11
      src/main/java/com/telpo/dipperposition/DipperPositionApplication.java
  2. +3
    -2
      src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java

+ 1
- 11
src/main/java/com/telpo/dipperposition/DipperPositionApplication.java Parādīt failu

@@ -47,19 +47,9 @@ public class DipperPositionApplication {
PositionConfigInfo pci; PositionConfigInfo pci;
pci = (PositionConfigInfo)environment.getSystemProperties().get("position-server"); pci = (PositionConfigInfo)environment.getSystemProperties().get("position-server");
DipperPositionServer nettyServer2 = new DipperPositionServer(pci); DipperPositionServer nettyServer2 = new DipperPositionServer(pci);
nettyServer2.start();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }
} }

private static void test() throws NacosException {
String serverAddr = "172.16.192.26";
String dataId = "dipperposition-service";
String group = "DEFAULT_GROUP";
Properties properties = new Properties();
properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr);
ConfigService configService = NacosFactory.createConfigService(properties);
String content = configService.getConfig(dataId, group, 5000);
System.out.println(content);
}
} }

+ 3
- 2
src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java Parādīt failu

@@ -14,6 +14,8 @@ import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;


import java.net.InetSocketAddress;

/** /**
* @program: DipperPositionServer * @program: DipperPositionServer
* @description: 北斗定位 * @description: 北斗定位
@@ -153,8 +155,7 @@ public class DipperPositionServer {
EventLoopGroup mainThreadGroup = new NioEventLoopGroup(1); EventLoopGroup mainThreadGroup = new NioEventLoopGroup(1);
//new 一个工作线程组 //new 一个工作线程组
EventLoopGroup workThreadGroup = new NioEventLoopGroup(200); EventLoopGroup workThreadGroup = new NioEventLoopGroup(200);
//InetSocketAddress socketAddress = new InetSocketAddress(serverAddr,
// starsAsycPort);
//InetSocketAddress socketAddress = new InetSocketAddress(serverAddr,null);
ServerBootstrap bootstrap = new ServerBootstrap() ServerBootstrap bootstrap = new ServerBootstrap()
.group(mainThreadGroup, workThreadGroup) .group(mainThreadGroup, workThreadGroup)
.channel(NioServerSocketChannel.class) .channel(NioServerSocketChannel.class)


Notiek ielāde…
Atcelt
Saglabāt