Jactor介绍

   网上可以找到作者Jactor的源码:

作者对actor的解释:

Actors are objects which send messages to each other and which process only one message at a time. Messages are
 
      either requests or responses. When an actor sends a request to another actor, it expects to receive a single
 
      response unless an exception has been thrown.

       Actors 是对象之间能够相互发送消息而且一次只能处理一个消息,消息就是一个请求或者一个响应。

       当一个actor发送一个请求给另外一个actor的时候,它期望接收一个响应消息除非抛出了异常。

   When an actor sends a message it provides a callback to handle the response. The callback may be invoked either
  immediately or later. After sending a message, an actor may send additional messages or return control, at which
   point it may receive other requests or pending responses.

   当actor发送一个消息的时候,它提供了一个回调函数来处理响应消息。回调函数有可能立即执行也有可能稍后执行。

发送一个消息后,actor可以发送更多的消息或者接收其他的请求或者等待响应

    An actor typically interleaves the processing of multiple requests. To process a request to completion, an actor may
  need to send requests to other actors (in series or parallel) and process the responses to those requests. Actors
  process requests and responses as they are received whenever the actor is not busy processing a message. There is no
 way to block incoming requests. Actors are thread-safe, but message processing is not atomic.

  一个actor通常交错处理多个请求。为了处理一个完整性的请求,一个actor需要发送请求给其他的(串联或并联)actor 而且 需要对这些响应做处理。

  当actors不忙与处理一个消息的时候,无论何时会 处理请求和回复。它不会阻断请求。actor是线程安全的,但消息处理不是原子性的。

Some actors are asynchronous. Requests sent to an asynchronous actor are processed on a different thread. Actors which
  perform heavy computation or which do I/O should be asynchronous. Asynchronous actors play an important role in
  vertical scalability, allowing a program to make effective use of multiple hardware threads. But care should be used,
  as asynchronous message passing tends to be slow.

  一些actor是异步的,发送一个请求给一个异步的actor时,处理会在一个不同的线程上。actor在执行大量的计算或者耗io的操作应当异步执行。

异步的actor在垂直可扩展性方面扮演了重要角色,允许程序有效的使用多线程。在使用的时候需要注意,应当是一个较慢的短暂异步消息。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值