|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Membership.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/**
|
|
| 2 |
*
|
|
| 3 |
* Copyright 2004 Protique Ltd
|
|
| 4 |
*
|
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
| 7 |
* You may obtain a copy of the License at
|
|
| 8 |
*
|
|
| 9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
| 10 |
*
|
|
| 11 |
* Unless required by applicable law or agreed to in writing, software
|
|
| 12 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
| 13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
| 14 |
* See the License for the specific language governing permissions and
|
|
| 15 |
* limitations under the License.
|
|
| 16 |
*
|
|
| 17 |
**/
|
|
| 18 |
package org.activecluster.group;
|
|
| 19 |
|
|
| 20 |
/**
|
|
| 21 |
* Represents the membership of a Group for a Node
|
|
| 22 |
*
|
|
| 23 |
* @version $Revision: 1.1 $
|
|
| 24 |
*/
|
|
| 25 |
public class Membership { |
|
| 26 |
public static final int STATUS_REQUESTED = 1; |
|
| 27 |
public static final int STATUS_SYNCHONIZING = 2; |
|
| 28 |
public static final int STATUS_FAILED = 3; |
|
| 29 |
public static final int STATUS_OK = 4; |
|
| 30 |
|
|
| 31 |
private Group group;
|
|
| 32 |
private int index; |
|
| 33 |
private int status = STATUS_REQUESTED; |
|
| 34 |
|
|
| 35 | 0 |
public Membership(Group group, int index) { |
| 36 | 0 |
this.group = group;
|
| 37 | 0 |
this.index = index;
|
| 38 |
} |
|
| 39 |
|
|
| 40 | 0 |
public int getIndex() { |
| 41 | 0 |
return index;
|
| 42 |
} |
|
| 43 |
|
|
| 44 | 0 |
public void setIndex(int index) { |
| 45 | 0 |
this.index = index;
|
| 46 |
} |
|
| 47 |
|
|
| 48 | 0 |
public int getStatus() { |
| 49 | 0 |
return status;
|
| 50 |
} |
|
| 51 |
|
|
| 52 | 0 |
public void setStatus(int status) { |
| 53 | 0 |
this.status = status;
|
| 54 |
} |
|
| 55 |
|
|
| 56 |
/**
|
|
| 57 |
* @return the weighting of this membership
|
|
| 58 |
*/
|
|
| 59 | 0 |
public int getWeighting() { |
| 60 |
// lets make master heavy and the further from the end of the
|
|
| 61 |
// list of slaves, the lighter we become
|
|
| 62 | 0 |
return group.getMaximumMemberCount() - getIndex();
|
| 63 |
} |
|
| 64 |
} |
|
| 65 |
|
|
||||||||||