
org.tango.server.monitoring.DeviceMonitoring Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JTangoServer Show documentation
Show all versions of JTangoServer Show documentation
Library for Tango Server (ie. Tango Device) in Java
The newest version!
/**
* Copyright (C) : 2012
*
* Synchrotron Soleil
* L'Orme des merisiers
* Saint Aubin
* BP48
* 91192 GIF-SUR-YVETTE CEDEX
*
* This file is part of Tango.
*
* Tango is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tango is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Tango. If not, see .
*/
package org.tango.server.monitoring;
import org.tango.server.history.DeviceBlackBox;
import fr.esrf.Tango.ClntIdent;
import fr.esrf.Tango.DevFailed;
import fr.esrf.Tango.DevSource;
public class DeviceMonitoring {
private static final String SEPARATOR = " - ";
private final String deviceName;
private final DeviceBlackBox blackbox;
private final TangoStats monitoring;
public DeviceMonitoring(final String deviceName) {
this.deviceName = deviceName;
blackbox = new DeviceBlackBox();
monitoring = TangoStats.getInstance();
}
public long startRequest(final String request) {
blackbox.insertInblackBox(request);
return monitoring.addRequest(deviceName + SEPARATOR + request);
}
public long startRequest(final String request, final ClntIdent clt) {
blackbox.insertInblackBox(request, clt);
return monitoring.addRequest(deviceName + SEPARATOR + request);
}
public long startRequest(final String request, final DevSource devSource) {
blackbox.insertInblackBox(request, devSource);
return monitoring.addRequest(deviceName + SEPARATOR + request);
}
public long startRequest(final String request, final DevSource devSource, final ClntIdent clt) {
blackbox.insertInblackBox(request, devSource, clt);
return monitoring.addRequest(deviceName + SEPARATOR + request);
}
public void addError() {
monitoring.addError();
}
public void endRequest(final long id) {
monitoring.endRequest(id);
}
public String[] getBlackBox(final int size) throws DevFailed {
return blackbox.toArray(size);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy