#region watchdog methods executed in watchdog
430691
private function watchdogStart() {
        $socket = null;
        $this->watchdogPID = $this->fork($socket);
        if ($this->watchdogPID !== 0) {
            $this->sockets[$this->watchdogPID] = $socket;
            return;
        }

        $this->processType = self::PROCESS_TYPE_WATCHDOG;
        $this->clearSigHandlers();

        $jid              = $this->job->getId();
        $this->who        = 'watchdog:' . $this->workerName;
        $this->logContext = ['type' => $this->who];
        $status           = 'watching events for ' . $jid . ' since ' . strftime('%F %T');
        $this->updateProcLine($status);
        $this->logger->info($status, $this->logContext);

        ini_set("default_socket_timeout", -1);
        $l = $this->client->createListener(['ql:log']);
        $l->messages(function ($channel, $event) use ($l, $jid) {
            if (!in_array($event->event, ['lock_lost', 'canceled', 'completed', 'failed']) || $event->jid !== $jid) {
                return;
            }

            switch ($event->event) {
                case 'lock_lost':
                    if ($event->worker === $this->workerName) {
                        $this->logger->info("{type}: sending SIGKILL to child {$this->childPID}; job handed out to another worker", $this->logContext);
                        posix_kill($this->childPID, SIGKILL);
                        $l->stop();
                    }
                    break;

                case 'canceled':
                    if ($event->worker === $this->workerName) {
                        $this->logger->info("{type}: sending SIGKILL to child {$this->childPID}; job canceled", $this->logContext);
                        posix_kill($this->childPID, SIGKILL);
                        $l->stop();
                    }
                    break;

                case 'completed':
                case 'failed':
                    $l->stop();
                    break;
            }
        });

        socket_close($socket);
        $this->logger->info("{type}: done", $this->logContext);

        exit(0);
    }
1062305
public boolean checkCondition() {

        // assure that the checkinterval is elapsed .....
        if (super.checkCondition()) {
            return true;
        }

        if (this.watchdogReference.isStale()) {
            return false;
        }

        Watchdog wd = this.watchdogReference.getWatchdog();

        //log.info("Checking "+this+"\n watched WD is alive="+watchedWatchdog.isAlive()+" is killed="+watchedWatchdog.isKilled()+" WD-Thead="+this.watchedWatchdog.getThreadHandle());
        if (!wd.isAlive()) {
            if (log.isInfoEnabled()) {
                String logString = "RestartCondition :: Watchdog " + wd.getThreadHandle() + " is not alive ";
                log.info(new CheckConditionFailedLog(this, logString).toString());
            }
            return false;
        }
        return true;
    }
954570
private void processMethods(Set<ExecutableElement> hookMethodsFromInterfaces) {
    List<ExecutableElement> templateMethods = ElementFilter
        .methodsIn(component.getEnclosedElements())
        .stream()
        .filter(ComponentGeneratorsUtil::isMethodVisibleInTemplate)
        .filter(method -> !isHookMethod(component, method, hookMethodsFromInterfaces))
        .collect(Collectors.toList());

    templateMethods.forEach(method -> {
      String methodName = method.getSimpleName().toString();
      String exposedMethodName = exposeExistingJavaMethodToJs(method);
      optionsBuilder.addStatement("options.addMethod($S, p.$L)", methodName, exposedMethodName);
    });
  }
238586
@Override
    public boolean isActive() {
        try {
            validateInitialization();
        } catch (InvalidStateException ex) {
            return false;
        }
        return informerWatchDog.isActive() && serverWatchDog.isActive();
    }
246506
@Override
  public void notifyWatch(byte[] key)
  {
    int hash = _table.getPodHash(key);
    
    TablePodNode node = getNode(hash);
    
    if (node.isSelfOwner()) {
      _table.notifyWatch(key);
    }
    else {
      ServerBartender owner = node.getOwner();
      
      ClusterServiceKraken proxy = _podKraken.getProxy(owner.getId());
    
      if (proxy != null) {
        proxy.notifyWatch(_table.getKey(), key);
      }
    }
  }
1285212
@Override
    public void sawOpcode(int seen) {
        if (seen != Const.INVOKESPECIAL) {
            return;
        }

        String calledClassName = getClassConstantOperand();
        String calledMethodName = getNameConstantOperand();
        String calledMethodSig = getSigConstantOperand();
        if (calledClassName.equals(getSuperclassName()) && calledMethodName.equals(getMethodName())
                && calledMethodSig.equals(getMethodSig())) {
            sawCallToSuper = true;
        }

    }
