REST中的Java Client取消线程 [英] Java Client cancelling thread in REST

查看:79
本文介绍了REST中的Java Client取消线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想取消从客户端触发的REST线程,但是由于REST应该是无状态的,该如何实现?

I wanted to cancel the REST thread triggered from client, however as REST should be stateless, how can this be achieved?

推荐答案

如果要在服务器端取消请求,只需返回响应即可. 如果您想杀死当前正在执行REST请求的线程,只需杀死该线程即可.

If you want to cancel the request on the server side, just return a response. In case you want to kill the thread that is currently doing REST request, just kill the thread.

REST是无状态的,意味着Web服务器不存储有关客户端应用程序/会话状态的任何状态.会话存储在客户端上.服务器是无状态的,这意味着每台服务器都可以随时为任何客户端提供服务,没有会话亲缘关系或粘性会话.相关的会话信息存储在客户端上,并根据需要传递到服务器.

REST is stateless means that the web server does not store any state about the client application/session state. The session is stored on the client. The server is stateless means that every server can service any client at any time, there is no session affinity or sticky sessions. The relevant session information is stored on the client and passed to the server as needed.

这篇关于REST中的Java Client取消线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