Skip to content

Commit

Permalink
Add MemberProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
kuujo committed Mar 23, 2016
1 parent 2a7da30 commit 880a3a2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
6 changes: 3 additions & 3 deletions group/src/main/java/io/atomix/group/GroupMember.java
Expand Up @@ -33,7 +33,7 @@ public class GroupMember {
protected final String memberId; protected final String memberId;
protected final Address address; protected final Address address;
protected final MembershipGroup group; protected final MembershipGroup group;
private final GroupProperties properties; private final MemberProperties properties;
final TaskQueueController tasks; final TaskQueueController tasks;
private final Connection connection; private final Connection connection;


Expand All @@ -46,7 +46,7 @@ public class GroupMember {
this.memberId = info.memberId(); this.memberId = info.memberId();
this.address = info.address(); this.address = info.address();
this.group = Assert.notNull(group, "group"); this.group = Assert.notNull(group, "group");
this.properties = new GroupProperties(memberId, group); this.properties = new MemberProperties(memberId, group);
this.connection = new Connection(memberId, address, group.connections); this.connection = new Connection(memberId, address, group.connections);
if (tasks != null) { if (tasks != null) {
this.tasks = tasks; this.tasks = tasks;
Expand Down Expand Up @@ -101,7 +101,7 @@ GroupMember setIndex(long index) {
* *
* @return The member properties. * @return The member properties.
*/ */
public GroupProperties properties() { public MemberProperties properties() {
return properties; return properties;
} }


Expand Down
6 changes: 5 additions & 1 deletion group/src/main/java/io/atomix/group/GroupProperties.java
Expand Up @@ -29,7 +29,11 @@ public class GroupProperties {
private final String memberId; private final String memberId;
private final MembershipGroup group; private final MembershipGroup group;


protected GroupProperties(String memberId, MembershipGroup group) { GroupProperties(MembershipGroup group) {
this(null, group);
}

GroupProperties(String memberId, MembershipGroup group) {
this.memberId = memberId; this.memberId = memberId;
this.group = Assert.notNull(group, "group"); this.group = Assert.notNull(group, "group");
} }
Expand Down
29 changes: 29 additions & 0 deletions group/src/main/java/io/atomix/group/MemberProperties.java
@@ -0,0 +1,29 @@
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package io.atomix.group;

/**
* Group member properties.
*
* @author <a href="http://github.com/kuujo>Jordan Halterman</a>
*/
public class MemberProperties extends GroupProperties {

public MemberProperties(String memberId, MembershipGroup group) {
super(memberId, group);
}

}
2 changes: 1 addition & 1 deletion group/src/main/java/io/atomix/group/MembershipGroup.java
Expand Up @@ -80,7 +80,7 @@ public class MembershipGroup extends AbstractResource<DistributedGroup> implemen
private final Address address; private final Address address;
private final Server server; private final Server server;
final ConnectionManager connections; final ConnectionManager connections;
private final GroupProperties properties = new GroupProperties(null, this); private final GroupProperties properties = new GroupProperties(this);
private final ElectionController election = new ElectionController(this); private final ElectionController election = new ElectionController(this);
private final TaskQueue tasks = new GroupTaskQueue(this); private final TaskQueue tasks = new GroupTaskQueue(this);
final Map<String, GroupMember> members = new ConcurrentHashMap<>(); final Map<String, GroupMember> members = new ConcurrentHashMap<>();
Expand Down

0 comments on commit 880a3a2

Please sign in to comment.