Search in sources :

Example 1 with ServerDiagnosticsSummary

use of org.eclipse.milo.opcua.sdk.server.diagnostics.ServerDiagnosticsSummary in project milo by eclipse.

the class SessionManager method onActivateSession.

@Override
public void onActivateSession(ServiceRequest serviceRequest) {
    try {
        ActivateSessionResponse response = activateSession(serviceRequest);
        serviceRequest.setResponse(response);
    } catch (UaException e) {
        ServerDiagnosticsSummary serverDiagnosticsSummary = server.getDiagnosticsSummary();
        serverDiagnosticsSummary.getRejectedSessionCount().increment();
        if (e.getStatusCode().isSecurityError()) {
            serverDiagnosticsSummary.getSecurityRejectedSessionCount().increment();
        }
        serviceRequest.setServiceFault(e);
    }
}
Also used : UaException(org.eclipse.milo.opcua.stack.core.UaException) ServerDiagnosticsSummary(org.eclipse.milo.opcua.sdk.server.diagnostics.ServerDiagnosticsSummary) ActivateSessionResponse(org.eclipse.milo.opcua.stack.core.types.structured.ActivateSessionResponse)

Example 2 with ServerDiagnosticsSummary

use of org.eclipse.milo.opcua.sdk.server.diagnostics.ServerDiagnosticsSummary in project milo by eclipse.

the class SessionManager method onCreateSession.

// region Session Services
@Override
public void onCreateSession(ServiceRequest serviceRequest) {
    ServerDiagnosticsSummary serverDiagnosticsSummary = server.getDiagnosticsSummary();
    try {
        CreateSessionResponse response = createSession(serviceRequest);
        serverDiagnosticsSummary.getCumulatedSessionCount().increment();
        serviceRequest.setResponse(response);
    } catch (UaException e) {
        serverDiagnosticsSummary.getRejectedSessionCount().increment();
        if (e.getStatusCode().isSecurityError()) {
            serverDiagnosticsSummary.getSecurityRejectedSessionCount().increment();
        }
        serviceRequest.setServiceFault(e);
    }
}
Also used : CreateSessionResponse(org.eclipse.milo.opcua.stack.core.types.structured.CreateSessionResponse) UaException(org.eclipse.milo.opcua.stack.core.UaException) ServerDiagnosticsSummary(org.eclipse.milo.opcua.sdk.server.diagnostics.ServerDiagnosticsSummary)

Aggregations

ServerDiagnosticsSummary (org.eclipse.milo.opcua.sdk.server.diagnostics.ServerDiagnosticsSummary)2 UaException (org.eclipse.milo.opcua.stack.core.UaException)2 ActivateSessionResponse (org.eclipse.milo.opcua.stack.core.types.structured.ActivateSessionResponse)1 CreateSessionResponse (org.eclipse.milo.opcua.stack.core.types.structured.CreateSessionResponse)1