Called as a callback for sending *died* notifications to all the
        partners.
        Check if someone has offered to restart the agent.
        If yes, setup expiration call and wait for report.
        If no, initiate doing it on our own.
349593
def _ensure_someone_took_responsability(self, state, _responses):
        '''
        
        '''
        if not state.so_took_responsability:
            self.debug('Noone took responsability, I will try to restart '
                       '%r agent myself', state.factory.descriptor_type)
            return self._restart_yourself()
1002608
def dead(self):
        
        if not self._weak:
            return False
        cb = self._callback()
        if cb is None:
            return True
        return False
1049352
private void waitForAsyncSendsResolution() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "waitForAsyncSendsResolution");

        //AsyncSend is only for non-managed environments.. no need to wait for managed environment
        if (!isManaged()) {

            synchronized (_inProgressAysncSends) {
                while (_inProgressAysncSends.get() > 0L) {
                    try {
                        //wait for 20 seconds.. and again check for condition..if no notification comes before then.
                        _inProgressAysncSends.wait(1000 * 20);
                    } catch (InterruptedException e) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                            SibTr.debug(tc, "waitForAsyncSendsResolution got interrupted", e);
                    }
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "waitForAsyncSendsResolution");
    }
558369
def _handle_cancel_notification(self, msg_id):
        """"""
        request_future = self._client_request_futures.pop(msg_id, None)

        if not request_future:
            log.warn("Received cancel notification for unknown message id %s", msg_id)
            return

        # Will only work if the request hasn't started executing
        if request_future.cancel():
            log.debug("Cancelled request with id %s", msg_id)
228950
def die(*messages):
    
    sys.stderr.write("%s.%s: " % get_caller_info(trace=True))
    sys.stderr.write(' '.join(map(str, messages)))
    sys.stderr.write('\n')
    sys.exit(1)
1138517
def set_dead(self):
        
        was_alive = self.alive
        self.alive = False
        self.reachable = False
        self.attempt = 0
        # We will have to create a new connection...
        self.con = None

        # We are dead now! We must propagate the sad news...
        if was_alive and not self.stopping:
            logger.warning("Setting the satellite %s as dead :(", self.name)
            self.broks.append(self.get_update_status_brok())
1245895
def finish_and_die(self):
        
        self.logstate('finish_and_die')
        self.stop_working_on_queue()
        if self.jobphase != 'pending_request':
            self.stopFactory()
393172
def _auto_commit(self, by_count=False):
        """"""
        # Check if we are even supposed to do any auto-committing
        if (self._stopping or self._shuttingdown or (not self._start_d) or
                (self._last_processed_offset is None) or
                (not self.consumer_group) or
                (by_count and not self.auto_commit_every_n)):
            return

        # If we're auto_committing because the timer expired, or by count and
        # we don't have a record of our last_committed_offset, or we've
        # processed enough messages since our last commit, then try to commit
        if (not by_count or self._last_committed_offset is None or
            (self._last_processed_offset - self._last_committed_offset
             ) >= self.auto_commit_every_n):
            if not self._commit_ds:
                commit_d = self.commit()
                commit_d.addErrback(self._handle_auto_commit_error)
            else:
                # We're waiting on the last commit to complete, so add a
                # callback to be called when the current request completes
                d = Deferred()
                d.addCallback(self._retry_auto_commit, by_count)
                self._commit_ds.append(d)
33396
@Override
  public void handleNotification(Notification notification, Object handback) {
    LocalGossipMember deadMember = (LocalGossipMember) notification.getUserData();
    GossipService.LOGGER.debug("Dead member detected: " + deadMember);
    members.put(deadMember, GossipState.DOWN);
    if (listener != null) {
      listener.gossipEvent(deadMember, GossipState.DOWN);
    }
  }
1088775
public void finish() {
        if ( finSignal == null && finished )
            return;
        // signal finish of execution, so remoting can clean up callback id mappings
        // override if always single result or finish can be emitted by the remote method
        // note one can send FINSILENT to avoid the final message to be visible to receiver callback/spore
        cb.complete(null, null);
        finished = true;
    }
559723
public void notifyEnd(String projectApiId, String projectVersion, String category, long duration) {
		try {
			if (isStarted()) {
				JSONObject endNotification = new JSONObject().
					put("project", new JSONObject().
						put("apiId", projectApiId).
						put("version", projectVersion)
					).
					put("category", category).
					put("duration", duration);
				
				socket.emit("run:end", endNotification);
			}
			else {
				LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the end notification");
			}
		}
		catch (Exception e) {
			LOGGER.log(Level.INFO, "Unable to send the end notification to the agent. Cause: " + e.getMessage());
			
			if (LOGGER.getLevel() == Level.FINEST) {
				LOGGER.log(Level.FINEST, "Exception:", e);
			}
		}
	}
118377
function() {
      var t = this,
          now = Date.now();

      // This kicks off the send
      t.lastSendTime = now;
      t.set({
        bundle: t.queue,
        sequence: t.get('sequence') + 1
      });

      // Reset
      t.queue = [];
      if (t.timer) {
        clearTimeout(t.timer);
        t.timer = null;
      }
    }
1074128
def flush(self):
        
        self._flush_notification.set()
        if self.sender:
            self.sender.start()
534364
public synchronized void sendNotification(Supplier<String> textSupplier, Supplier<U> userDataSupplier, LongSupplier timestampSupplier)
    {
        if (!map.isEmpty())
        {
            sendNotification(textSupplier.get(), userDataSupplier.get(), timestampSupplier.getAsLong());
        }
    }
1064310
public void stop() {

		this.logger.info( "Agent '" + getAgentId() + "' is about to be stopped." );

		// Stop the timer
		if( this.heartBeatTimer != null ) {
			this.heartBeatTimer.cancel();
			this.heartBeatTimer = null;
		}

		// Prevent NPE for successive calls to #stop()
		if( this.messagingClient == null )
			return;

		// Send a last message to the DM
		try {
			if( this.messagingClient.isConnected()) {
				this.messagingClient.sendMessageToTheDm( new MsgNotifMachineDown( this.applicationName, this.scopedInstancePath ));
				this.logger.fine( "Agent " + getAgentId() + " notified the DM it was about to stop." );
			}

		} catch( IOException e ) {
			this.logger.warning( e.getMessage());
			Utils.logException( this.logger, e );
		}

		// Close the connection
		try {
			this.messagingClient.getMessageProcessor().stopProcessor();
			this.messagingClient.getMessageProcessor().interrupt();
			this.messagingClient.closeConnection();

		} catch( IOException e ) {
			this.logger.warning( e.getMessage());
			Utils.logException( this.logger, e );
		}

		this.logger.info( "Agent '" + getAgentId() + "' was stopped." );
	}
1310305
synchronized void started() {
        try {
            if(isConnected()) {
                channelHandler.executeRequest(new ServerStartedRequest(), null).getResult().await();
            }
        } catch (Exception e) {
            ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to send started notification");
        }
    }
1110284
def on_aborted(self):
        

        print('Authentication aborted')

        # Authentication aborted
        self.is_authenticating.acquire()
        self.is_authenticating.notify_all()
        self.is_authenticating.release()