Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
peersimgrid release 1.0
[simgrid.git] / contrib / psg / src / peersim / core / Cleanable.java
1 /*
2  * Copyright (c) 2003-2005 The BISON Project
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16  *
17  */
18
19 package peersim.core;
20
21 /**
22  * This interface must be implemented by protocols that need to release
23  * some references when the fail state of their host node is set to
24  * {@link Fallible#DEAD}. Recall that this fail state means that the node
25  * will never get back online. However, other nodes and protocols might
26  * still have references to these dead nodes and protocols, and this fact
27  * is not always a bug. So implementing this interface allows for removing
28  * stuff that we know is no longer necessary. Especially for linkable
29  * protocols in the presence of churn, this is essential: they typically
30  * have to release their links to other nodes to prevent the formation of
31  * trees of removed nodes with a live reference to the root.
32  */
33 public interface Cleanable
34 {
35
36 /**
37  * Performs cleanup when removed from the network. This is called by the
38  * host node when its fail state is set to {@link Fallible#DEAD}.
39  * It is very important that after calling this method, NONE of the methods
40  * of the implementing object are guaranteed to work any longer.
41  * They might throw arbitrary exceptions, etc. The idea is that after
42  * calling this, typically no one should access this object.
43  * However, as a recommendation, at least toString should be guaranteed to
44  * execute normally, to aid debugging.
45  */
46 public void onKill();
47
48 }