1093826
public void run() {
    log.trace("{} started.", this);
    synchronized (this) {
      // Just in case this object is reused in the future
      finished = false;
    }

    final byte[] buf = new byte[this.size];

    int length;
    try {
      while ((length = is.read(buf)) > 0) {
        os.write(buf, 0, length);
        if(flushImmediately) {
        	os.flush();
        }
      }
    } catch (Exception e) {
      // nothing to do - happens quite often with watchdog
    } finally {
      log.trace("{} finished.", this);
      if (closeWhenExhausted) {
        try {
          os.close();
        } catch (IOException e) {
          log.error("Got exception while closing exhausted output stream", e);
        }
      }
      synchronized (this) {
        finished = true;
        notifyAll();
      }
    }
  }
1297460
private void sawIINC(int pc) {
        int reg = getRegisterOperand();
        if (!ignoreRegs.get(reg)) {
            ScopeBlock sb = findScopeBlock(rootScopeBlock, pc);
            if (sb != null) {
                sb.addLoad(reg, pc);
            } else {
                ignoreRegs.set(reg);
            }
        }
        if (catchHandlers.get(pc)) {
            ignoreRegs.set(reg);
        } else if (!monitorSyncPCs.isEmpty()) {
            ignoreRegs.set(reg);
        } else if (sawNull) {
            ignoreRegs.set(reg);
        }

        if (!ignoreRegs.get(reg)) {
            ScopeBlock sb = findScopeBlock(rootScopeBlock, pc);
            if (sb != null) {
                sb.addStore(reg, pc, null);
                if (sawDup) {
                    sb.addLoad(reg, pc);
                }
            } else {
                ignoreRegs.set(reg);
            }
        }
    }
536762
function() {
      var t = this,
          map = {},
          router = Monitor.getRouter(),
          hostName = Monitor.getRouter().getHostName(),
          appName = Monitor.Config.Monitor.appName,
          appInstance = process.env.NODE_APP_INSTANCE;

      // Add this process to the map
      map[hostName] = {};
      map[hostName][appName] = {
        instances: [appInstance],
        probeClasses: _.keys(Probe.classes)
      };

      // Process all known connections
      var connections = router.findConnections();
      connections.forEach(function(connection) {
        hostName = connection.get('hostName') || connection.get('remoteHostName');
        appName = connection.get('remoteAppName') || '';
        appInstance = connection.get('remoteAppInstance') || '';

        // Don't add to the map not yet connected
        if (connection.connecting || !connection.connected) {
          return;
        }

        // Add the hostname to the map
        var host = map[hostName];
        if (!host) {
          host = map[hostName] = {};
        }

        // Add the app to the map
        var app = host[appName];
        if (!app) {
          app = host[appName] = {
            instances: [appInstance],
            probeClasses: connection.get('remoteProbeClasses')
          };
        } else {
          app.instances.push(appInstance);
        }
      });
      log.info('buildMap', map);

      // Set the map if it's changed.  This method is called whenever
      // connections come and go - including firewalled connections which
      // aren't visible in the map.  Only update if the map has changed.
      if (!_.isEqual(map, t.get('map'))) {
        log.info('mapChanged');
        t.set({
          map: map,
          updateSequence: t.updateSequence++
        });
      } else {
        log.info('mapNotChanged');
      }
    }
