java.util.concurrent.get(Object paramObject)
时间: 2024-02-18 17:42:13 浏览: 30
`java.util.concurrent.get(Object paramObject)` 方法并不存在,可能是您误打误撞地输入了错误的方法名。Java中的`java.util.concurrent`包提供了一些并发编程工具,比如`Executor`框架、线程池、并发集合等等,您可以查阅相关文档了解更多信息。如果您有其他问题,欢迎继续提问。
相关问题
package wffz.jxmjkh.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import wffz.common.contants.ConstantProperties; import wffz.jxmjkh.service.JxMjKhTxService; import javax.annotation.PostConstruct; import java.text.ParseException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @RestController public class JxMjkhTxController { @Autowired private ScheduledExecutorService scheduledExecutorService; @Autowired private JxMjKhTxService jxMjKhTxService; @Autowired private ConstantProperties constantProperties; @PostConstruct public void init() { scheduledExecutorService.scheduleAtFixedRate(new SaveResultTask(jxMjKhTxService), 0, 1, TimeUnit.MINUTES); } @GetMapping("/saveTxData") public List<Map<String, Object>> getResult() throws ParseException { return jxMjKhTxService.selectJxMjkhTxData(constantProperties.getJsbh()); } }
这是一个使用 Spring Boot 框架开发的 RESTful 风格的接口控制器类。其中包含了以下注解:
- `@RestController`: 表示该类为一个 RESTful 接口控制器。
- `@Autowired`: 表示自动注入依赖对象。
- `@PostConstruct`: 表示在对象创建后进行初始化操作。
- `@GetMapping`: 表示该方法处理 HTTP GET 请求。
该类中包含的方法有:
- `init()`: 在对象创建后调用,启动一个定时任务,每分钟执行一次 `SaveResultTask` 类的 `run()` 方法。
- `getResult()`: 处理 HTTP GET 请求,返回经过处理后的结果列表。
java CompletableFuture.AsynchronousCompletionTask
`CompletableFuture.AsynchronousCompletionTask` 是一个 Java 类,它实现了 `java.util.concurrent.CompletionStage` 接口和 `java.util.concurrent.Future` 接口。
这个类用于支持 `CompletableFuture` 的异步执行和完成操作。它会在异步任务完成时设置结果,并通知等待的线程。
`CompletableFuture.AsynchronousCompletionTask` 提供了以下方法:
- `boolean exec()`:执行异步任务,并返回是否成功执行。
- `void setCompleted(Object result)`:设置异步任务的完成结果。
- `Object getResult()`:获取异步任务的完成结果。
这个类通常由 `CompletableFuture` 内部使用,用于支持异步操作和任务的执行。它是 Java 并发编程中的一个重要组件,可以帮助开发者实现异步、并行的操作。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)