private void initializeSAM() {
//#J2ME_EXCLUDE_BEGIN
try {
Service sam = myContainer.getServiceFinder().findService(SAMHelper.SERVICE_NAME);
if (sam != null) {
SAMHelper samHelper = (SAMHelper) sam.getHelper(null);
samActive = true;
// DELIVERY TIME
deliveryTimeMeasurementRate = DELIVERY_TIME_MEASUREMENT_RATE_DEFAULT;
try {
deliveryTimeMeasurementRate = Integer.parseInt(myProfile.getParameter(DELIVERY_TIME_MEASUREMENT_RATE, null));
}
catch (Exception e) {
// Keep default
}
if (deliveryTimeMeasurementRate > 0) {
deliveryTimeMeasureProvider = new AverageMeasureProviderImpl();
samHelper.addEntityMeasureProvider("Message-Delivery-Time", deliveryTimeMeasureProvider);
}
// MESSAGE COUNT
boolean enablePostedMessageCount = "true".equalsIgnoreCase(myProfile.getParameter(ENABLE_POSTED_MESSAGE_COUNT, "false"));
if (enablePostedMessageCount) {
samHelper.addCounterValueProvider("Posted-Message-Count", new CounterValueProvider() {
public long getValue() {
return postedMessageCounter;
}
public boolean isDifferential() {
return false;