-
7.8.2 Enhancement module (Cont)
For a long time, the most challenging issue of node.js is that it lacks of the ability of the persistence and management. The Java could easily solve these issues, so it expands two modules sql and edb, which seperately provides the access ability of the relational database and key-value database, and expands a simple JMX query module monitor.
-
Monitor
-
mointor.Host class
'close' event
host.query(objectName, callback)
host.destroy()
host.ref()
host.unref()
monitor.connect (host, serverPort, rmiPort[, username, password])
For example, launch switcher server (configure the machine jmx service, refer service-switcher.xml)
service-switcher.xml
var host = require('monitor').connect('localhost', 10003, 10002); setInterval(function(){ host.query('java.lang:type=Threading', console.log); }, 10000);
Run this program, and can query the thread status in 10 seconds interval.
monitor.Host class
Describe a JMX connection.
'close' event
Execute destroy, close Host object. However there might be operation in progress when closing, so this event is triggered after all operations finish, which indicates that the Host is completely closed.
host.query(objectName, callback)
objectName<String> the jmx object name required to query
callback <Function>
Use callback(err, obj) to callback after query finishes.
host.destroy()
Close Host object connection, the operation executed after destroy. The callback with exception message is directly closed by instance.
host.ref()
Opposite of unref, calling ref on a previously unrefd host will not let the program exit if it's the only host left (the default behavior). If the host is refd calling ref again will have no effect.
Returns server.
host.unref()
Calling unref on a host will allow the program to exit if this is the only active host in the event system. If the host is already unrefd calling unref again will have no effect.
Returns server.
monitor.connect (host, serverPort, rmiPort[, username, password])
host<String>
serverPort<Number> Integer
rmiPort<Number> Integer
username<String>
password<String>
Provide connection parameter, and create Host object.
-
-