1 5 package org.exoplatform.services.communication.sms.impl; 6 7 import org.exoplatform.services.communication.sms.SmsMonitorService; 8 9 10 14 public class SmsMonitorServiceImpl implements SmsMonitorService { 15 16 static private Integer _countMessages; 17 static private Integer _successfullMessages; 18 static private Integer _failedMessages; 19 20 public SmsMonitorServiceImpl() { 21 _countMessages = new Integer (0); 22 _successfullMessages = new Integer (0); 23 _failedMessages = new Integer (0); 24 } 25 26 public Integer getCountMessages() { 27 return _countMessages; 28 } 29 30 public void incCountMessages() { 31 synchronized(_countMessages) { 32 int counter = _countMessages.intValue(); 33 counter++; 34 _countMessages = new Integer (counter); 35 } 36 } 37 38 public Integer getFailedMessages() { 39 return _failedMessages; 40 } 41 42 public void incFailedMessages() { 43 synchronized(_failedMessages) { 44 int counter = _failedMessages.intValue(); 45 counter++; 46 _failedMessages = new Integer (counter); 47 } 48 } 49 50 public Integer getSuccessfullMessages() { 51 return _successfullMessages; 52 } 53 54 public void incSuccessfulMessages() { 55 synchronized(_successfullMessages) { 56 int counter = _successfullMessages.intValue(); 57 counter++; 58 _successfullMessages = new Integer (counter); 59 } 60 } 61 62 public Integer getErroneousMessage() { 63 synchronized(_countMessages) { 64 int counter = _countMessages.intValue(); 65 int success = _successfullMessages.intValue(); 66 int failed = _failedMessages.intValue(); 67 return new Integer (counter-success-failed); 68 } 69 } 70 71 } 72 | Popular Tags |