891111
private void deployWatcher(Object target, Method method, String watchedKey) throws Exception {

        configurationUtil.subscribe(watchedKey, (key, value) -> {

            if (Objects.equals(watchedKey, key)) {

                try {
                    if (String.class.equals(method.getParameters()[0].getType())) {
                        method.invoke(target, value);
                    } else if (Boolean.class.equals(method.getParameters()[0].getType()) || boolean.class.equals(method
                            .getParameters()[0].getType())) {
                        method.invoke(target, Boolean.parseBoolean(value));
                    } else if (Float.class.equals(method.getParameters()[0].getType()) || float.class.equals(method
                            .getParameters()[0].getType())) {
                        try {
                            method.invoke(target, Float.parseFloat(value));
                        } catch (NumberFormatException e) {
                            log.severe("Exception while storing new value: Number format exception. " +
                                    "Expected: Float. Value: " + value);
                        }
                    } else if (Double.class.equals(method.getParameters()[0].getType()) || double.class.equals(method
                            .getParameters()[0].getType())) {
                        try {
                            method.invoke(target, Double.parseDouble(value));
                        } catch (NumberFormatException e) {
                            log.severe("Exception while storing new value: Number format exception. Expected:" +
                                    " Double. Value: " + value);
                        }
                    } else if (Integer.class.equals(method.getParameters()[0].getType()) || int.class.equals(method
                            .getParameters()[0].getType())) {
                        try {
                            method.invoke(target, Integer.parseInt(value));
                        } catch (NumberFormatException e) {
                            log.severe("Exception while storing new value: Number format exception. Expected:" +
                                    " Integer. Value: " + value);
                        }
                    } else if (Long.class.equals(method.getParameters()[0].getType()) || long.class.equals(method
                            .getParameters()[0].getType())) {
                        try {
                            method.invoke(target, Long.parseLong(value));
                        } catch (NumberFormatException e) {
                            log.severe("Exception while storing new value: Number format exception. Expected:" +
                                    " Long. Value: " + value);
                        }
                    }
                } catch (IllegalAccessException e) {
                    log.severe("Illegal access exception: " + e.toString());
                } catch (InvocationTargetException e) {
                    log.severe("Invocation target exception: " + e.toString());
                }

            }
        });
    }
120917
async def _inform_watchdog(self):
        """"""
        async with self._wd_lock:
            if self._watchdog_task is None:
                # Check within the Lock to deal with external cancel_watchdog
                # calls with queued _inform_watchdog tasks.
                return
            self._watchdog_task.cancel()
            try:
                await self._watchdog_task
            except asyncio.CancelledError:
                self._watchdog_task = self.loop.create_task(self._watchdog(
                    self._watchdog_timeout))
328033
void endIfStarted(CodeAttribute b, ClassMethod method) {
        b.aload(getLocalVariableIndex(0));
        b.dup();
        final BranchEnd ifnotnull = b.ifnull();
        b.checkcast(Stack.class);
        b.invokevirtual(Stack.class.getName(), END_INTERCEPTOR_CONTEXT_METHOD_NAME, EMPTY_PARENTHESES + VOID_CLASS_DESCRIPTOR);
        BranchEnd ifnull = b.gotoInstruction();
        b.branchEnd(ifnotnull);
        b.pop(); // remove null Stack
        b.branchEnd(ifnull);
    }
906082
def watchdog_handler(self):
        """"""
        _LOGGING.debug('%s Watchdog expired. Resetting connection.', self.name)
        self.watchdog.stop()
        self.reset_thrd.set()
927609
@Override
    public void disable() throws IOException {
        isOpen();
        int ret = WDT.disable(fd);
        if(ret<0) {
            throw new IOException("Cannot disable WatchDog.  File " + filename + " got " + ret + " back.");
        }
    }
328554
@Override
    public void sawOpcode(int seen) {
        if (seen == Const.INVOKEVIRTUAL) {
            String className = getClassConstantOperand();
            String methodName = getNameConstantOperand();
            String methodSig = getSigConstantOperand();

            FQMethod methodInfo = new FQMethod(className, methodName, methodSig);
            if (oldMethods.contains(methodInfo)) {
                bugReporter.reportBug(new BugInstance(this, BugType.NCMU_NON_COLLECTION_METHOD_USE.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                        .addSourceLine(this));
            }
        }
    }
1019812
@SubscribeEvent
	public void onChunkWatched(ChunkWatchEvent.Watch event)
	{
		Chunk chunk = event.getPlayer().world.getChunkFromChunkCoords(event.getChunk().x, event.getChunk().z);
		for (HandlerInfo<?> handlerInfo : handlerInfos.values())
		{
			ChunkData<?> chunkData = instance.chunkData(handlerInfo.identifier, chunk.getWorld(), chunk);
			if (chunkData != null && chunkData.hasData())
				BlockDataMessage.sendBlockData(chunk, handlerInfo.identifier, chunkData.toBytes(Unpooled.buffer()), event.getPlayer());
		}
	}
598149
function checkExecParamsRegion(region)
{
	var caller = checkExecParamsRegion.caller.name

	if (typeof region != 'object') {
		console.error('Error: region parameter is not an object in: ' + caller);
		return false;
	}

	return true;
}