• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ReceiveTimeout类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中akka.actor.ReceiveTimeout的典型用法代码示例。如果您正苦于以下问题:Java ReceiveTimeout类的具体用法?Java ReceiveTimeout怎么用?Java ReceiveTimeout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReceiveTimeout类属于akka.actor包,在下文中一共展示了ReceiveTimeout类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public void onReceive(Object message) {
    if (message instanceof CaptureSnapshotReply) {
        Snapshot snapshot = Snapshot.create(
                ((CaptureSnapshotReply)message).getSnapshotState(),
                params.captureSnapshot.getUnAppliedEntries(),
                params.captureSnapshot.getLastIndex(), params.captureSnapshot.getLastTerm(),
                params.captureSnapshot.getLastAppliedIndex(), params.captureSnapshot.getLastAppliedTerm(),
                params.electionTerm.getCurrentTerm(), params.electionTerm.getVotedFor(),
                params.peerInformation);

        LOG.debug("{}: Received CaptureSnapshotReply, sending {}", params.id, snapshot);

        params.replyToActor.tell(new GetSnapshotReply(params.id, snapshot), getSelf());
        getSelf().tell(PoisonPill.getInstance(), getSelf());
    } else if (message instanceof ReceiveTimeout) {
        LOG.warn("{}: Got ReceiveTimeout for inactivity - did not receive CaptureSnapshotReply within {} ms",
                params.id, params.receiveTimeout.toMillis());

        params.replyToActor.tell(new akka.actor.Status.Failure(new TimeoutException(String.format(
                "Timed out after %d ms while waiting for CaptureSnapshotReply",
                    params.receiveTimeout.toMillis()))), getSelf());
        getSelf().tell(PoisonPill.getInstance(), getSelf());
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:26,代码来源:GetSnapshotReplyActor.java


示例2: onReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public void onReceive(Object message) {
    if (message instanceof GetSnapshotReply) {
        onGetSnapshotReply((GetSnapshotReply)message);
    } else if (message instanceof Failure) {
        LOG.debug("{}: Received {}", params.id, message);

        params.replyToActor.tell(message, getSelf());
        getSelf().tell(PoisonPill.getInstance(), getSelf());
    } else if (message instanceof ReceiveTimeout) {
        String msg = String.format(
                "Timed out after %s ms while waiting for snapshot replies from %d shard(s). %d shard(s) %s "
                + "did not respond.", params.receiveTimeout.toMillis(), params.shardNames.size(),
                remainingShardNames.size(), remainingShardNames);
        LOG.warn("{}: {}", params.id, msg);
        params.replyToActor.tell(new Failure(new TimeoutException(msg)), getSelf());
        getSelf().tell(PoisonPill.getInstance(), getSelf());
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:ShardManagerGetSnapshotReplyActor.java


示例3: waitForWorkIsDoneAck

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
private Procedure<Object> waitForWorkIsDoneAck(final Object result) {
    return message -> {
        if (message instanceof Ack && ((Ack) message).workId.equals(jobId())) {
            sendToMaster(new MasterWorkerProtocol.WorkerRequestsWork(workerId, workerRole));
            getContext().setReceiveTimeout(Duration.Undefined());
            getContext().become(receiveBuilder()
                    .matchAny(p->idle.apply(p))
                    .build());
        } else if (message instanceof ReceiveTimeout) {
            log.info("No ack from master, retrying (" + workerId + " -> " + jobId() + ")");
            sendToMaster(new MasterWorkerProtocol.WorkIsDone(workerId, jobId(), result));
        } else {
            unhandled(message);
        }
    };
}
 
开发者ID:Abiy,项目名称:distGatling,代码行数:17,代码来源:Worker.java


示例4: createReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public Receive createReceive() {
  return receiveBuilder()
    .match(ActorIdentity.class, identity -> {
      calculator = identity.getRef();
      if (calculator == null) {
        System.out.println("Remote actor not available: " + path);
      } else {
        getContext().watch(calculator);
        getContext().become(active, true);
      }
    })
    .match(ReceiveTimeout.class, x -> {
      sendIdentifyRequest();
    })
    .build();
}
 
开发者ID:iproduct,项目名称:course-social-robotics,代码行数:18,代码来源:LookupActor.java


示例5: waitForWorkIsDoneAck

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
/**
    * After the worker sends the result of his work to the master he waits for 
    * the ACK of this message.
    * @param result
    * @return
    */
private Behavior waitForWorkIsDoneAck(final Object result) {
  return new Behavior() {
    public void apply(Object message) {
  	// The receive ACK message that mean Master receive the result of his work
      if (message instanceof Ack && ((Ack) message).workId.equals(workId())) {
      	// Worker ask for new work
        sendToMaster(new WorkerRequestsWork(workerId));
        getContext().setReceiveTimeout(Duration.Undefined());
        getContext().become(idle);
      }
      // if he does not receive ACK, worker resends a new WorkIsDone message
      else if (message instanceof ReceiveTimeout) {
        log.debug("No ack from master, retrying (" + workerId + " -> " + workId() + ")");
        sendToMaster(new WorkIsDone(workerId, workId(), result));
      }
      else {
        unhandled(message);
      }
    }
  };
}
 
开发者ID:awltech,项目名称:karajan,代码行数:28,代码来源:StepExecutor.java


示例6: waitingForAck

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
private Procedure<Object> waitingForAck() {
	return new Procedure<Object>() {

		@Override
		public void apply(Object msg) throws Exception {
			if(msg instanceof Ack) {
				log.debug("transaction committed");
				
				getContext().stop(getSelf());
			} else if(msg instanceof Failure) {
				log.error("failed to commit: {}", msg);
				
				sender.tell(msg, getSelf());
				getContext().stop(getSelf());
			} else if(msg instanceof ReceiveTimeout) {
				log.error("timout while committing");
				
				sender.tell(new Failure(new TimeoutException("while commiting")), getSelf());
				getContext().stop(getSelf());
			} else {
				unhandled(msg);
			}
		}
		
	};
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:27,代码来源:VectorDatasetFetcher.java


示例7: onReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public void onReceive(Object msg) throws Exception {
	if(msg instanceof TransactionCreated) {
		log.debug("transaction created");
		
		try {
			databaseScheme = databaseConfig.getString("scheme");
		} catch(ConfigException.Missing cem) {
			databaseScheme = "SDE";
		}
		
		log.debug("database scheme before calling get fetch table: " + databaseScheme);
		
		transaction = ((TransactionCreated)msg).getActor();
		transaction.tell(SDEUtils.getFetchTable(SDEUtils.getItemsFilter(), databaseScheme), getSelf());
		
		getContext().become(onReceiveStreaming());
	} else if(msg instanceof ReceiveTimeout) {
		log.error("timeout received");
		getContext().stop(getSelf());
	} else {
		unhandled(msg);
	}
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:25,代码来源:SDEListDatasetInfoHandler.java


示例8: onReceiveCommitAck

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
protected Procedure<Object> onReceiveCommitAck() {
	return new Procedure<Object>() {

		@Override
		public void apply(Object msg) throws Exception {
			if(msg instanceof Ack) {
				log.debug("transaction finished");
				getContext().stop(getSelf());
			} else if(msg instanceof ReceiveTimeout) {
				log.error("timeout received");
				getContext().stop(getSelf());
			}
		}
		
	};
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:17,代码来源:SDEListDatasetInfoHandler.java


示例9: onReceiveDatasetInfo

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
private Procedure<Object> onReceiveDatasetInfo() {
	return new Procedure<Object>() {

		@Override
		public void apply(Object msg) throws Exception {
			if(msg instanceof DatasetInfo) {
				log.debug("dataset info received");
				originalSender.tell(msg, getSelf());
				transaction.tell(new Commit(), getSelf());
				getContext().become(onReceiveCommitAck());
			} else if(msg instanceof ReceiveTimeout) {
				unavailable();
			} else {
				unhandled(msg);
			}
		}
	};
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:19,代码来源:SDEGetDatasetInfoHandler.java


示例10: onReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public final void onReceive(Object msg) throws Exception {
	if(msg instanceof ReceiveTimeout) {
		log.error("timeout while collecting information");
		
		sender.tell(new Failure(new TimeoutException("collecting information")), getSelf());
		getContext().stop(getSelf());
	} else if(msg instanceof MetadataNotFound) {
		log.debug("metadata not found");
		
		sender.tell(new DatasetNotFound(((MetadataNotFound)msg).getIdentification()), getSelf());
		getContext().stop(getSelf());
	} else if(msg instanceof MetadataItem) {
		log.debug("metadata item");
		
		MetadataDocumentFactory metadataDocumentFactory = new MetadataDocumentFactory();
		MetadataDocument metadataDocument = metadataDocumentFactory.parseDocument(((MetadataItem)msg).getContent());
		
		handleMetadataDocument(metadataDocument);
	} else {			
		unhandled(msg);
	}
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:24,代码来源:AbstractDatasetFetcher.java


示例11: onReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public void onReceive(Object msg) throws Exception {
	if(msg instanceof ReceiveTimeout) {
		log.error("timeout");
		
		sendUnavailable();
	} else if(msg instanceof MetadataNotFound) {
		log.debug("metadata not found");
		
		tellTarget(new DatasetNotFound(((MetadataNotFound) msg).getIdentification()));
	} else if(msg instanceof MetadataItem) {
		log.debug("metadata item");
			
		handleMetadataItem((MetadataItem)msg);
	}  else {
		onReceiveElse(msg);
	}
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:19,代码来源:AbstractDatasetInfoBuilder.java


示例12: onReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public final void onReceive(Object msg) throws Exception {
	if(msg instanceof Commit) {
		handleCommit();
	} else if(msg instanceof Rollback) {
		handleRollback();
	} else if(msg instanceof Query) {
		handleQuery((Query)msg);
	} else if(msg instanceof StreamingQuery) {
		handleStreamingQuery((StreamingQuery)msg);
	} else if(msg instanceof ReceiveTimeout) {
		handleTimeout();
	} else if(msg instanceof Terminated) {
		handleTerminated((Terminated)msg);
	} else {
		unhandled(msg);
	}
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:19,代码来源:JdbcTransaction.java


示例13: onReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public void onReceive(Object msg) throws Exception {
	if(msg instanceof ReceiveTimeout) {
		log.error("timeout");
	} else {		
		log.debug("answer received");
		
		origSender.forward(msg, getContext());
		
		if(msg instanceof Failure) {
			log.debug("failure received");
		} else {
			log.debug("dispatching event messages");
			
			Event event = new Event(origMsg, msg);
			for(ActorRef listener : listeners) {
				listener.tell(event, getSelf());
			}
		}
	}
	
	getContext().stop(getSelf());
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:24,代码来源:EventDispatcher.java


示例14: beforeDelete

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
private Procedure<Object> beforeDelete(ActorRef sender, Class<?> entity) {
	return new Procedure<Object>() {

		@Override
		public void apply(Object msg) throws Exception {
			if(msg instanceof ReceiveTimeout) {
				log.error("timeout while waiting for beforeDelete to complete");
				
				sender.tell(new EventFailed(), getSelf());
				getContext().setReceiveTimeout(Duration.Inf());
				getContext().become(receive());
			} else if(msg instanceof BeforeCompleted) {
				log.debug("before completed");
				
				sender.tell(new EventWaiting(), getSelf());
				getContext().become(afterDelete(sender, entity, ((BeforeCompleted)msg).getResult()));
			} else {
				log.debug("message stashed: {} from {}", msg, getSender());
				
				stash();
			}
		}
		
	};
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:26,代码来源:AbstractAdmin.java


示例15: become

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
protected void become(String message, Procedure<Object> behavior) {
	log.debug("become: {}", message);
	
	getContext().become(new Procedure<Object>() {

		@Override
		public void apply(Object msg) throws Exception {
			if(msg instanceof ReceiveTimeout) {
				log.debug("receive timeout");
				
				if(!acknowledged) {
					acknowledgeJob();
				}
				
				jobContext.tell(new UpdateJobState(JobState.ABORTED), getSelf());
				
				getContext().stop(getSelf());
			} else {
				behavior.apply(msg);
			}
			
		}
	});
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:25,代码来源:AbstractLoaderSessionInitiator.java


示例16: onReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public void onReceive(Object msg) throws Exception {
	if(msg instanceof ReceiveTimeout) {
		log.error("timeout while starting job: {}", jobInfo);
		
		getContext().parent().tell(new Ack(), getSelf());
		getContext().stop(getSelf());
	} else if(msg instanceof Ack) {
		log.debug("acknowledged");
		
		getContext().parent().tell(msg, getSender());
		getContext().stop(getSelf());
	} else {
		log.debug("other message");
		
		getContext().become(started());
		getSelf().forward(msg, getContext());
	}
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:20,代码来源:JobContext.java


示例17: onReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void onReceive(Object msg) throws Exception {
	if(msg instanceof ReceiveTimeout) {
		log.error("timeout");
		
		getContext().stop(getSelf());
	} else if(msg instanceof DatasetInfo) {
		log.debug("dataset info received");
		
		receiver.tell(startImport((U)msg), getSelf());
	} else if(msg instanceof Ack) {
		log.debug("receiver is ready");
		
		provider.tell(getDataset(), receiver);
		
		getContext().stop(getSelf());
	} else {
		unhandled(msg);
	}
	
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:23,代码来源:ProviderFetchDatasetInitiator.java


示例18: vacuuming

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
private Procedure<Object> vacuuming() {
	return new Procedure<Object>() {

		@Override
		public void apply(Object msg) throws Exception {
			if(msg instanceof Vacuumed) {
				log.debug("vacuum completed");
				vacuumed(JobState.SUCCEEDED);
			} else if(msg instanceof ReceiveTimeout) {
				log.error("timeout while vacuuming");
				vacuumed(JobState.FAILED);
			} else {
				elseProvisioning(msg);
			}
		}

		private void vacuumed(JobState result) {
			getContext().parent().tell(new UpdateJobState(result), getSelf());
			
			getContext().setReceiveTimeout(Duration.Inf());
			getContext().become(receive());
		}
		
	};
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:26,代码来源:GeoServerService.java


示例19: handleReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public void handleReceive(final Object message) {
    if (CloseTransaction.isSerializedType(message)) {
        closeTransaction(true);
    } else if (message instanceof ReceiveTimeout) {
        LOG.debug("Got ReceiveTimeout for inactivity - closing transaction {}", transactionId);
        closeTransaction(false);
    } else {
        unknownMessage(message);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:ShardTransaction.java


示例20: createReceive

import akka.actor.ReceiveTimeout; //导入依赖的package包/类
@Override
public Receive createReceive() {
    return ReceiveBuilder.create()
        .match(CommandWithHandler.class, m -> {
            @SuppressWarnings("unchecked") CommandWithHandler msg = m;
            handleCommand(msg.command, msg.handler);
        })
        .match(commandType, this::handleCommand)
        .matchEquals(ReceiveTimeout.getInstance(), msg -> passivate())
        .match(Stop.class, msg -> context().stop(self()))
        .build();
}
 
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:13,代码来源:AbstractStatefulPersistentActor.java



注:本文中的akka.actor.ReceiveTimeout类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AMRNBPacketizer类代码示例发布时间:2022-05-22
下一篇:
Java ModifierSet类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap