martin преди 3 години
родител
ревизия
868ab49035

+ 2 - 1
simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/MinioUtil.java

@@ -114,7 +114,8 @@ public class MinioUtil {
     ) throws IOException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException, io.minio.errors.ServerException, io.minio.errors.InternalException {
         InputStream inputStream = multipartFile.getInputStream();
         long objectSize = multipartFile.getSize();
-        long partSize = 5 * 1024 * 1024L; // 分片最小 5M
+//        long partSize = 5 * 1024 * 1024L; // 分片最小 5M
+        long partSize = -1; // 不分片
         minioClient.putObject(PutObjectArgs.builder()
                 .stream(inputStream, objectSize, partSize)
                 .bucket(bucketName)

+ 2 - 6
simulation-resource-monitor/src/main/java/com/css/simulation/resource/monitor/SimulationResourceMonitorApplication.java

@@ -3,14 +3,10 @@ package com.css.simulation.resource.monitor;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication
-@EnableFeignClients
-@EnableDiscoveryClient
-@EnableResourceServer
+@EnableScheduling
 public class SimulationResourceMonitorApplication {
 
     public static void main(String[] args) {

+ 18 - 0
simulation-resource-monitor/src/main/java/com/css/simulation/resource/monitor/scheduler/Statistic.java

@@ -0,0 +1,18 @@
+package com.css.simulation.resource.monitor.scheduler;
+
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+public class Statistic {
+
+    /**
+     * 内存使用率统计。
+     */
+    @Scheduled(fixedDelay = 60 * 60 * 1000)
+    public void df() {
+        diskFreeService.getDiskFree();
+    }
+
+
+}