官术网_书友最值得收藏!

  • Learning Apache Apex
  • Thomas Weise Munagala V. Ramanath David Yan Kenneth Knowles
  • 276字
  • 2021-07-02 22:38:41

IdleTimeHandler

Sometimes, an operator is idle, which means there is no work to do because no tuples are available on the input stream for processing (or in the case of an input operator, no data is produced on the output port(s)). Some operators could make use of the idle time to do bookkeeping work, such as maintaining caches or other other background processing. Apex provides the IdleTimeHandler interface that operators may implement to use the extra CPU time in the engine managed operator thread.

  • handleIdleTime: This is called whenever the engine detects that the operator isn't doing any processing. If the implementation also doesn't have any work to do, it should block the call for a short duration to prevent a busy loop, as the method is called again and again until the operator is no longer idle.

This section was an introduction to developing custom operators. Note that, in many cases, it isn't necessary to develop a complete custom operator from scratch. Often it is sufficient to extend an existing operator with a few overrides or configure a generic operator with the desired behavior. An example would be the FunctionOperator that accepts a user defined function (equivalent of Java 8 Lambda Expression) as property. It eliminates the needs to write boilerplate code that deals with operator ports and life cycle methods, which are in many cases not required to express the business logic. The high-level Java API, which was introduced in the first chapter, provides the same benefit of concise specification of custom logic for those cases where the predefined primitive functions are sufficient.

For more information about custom operator development, please refer to http://apex.apache.org/docs/apex/operator_development/#developing-custom-operators.

主站蜘蛛池模板: 尉犁县| 仙游县| 昔阳县| 台中县| 永和县| 辽宁省| 邳州市| 文化| 墨竹工卡县| 东乌| 博罗县| 西平县| 苗栗市| 荥经县| 驻马店市| 台北市| 武陟县| 永济市| 东阿县| 交城县| 正镶白旗| 和平区| 怀化市| 鄂尔多斯市| 志丹县| 中牟县| 嘉义县| 格尔木市| 仁布县| 邯郸市| 合肥市| 顺昌县| 墨江| 上思县| 平塘县| 赤水市| 花垣县| 石泉县| 东阿县| 弋阳县| 湛江市|