Corporation Server User Manual

Counters Management
Programming Oracle Diameter Applications B-3
and application ID. Since the route is not available, the application is not able to
exchange messages with the remote realm peers.
Example B–2 illustrates a typical implementation of the
DiameterListener.processEvent() method.
Example B–2 Implementing the DiameterListener.processEvent() Method
public void processEvent(DiameterEvent event)
{
if (event instanceof DiameterRealmStateChangeEvent) {
// A remote realm has become available or unavailable
DiameterRealmStateChangeEvent event =
(DiameterRealmStateChangeEvent)event;
if (event.isRealmAvailable()) {
System.out.println(
"
Realm
"
+ event.getRealm() +
"
is available
"
);
} else {
System.out.println(
"
Realm
"
+ event.getRealm() +
"
is unavailable
"
);
}
// ...
}
Counters Management
Upon Diameter stack initialization, a set of defined counters is initialized and
associated to each DiameterStack and DiameterProvider instance created by the
application. These counters are defined in the DiameterStackImplMBean and
DiameterProviderImplMBean management interfaces.
There are two ways to access to these counters:
1. Directly, by calling one of the different methods defined in both management
interface.
2. Remotely, by registering the Diameter MBeans to a JMX agent using
javax.management package. Only the JDK 1.5 provides this package.
MBeans Management Interface
There are two management interfaces defined in the oracle.sdp.diameterimpl
package:
1. DiameterStackImplMBean: This interface represents the management API for
an instance of the DiameterStack interface.
2. DiameterProviderImplMBean: This interface represents the management API
for an instance of the DiameterProvider interface
Example B–3 illustrates how to directly get the value of one of these defined counters:
Example B–3 Getting the Value of a Counter
//--> Example Stack: getting the NbTransactions counter
MyStack->getNbTransactions();
//--> Example Provider: getting the NbSessionsCreated counter
MyProvider->getNbSessionsCreated();