Subscribe to SingleLayer2DExperiment events.

    @param monitor (SingleLayer2DExperimentMonitor)
    An object that implements a set of monitor methods

    @return (object)
    An opaque object that can be used to refer to this monitor.
549115
def addMonitor(self, monitor):
    

    token = self.nextMonitorToken
    self.nextMonitorToken += 1

    self.monitors[token] = monitor

    return token
1037500
function() {

        // Don't continue if the probe portion was what changed.
        var thisMonitor = JSON.stringify(monitor.toMonitorJSON());
        if (thisMonitor === t.priorMonitor) {
          return;
        }

        // Remove the component listeners
        log.info('render.monitorChange', t.logCtxt);
        component.off('change:css change:viewOptions', applyStyles);
        component.off('change:monitor', onMonitorChange, t);

        // Disconnect, then build a fresh component
        t.connectMonitor(false, function(){
          UI.pageView.removeComponent(t.model);
          UI.pageView.addComponent(t.model);
        });
      }
1337411
public void unregisterExceptionMonitor( ExceptionMonitor monitor )
    {
        synchronized( this )
        {
            if( monitor == null || !monitor.equals( m_exceptionMonitor ) )
            {
                return;
            }
            m_exceptionMonitor = null;
        }
    }
1238197
public static <T> FlowableTransformer<T,T> doOnSubscribeFx(Consumer<Subscription> subscribe) {
        return obs -> obs.doOnSubscribe((d -> runOnFx(d,subscribe)));
    }
308547
def getMonitorByName(self, monitorFriendlyName):
        
        url = self.baseUrl
        url += "getMonitors?apiKey=%s" % self.apiKey
        url += "&noJsonCallback=1&format=json"
        success, response = self.requestApi(url)
        if success:
            monitors = response.get('monitors').get('monitor')
            for i in range(len(monitors)):
                monitor = monitors[i]
                if monitor.get('friendlyname') == monitorFriendlyName:
                    status = monitor.get('status')
                    alltimeuptimeratio = monitor.get('alltimeuptimeratio')
                    return status, alltimeuptimeratio
        return None, None
111655
Timer getTimer(final String name) {
    return (Timer) timers.get(name, new Monitors.Factory<Timer>() {
        @Override
        public Timer createMonitor() {
          return new Timer(name);
        }
      });
  }
1109466
static public String createMonitor(XPathContext context, String monitorUrl,
            String localName, String namespaceURI, NodeInfo params,
            NodeInfo parserInstruction, String modifiesResponse, String callId,
            TECore core) throws Exception {
        MonitorCall mc = monitors.get(monitorUrl);
        mc.setContext(context);
        mc.setLocalName(localName);
        mc.setNamespaceURI(namespaceURI);
        mc.setCore(core);
        if (params != null) {
            Node node = (Node) NodeOverNodeInfo.wrap(params);
            if (node.getNodeType() == Node.DOCUMENT_NODE) {
                mc.setParams(((Document) node).getDocumentElement());
            } else {
                mc.setParams((Element) node);
            }
        }
        if (parserInstruction != null) {
            Node node = (Node) NodeOverNodeInfo.wrap(parserInstruction);
            if (node.getNodeType() == Node.DOCUMENT_NODE) {
                mc.setParserInstruction(((Document) node).getDocumentElement());
            } else {
                mc.setParserInstruction((Element) node);
            }
            mc.setModifiesResponse(Boolean.parseBoolean(modifiesResponse));
        }
        mc.setCallId(callId);
        LOGR.log(Level.CONFIG, "Configured monitor with test:\n {0}", mc);
        return "";
    }
41701
def addMonitor(self, monitorFriendlyName, monitorURL):
        
        url = self.baseUrl
        url += "newMonitor?apiKey=%s" % self.apiKey
        url += "&monitorFriendlyName=%s" % monitorFriendlyName
        url += "&monitorURL=%s&monitorType=1" % monitorURL
        url += "&monitorAlertContacts=%s" % monitorAlertContacts
        url += "&noJsonCallback=1&format=json"
        success, response = self.requestApi(url)
        if success:
            return True
        else:
            return False
360814
public static <T> Consumer<T> monitor(Consumer<T> consumer, AtomicLong calls) {
        return new MonitoringConsumer<T>(consumer, calls);
    }
1359256
def with_condition(self, condition: Callable[[MonitorContext], bool]) -> 'MonitorTask':
        
        self._condition = condition
        return self
