Class MonitorServer
- All Implemented Interfaces:
ClientInterface, HandlerInterface, RemoteServer, MBeanListener, MBeanService, ToBeStarted, MonitorInterface, Serializable, Remote
Entry point for the ECpds Monitor daemon. Replaces the legacy ecmwf.common.ecaccess.HandlerServer as the
RMI-exported server object on monitor hosts.
By implementing MonitorInterface (which is part of open-ecpds rather than the pre-compiled
ecaccess-stubs.jar), Java RMI uses a dynamic proxy when the master connects to this server. A dynamic proxy
forwards all non-default abstract methods — including getHttpCertificateJson() and
deployHttpCertificate(byte[], String) — to this remote object over the network. This resolves the Java 9+ RMI issue where
default interface methods on HandlerInterface were invoked locally on the master JVM instead of being
forwarded to the remote monitor.
Start monitors with:
JAVA_OPTS = "$JAVA_OPTS -Decmwf.common.starter.name=ecmwf.ecpds.monitor.MonitorServer"
The service name ("ECpdsMonitor") is unchanged, so existing master configuration and the
getMonitorInterface() lookup are backward-compatible at the service-registration level.
- See Also:
-
Field Summary
Fields inherited from class RemoteObject
ref -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeployHttpCertificate(byte[] pkcs12Bytes, String keystorePassword) Deploys a new PKCS#12 keystore to this monitor's HTTPS server and reloads the certificate.Returns a JSON-encoded snapshot of the TLS certificate currently loaded by this monitor's HTTPS server.Gets the password.getRoot()Gets the root.Gets the service.Gets the version.voidHot-reloads the TLS certificate from the keystore file currently on disk on the remote Monitor.Methods inherited from class StarterServer
exit, getAttribute, getGraceful, getInstance, getInstance, getMBeanCenter, getMBeanInfo, getPluginContainer, getPluginInfos, getRemoteCnf, getRestart, getStartDate, handle, handle, handleNotification, invoke, setAttribute, shutdown, shutdownMethods inherited from class CallBackObject
createOrGetRegistry, getPort, unexportMethods inherited from class UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObjectMethods inherited from class RemoteServer
getClientHost, getLog, setLogMethods inherited from interface HandlerInterface
handle, handle
-
Constructor Details
-
MonitorServer
public MonitorServer(Starter starter) throws IOException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, MalformedObjectNameException, InstanceNotFoundException Instantiates a new MonitorServer.- Parameters:
starter- the starter- Throws:
IOException- Signals that an I/O exception has occurred.InstanceAlreadyExistsException- the instance already exists exceptionMBeanRegistrationException- the MBean registration exceptionNotCompliantMBeanException- the not compliant m bean exceptionMalformedObjectNameException- the malformed object name exceptionInstanceNotFoundException- the instance not found exception
-
-
Method Details
-
getRoot
Gets the root. Gets the root.- Specified by:
getRootin interfaceClientInterface- Returns:
- the root
-
getPassword
Gets the password. Gets the password.- Specified by:
getPasswordin interfaceClientInterface- Returns:
- the password
-
getVersion
Gets the version. Gets the version.- Specified by:
getVersionin classStarterServer- Returns:
- the version
-
getService
Gets the service. Returns the service name used to register this monitor with the master. The service name"ECpdsMonitor"is unchanged from the legacyHandlerServerso that the master'sgetMonitorInterface()lookup continues to work without configuration changes.- Specified by:
getServicein interfaceClientInterface- Returns:
- the service
-
getHttpCertificateJson
Returns a JSON-encoded snapshot of the TLS certificate currently loaded by this monitor's HTTPS server.This method re-declares the
defaultmethod fromHandlerInterfaceasabstractso that Java RMI's dynamic proxy forwards the call to the remoteMonitorServerrather than executing it locally. Returns a JSON-encoded snapshot of the TLS certificate currently loaded by this monitor's HTTPS server. Delegates to thehttpplugin via reflection to avoid classloader-isolation issues.- Specified by:
getHttpCertificateJsonin interfaceHandlerInterface- Specified by:
getHttpCertificateJsonin interfaceMonitorInterface- Returns:
- JSON string; never
null - Throws:
RemoteException- the remote exception
-
reloadHttpCertificate
Hot-reloads the TLS certificate from the keystore file currently on disk on the remote Monitor. Re-declares thedefaultno-op fromHandlerInterfaceasabstractso that Java RMI's dynamic proxy forwards the call to the remoteMonitorServer. Hot-reloads the TLS certificate from the keystore file currently on disk on this Monitor. Delegates to thehttpplugin via reflection to avoid classloader-isolation issues.- Specified by:
reloadHttpCertificatein interfaceHandlerInterface- Specified by:
reloadHttpCertificatein interfaceMonitorInterface- Throws:
RemoteException- the remote exception
-
deployHttpCertificate
public void deployHttpCertificate(byte[] pkcs12Bytes, String keystorePassword) throws RemoteException Deploys a new PKCS#12 keystore to this monitor's HTTPS server and reloads the certificate.This method re-declares the
defaultno-op fromHandlerInterfaceasabstractso that Java RMI's dynamic proxy forwards the call to the remoteMonitorServer. Deploys a new PKCS#12 keystore to this monitor's HTTPS server. Delegates to thehttpplugin via reflection to avoid classloader-isolation issues.- Specified by:
deployHttpCertificatein interfaceHandlerInterface- Specified by:
deployHttpCertificatein interfaceMonitorInterface- Parameters:
pkcs12Bytes- the PKCS#12 keystore byteskeystorePassword- password for the keystore and private key- Throws:
RemoteException- the remote exception
-