KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > dyade > aaa > agent > JGroupsAckMsg


1 /*
2  * Copyright (C) 2004 - France Telecom R&D
3  * Copyright (C) 2004 - ScalAgent Distributed Technologies
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): ScalAgent Distributed Technologies
21  * Contributor(s):
22  */

23 package fr.dyade.aaa.agent;
24
25 import java.io.IOException JavaDoc;
26
27 /**
28  * Message used by the master component to braodcast the ack of a sending
29  * message (so each slave can remove the message from sending queue).
30  */

31 public class JGroupsAckMsg implements java.io.Serializable JavaDoc {
32   String JavaDoc name = null;
33   int stamp;
34   boolean isPersistent;
35
36   public JGroupsAckMsg(Message message) {
37     this.name = message.toStringId();
38     this.stamp = message.getStamp();
39     this.isPersistent = message.isPersistent();
40   }
41
42   /**
43    * Deletes the current object in persistent storage.
44    */

45   void delete() throws IOException JavaDoc {
46     if (isPersistent) {
47       AgentServer.getTransaction().delete(name);
48     }
49   }
50
51   int getStamp() {
52     return stamp;
53   }
54
55   public String JavaDoc toString() {
56     StringBuffer JavaDoc strBuf = new StringBuffer JavaDoc();
57
58     strBuf.append("(").append(super.toString());
59     strBuf.append(",name=").append(name);
60     strBuf.append(",stamp=").append(stamp);
61     strBuf.append(")");
62
63     return strBuf.toString();
64   }
65 }
66
Popular Tags