1078868
public int createSARLType(IProgressMonitor monitor) throws CoreException, InterruptedException {
		try {
			final SubMonitor mainmon = SubMonitor.convert(monitor, getTitle(), STEPS);
			// Create the package if not existing
			IPackageFragment packageFragment = getPackageFragment();
			if (!packageFragment.exists()) {
				packageFragment = getPackageFragmentRoot().createPackageFragment(
						getPackageFragment().getElementName(),
						true,
						mainmon.newChild(1));
			} else {
				mainmon.worked(1);
			}

			// Create the file
			final IFolder packageResource = (IFolder) packageFragment.getResource();
			if (!packageResource.exists()) {
				CoreUtility.createFolder(packageResource, true, true, mainmon.newChild(1));
			} else {
				mainmon.worked(1);
			}
			IFile sarlFile = packageResource.getFile(
					getTypeName() + "." //$NON-NLS-1$
					+ this.sarlFileExtension);
			int index = 1;
			while (sarlFile.exists()) {
				sarlFile = packageResource.getFile(
						getTypeName() + index + "." //$NON-NLS-1$
						+ this.sarlFileExtension);
				++index;
			}

			final URI sarlUri = this.storage2UriMapper.getUri(sarlFile);
			final ResourceSet resourceSet = this.resourceSetFactory.get(packageFragment.getJavaProject().getProject());
			final ICompilationUnit compilationUnit = getCompilationUnitStub();
			final String lineSeparator = this.whitespaceInformationProvider
					.getLineSeparatorInformation(sarlUri).getLineSeparator();
			mainmon.worked(1);

			// Create the type content
			final SubMonitor mon1 = mainmon.newChild(1);
			mon1.setTaskName(MessageFormat.format(Messages.AbstractNewSarlElementWizardPage_5, getTypeName()));
			final String typeComment = getTypeComment(compilationUnit, lineSeparator);
			final IJvmTypeProvider typeProvider = this.jdtTypeProviderFactory.findOrCreateTypeProvider(resourceSet);
			final ImportManager imports = new ImportManager(true);
			this.injector.injectMembers(imports);
			final FakeTreeAppendable appender = new FakeTreeAppendable(imports);
			this.injector.injectMembers(appender);
			generateTypeContent(appender, typeProvider, typeComment, mon1);
			mon1.done();

			// Build the full file content
			final SubMonitor mon2 = mainmon.newChild(1);
			mon2.setTaskName(MessageFormat.format(Messages.AbstractNewSarlElementWizardPage_6, getTypeName()));
			final String fileComment = getFileComment(compilationUnit, lineSeparator);
			final StringBuilder realContent = new StringBuilder();
			if (!Strings.isNullOrEmpty(fileComment)) {
				realContent.append(fileComment);
				realContent.append(lineSeparator);
				realContent.append(lineSeparator);
			}
			realContent.append(appender.getContent());
			realContent.append(lineSeparator);
			mon2.done();

			final SubMonitor mon3 = mainmon.newChild(1);
			mon3.setTaskName(MessageFormat.format(Messages.AbstractNewSarlElementWizardPage_7, getTypeName()));
			final String content = this.formatterFacade.format(realContent.toString());
			mon3.done();

			// Write the resource
			final SubMonitor mon4 = mainmon.newChild(1);
			mon4.setTaskName(MessageFormat.format(Messages.AbstractNewSarlElementWizardPage_8, getTypeName()));
			try (ByteArrayInputStream stream = new ByteArrayInputStream(content.getBytes())) {
				sarlFile.create(stream, true, mon4);
			}
			setResource(sarlFile);
			saveSettings();
			mon4.done();

			return content.length();
		} catch (OperationCanceledException e) {
			throw new InterruptedException();
		} catch (CoreException e) {
			throw e;
		} catch (Exception e) {
			throw new CoreException(SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, e));
		}
	}
220040
static <T> SingleObserver<T> wrap(SingleObserver<T> downstream,
                                      List<RunnableInstrumenter> instrumentations) {
        return new RxInstrumentedSingleObserver<>(downstream, instrumentations);
    }
1276138
private void createMonitor(LinkListener l) throws KNXException
	{
		final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium");
		if (options.containsKey("serial")) {
			final String p = (String) options.get("serial");
			try {
				m = new KNXNetworkMonitorFT12(Integer.parseInt(p), medium);
			}
			catch (final NumberFormatException e) {
				m = new KNXNetworkMonitorFT12(p, medium);
			}
		}
		else {
			// create local and remote socket address for monitor link
			final InetSocketAddress local = createLocalSocket((InetAddress) options
				.get("localhost"), (Integer) options.get("localport"));
			final InetSocketAddress host = new InetSocketAddress((InetAddress) options
				.get("host"), ((Integer) options.get("port")).intValue());
			// create the monitor link, based on the KNXnet/IP protocol
			// specify whether network address translation shall be used,
			// and tell the physical medium of the KNX network
			m = new KNXNetworkMonitorIP(local, host, options.containsKey("nat"), medium);
		}
		// add the log writer for monitor log events
		LogManager.getManager().addWriter(m.getName(), w);
		// on console we want to have all possible information, so enable
		// decoding of a received raw frame by the monitor link
		m.setDecodeRawFrames(true);
		// listen to monitor link events
		m.addMonitorListener(l);
		// we always need a link closed notification (even with user supplied listener)
		m.addMonitorListener(new LinkListener() {
			public void indication(FrameEvent e)
			{}

			public void linkClosed(CloseEvent e)
			{
				System.out.println("network monitor exit, " + e.getReason());
				synchronized (NetworkMonitor.this) {
					NetworkMonitor.this.notify();
				}
			}
		});
	}
1033847
public Optional<Monitor> show(String monitorId)
    {
        return HTTP.GET(String.format("/v3/monitors/%s", monitorId), MONITOR);
    }
322
@Override
    public void transform(Context<MutableTimeSeriesCollectionPair> ctx) {
        DateTime now = ctx.getTSData().getCurrentCollection().getTimestamp();

        ctx.getTSData().getCurrentCollection().addMetrics(MONITOR_GROUP, get_metrics_(now, ctx));

        ctx.getAlertManager().accept(new Alert(now, MONITOR_DOWN_ALERT, () -> "builtin rule", Optional.of(false), Duration.ZERO, "builtin rule: monitor is not running for some time", EMPTY_MAP));
    }
581871
public static <T> ObservableTransformer<T,T> doOnSubscribeFx(Consumer<Disposable> subscribe) {
        return obs -> obs.doOnSubscribe((d -> runOnFx(d,subscribe)));
    }
815553
public void addMonitor(ThreadedMonitor... monitors) {
        for (ThreadedMonitor monitor : monitors) {
            if (!this.monitors.contains(monitor)) {
                this.monitors.add(monitor);
            }
        }
    }