private GetSnapshotReplyActor(Params params) { this.params = params; getContext().setReceiveTimeout(params.receiveTimeout); }
private ShardManagerGetSnapshotReplyActor(Params params) { this.params = params; remainingShardNames = new HashSet<>(params.shardNames); LOG.debug("{}: Expecting {} shard snapshot replies", params.id, params.shardNames.size()); getContext().setReceiveTimeout(params.receiveTimeout); }
@Override public void execute(final Object message) throws Exception { /* Stop the timer here. */ final UntypedActorContext context = getContext(); context.setReceiveTimeout(Duration.Undefined()); final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); final DeleteConnection dlcx = new DeleteConnection(source, callId, secondaryEndpointId, secondaryConnId); gateway.tell(dlcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
protected void onDestroyEndpoint(DestroyEndpoint message, ActorRef self, ActorRef sender) { if (!id.getLocalEndpointName().contains("$")) { if (!this.destroying.get()) { if (logger.isInfoEnabled()) { String msg = String.format("About to destroy endoint %s", id); logger.info(msg); } this.destroying.set(true); DeleteConnection dlcx = new DeleteConnection(self, this.id); this.gateway.tell(dlcx, self); // Make sure we don't wait forever getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } } else { this.pendingDestroy.set(true); this.pendingDestroyEndpointSender = sender; this.pendingDestroyEndpointMessage = message; if (logger.isInfoEnabled()) { String msg = String.format("DestroyEndoint %s will be set to pending until previous transaction completes", id); logger.info(msg); } } }
@Override public void execute(final Object message) throws Exception { final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); final DeleteConnection dlcx = new DeleteConnection(source, callId, endpointId, connId); gateway.tell(dlcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
@Override public void execute(final Object message) throws Exception { final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); final DeleteConnection dlcx = new DeleteConnection(source, callId, primaryEndpointId, primaryConnId); gateway.tell(dlcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
@Override public void execute(final Object message) throws Exception { final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); final DeleteConnection dlcx = new DeleteConnection(source, callId, endpointId, connId); gateway.tell(dlcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
@Override public void execute(final Object message) throws Exception { /* Stop the timer. */ final UntypedActorContext context = getContext(); context.setReceiveTimeout(Duration.Undefined()); // Handle results from opening or modifying states. final Class<?> klass = message.getClass(); if (CreateConnectionResponse.class.equals(klass)) { super.execute(message); } else if (ModifyConnectionResponse.class.equals(klass)) { final ModifyConnectionResponse response = (ModifyConnectionResponse) message; localDesc = response.getLocalConnectionDescriptor(); } final ConnectionStateChanged event = new ConnectionStateChanged(localDesc, ConnectionStateChanged.State.OPEN, connId); for (final ActorRef observer : observers) { observer.tell(event, source); } // Log the state change. log(ConnectionStateChanged.State.OPEN); } }
@Override public ShardTransaction create() throws Exception { final ShardTransaction tx; switch (type) { case READ_ONLY: tx = new ShardReadTransaction(transaction, shardActor, shardStats); break; case READ_WRITE: tx = new ShardReadWriteTransaction((ReadWriteShardDataTreeTransaction)transaction, shardActor, shardStats); break; case WRITE_ONLY: tx = new ShardWriteTransaction((ReadWriteShardDataTreeTransaction)transaction, shardActor, shardStats); break; default: throw new IllegalArgumentException("Unhandled transaction type " + type); } tx.getContext().setReceiveTimeout(datastoreContext.getShardTransactionIdleTimeout()); return tx; } }
@Override public void apply(Object message) { if (message instanceof Ack && ((Ack) message).workId.equals(workId())) { sendToMaster(new WorkerRequestsWork(workerId)); getContext().setReceiveTimeout(Duration.Undefined()); getContext().become(idle); } else if (message instanceof ReceiveTimeout) { log.info("No ack from master, retrying (" + workerId + " -> " + workId() + ")"); sendToMaster(new WorkIsDone(workerId, workId(), result)); } else { unhandled(message); } } };
@Override public void execute(final Object message) throws Exception { super.execute(message); /* Stop the timer. */ final UntypedActorContext context = getContext(); context.setReceiveTimeout(Duration.Undefined()); // Notify the observers. final ConnectionStateChanged event = new ConnectionStateChanged(localDesc, ConnectionStateChanged.State.HALF_OPEN, connId); for (final ActorRef observer : observers) { observer.tell(event, source); } // Log the state change. log(ConnectionStateChanged.State.HALF_OPEN); } }
@Override public void execute(final Object message) throws Exception { super.execute(message); /* Stop the timer. */ final UntypedActorContext context = getContext(); context.setReceiveTimeout(Duration.Undefined()); // Notify the observers. final ConnectionStateChanged event = new ConnectionStateChanged(localDesc, ConnectionStateChanged.State.HALF_OPEN, connId); for (final ActorRef observer : observers) { observer.tell(event, source); } // Log the state change. log(ConnectionStateChanged.State.HALF_OPEN); } }
@Override public void execute(final Object message) throws Exception { /* Stop the timer. */ final UntypedActorContext context = getContext(); context.setReceiveTimeout(Duration.Undefined()); // Notify the observers. final ConnectionStateChanged event = new ConnectionStateChanged(ConnectionStateChanged.State.CLOSED, connId); for (final ActorRef observer : observers) { observer.tell(event, source); } // Log the state change. log(ConnectionStateChanged.State.CLOSED); // If we timed out log it. if (message instanceof ReceiveTimeout) { logger.error("The media gateway failed to respond in the requested timout period."); } } }
@Override public void execute(final Object message) throws Exception { /* Stop the timer. */ final UntypedActorContext context = getContext(); context.setReceiveTimeout(Duration.Undefined()); // Notify the observers. final LinkStateChanged event = new LinkStateChanged(LinkStateChanged.State.CLOSED, secondaryConnId); for (final ActorRef observer : observers) { observer.tell(event, source); } // Log the state change. log(LinkStateChanged.State.CLOSED); // If we timed out log it. if (message instanceof ReceiveTimeout) { logger.error("The media gateway failed to respond in the requested timout period."); } } }
@Override public void execute(final Object message) throws Exception { final OpenConnection request = (OpenConnection) message; final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); final CreateConnection crcx = new CreateConnection(source, callId, endpointId, request.mode()); remoteDesc = request.descriptor(); if (remoteDesc != null) { crcx.setRemoteConnectionDescriptor(remoteDesc); } crcx.setNotifiedEntity(agent); LocalOptionValue[] localOptions = new LocalOptionValue[] { new LocalOptionExtension("webrtc", String.valueOf(webrtc)) }; crcx.setLocalConnectionOptions(localOptions); gateway.tell(crcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
@Override public void execute(final Object message) throws Exception { final OpenConnection request = (OpenConnection) message; final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); final CreateConnection crcx = new CreateConnection(source, callId, endpointId, request.mode()); remoteDesc = request.descriptor(); if (remoteDesc != null) { crcx.setRemoteConnectionDescriptor(remoteDesc); } crcx.setNotifiedEntity(agent); LocalOptionValue[] localOptions = new LocalOptionValue[] { new LocalOptionExtension("webrtc", String.valueOf(webrtc)) }; crcx.setLocalConnectionOptions(localOptions); gateway.tell(crcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
@Override public void execute(final Object message) throws Exception { final UpdateLink request = (UpdateLink) message; final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); ModifyConnection mdcx = null; switch (request.type()) { case PRIMARY: { mdcx = new ModifyConnection(source, callId, primaryEndpointId, primaryConnId); } case SECONDARY: { mdcx = new ModifyConnection(source, callId, secondaryEndpointId, secondaryConnId); } } final ConnectionMode mode = request.mode(); if (mode != null) { mdcx.setMode(mode); } gateway.tell(mdcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
@Override public void apply(Object message) { if (message instanceof WorkComplete) { Object result = ((WorkComplete) message).result; log.info("Work is complete. Result {}.", result); sendToMaster(new WorkIsDone(workerId, workId(), result)); getContext().setReceiveTimeout(Duration.create(5, "seconds")); getContext().become(waitForWorkIsDoneAck(result)); } else if (message instanceof Work) { log.info("Yikes. Master told me to do work, while I'm working."); } else { unhandled(message); } } };
@Override public void execute(final Object message) throws Exception { final UpdateConnection request = (UpdateConnection) message; final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); requestedConnId = request.connectionIdentifier(); requestedConnId = requestedConnId==null ? connId:requestedConnId; final ModifyConnection mdcx = new ModifyConnection(source, callId, endpointId, requestedConnId); final ConnectionMode mode = request.mode(); if (mode != null) { mdcx.setMode(mode); } final ConnectionDescriptor descriptor = request.descriptor(); if (descriptor != null) { mdcx.setRemoteConnectionDescriptor(descriptor); remoteDesc = descriptor; } gateway.tell(mdcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
@Override public void execute(final Object message) throws Exception { final OpenLink request = (OpenLink) message; if(request.primaryEndpointId() != null) primaryEndpointId = new EndpointIdentifier(request.primaryEndpointId(), primaryEndpointId.getDomainName()); if(request.secondaryEndpointId() != null) secondaryEndpointId = new EndpointIdentifier(request.secondaryEndpointId(), secondaryEndpointId.getDomainName()); final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); final CreateConnection crcx = new CreateConnection(source, callId, primaryEndpointId, request.mode()); crcx.setNotifiedEntity(agent); crcx.setSecondEndpointIdentifier(secondaryEndpointId); gateway.tell(crcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }