KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > communication > sms > impl > SmsMonitorServiceImpl


1 /**
2  * Copyright 2001-2004 The eXo platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  **/

5 package org.exoplatform.services.communication.sms.impl;
6
7 import org.exoplatform.services.communication.sms.SmsMonitorService;
8
9
10 /**
11  * @author Ove Ranheim (oranheim@yahoo.no)
12  * @since Jun 20, 2004 5:54:56 PM
13  */

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