public MemberAttributes getAttributes() { return new MemberAttributes(directPort, processId, vmKind, vmViewId, name, groups, durableClientAttributes); }
public void setAttributes(MemberAttributes p_attr) { MemberAttributes attr = p_attr; if (attr == null) { attr = MemberAttributes.INVALID; } processId = attr.getVmPid(); vmKind = attr.getVmKind(); directPort = attr.getPort(); vmViewId = attr.getVmViewId(); name = attr.getName(); groups = attr.getGroups(); durableClientAttributes = attr.getDurableClientAttributes(); }
/** Parses comma-separated-roles/groups into array of groups (strings). */ public static String[] parseGroups(String csvRoles, String csvGroups) { List<String> groups = new ArrayList<String>(); parseCsv(groups, csvRoles); parseCsv(groups, csvGroups); return (String[]) groups.toArray(new String[groups.size()]); }
private MemberAttributes getDefaultAttributes() { // TODO can we get rid of this?? if (MemberAttributes.DEFAULT.getVmPid() == -1 || MemberAttributes.DEFAULT.getVmKind() == -1) { MemberAttributes.setDefaults( -1, OSProcess.getId(), -1, DistributionManager.getDistributionManagerType(), null, null, null); } return MemberAttributes.DEFAULT; }
/** * update the loner port with an integer that may be more unique than the * default port (zero). This updates the ID in place and establishes new * default settings for the manufacture of new IDs. * * @param newPort the new port to use */ public void updateLonerPort(int newPort) { this.logger.config(LocalizedStrings.LonerDistributionmanager_CHANGING_PORT_FROM_TO, new Object[]{this.lonerPort, newPort}); this.lonerPort = newPort; MemberAttributes.setDefaults(lonerPort, MemberAttributes.DEFAULT.getVmPid(), DistributionManager.LONER_DM_TYPE, -1, MemberAttributes.DEFAULT.getName(), MemberAttributes.DEFAULT.getGroups(), MemberAttributes.DEFAULT.getDurableClientAttributes()); this.getId().setPort(this.lonerPort); } public boolean isCurrentMember(InternalDistributedMember p_id) {
MemberAttributes.setDefaults(dcPort, MemberAttributes.DEFAULT.getVmPid(), MemberAttributes.DEFAULT.getVmKind(), MemberAttributes.DEFAULT.getVmViewId(), MemberAttributes.DEFAULT.getName(), MemberAttributes.DEFAULT.getGroups(), MemberAttributes.DEFAULT.getDurableClientAttributes()); this.vmKind = MemberAttributes.DEFAULT.getVmKind(); // we need this during jchannel startup MemberAttributes.setDefaults(dcPort, MemberAttributes.DEFAULT.getVmPid(), MemberAttributes.DEFAULT.getVmKind(), myAddr.getBirthViewId(), MemberAttributes.DEFAULT.getName(), MemberAttributes.DEFAULT.getGroups(), MemberAttributes.DEFAULT.getDurableClientAttributes());
/** * Returns an array of all the groups of this bridge server. * This includes those from the groups gemfire property * and those explicitly added to this server. */ public String[] getCombinedGroups() { ArrayList<String> groupList = new ArrayList<String>(); for (String g: MemberAttributes.parseGroups(null, getSystem().getConfig().getGroups())) { if (!groupList.contains(g)) { groupList.add(g); } } for (String g: getGroups()) { if (!groupList.contains(g)) { groupList.add(g); } } String[] groups = new String[groupList.size()]; return groupList.toArray(groups); }
.getDurableClientTimeout()); MemberAttributes.setDefaults(lonerPort, com.gemstone.gemfire.internal.OSProcess.getId(), DistributionManager.LONER_DM_TYPE, -1, name, MemberAttributes.parseGroups(config.getRoles(), config.getGroups()), dac); result = new InternalDistributedMember(host, lonerPort, name, uniqueString);
.getDurableClientTimeout()); MemberAttributes attr = new MemberAttributes( -1/*dcPort - not known at this time*/, OSProcess.getId(), -1/*view id - not known at this time*/, config.getName(), MemberAttributes.parseGroups(config.getRoles(), config.getGroups()), dca); localAddress = new InternalDistributedMember(jgAddress.getInetAddress(),
/** * For Externalizable * * @see java.io.Externalizable */ public void writeExternal(ObjectOutput out) throws IOException { if (ipAddr == null) throw new InternalGemFireError(LocalizedStrings.JGroupMember_ATTEMPT_TO_EXTERNALIZE_NULL_IP_ADDRESS.toLocalizedString()); // ipAddr.writeExternal(out); // do it the way we like byte[] address = ipAddr.getIpAddress().getAddress(); out.writeInt(address.length); // IPv6 compatible out.write(address); out.writeInt(ipAddr.getPort()); out.write(ipAddr.getFlags()); Version.writeOrdinal(out, ipAddr.getVersionOrdinal(), true); byte bytes[] = new MemberAttributes(ipAddr.getDirectPort(), ipAddr.getProcessId(), ipAddr.getVmKind(), ipAddr.getBirthViewId(), ipAddr.getName(), ipAddr.getRoles(), (DurableClientAttributes)ipAddr.getDurableClientAttributes()).toByteArray(); if (bytes == null) out.writeInt(0); else { out.writeInt(bytes.length); out.write(bytes); } }
/** * Returns an array of all the groups of this bridge server. * This includes those from the groups gemfire property * and those explicitly added to this server. */ public String[] getCombinedGroups() { ArrayList<String> groupList = new ArrayList<String>(); for (String g: MemberAttributes.parseGroups(null, getSystem().getConfig().getGroups())) { if (!groupList.contains(g)) { groupList.add(g); } } for (String g: getGroups()) { if (!groupList.contains(g)) { groupList.add(g); } } String[] groups = new String[groupList.size()]; return groupList.toArray(groups); }
.getDurableClientTimeout()); MemberAttributes.setDefaults(-1, OSProcess.getId(), getDistributionManagerType(), -1, config.getName(), MemberAttributes.parseGroups(config.getRoles(), config.getGroups()), dac);
/** * Construct a InternalDistributedMember. All fields are specified.<p> * * This, and the following constructor are the only valid ways to create an ID * for a distributed member for use * in the P2P cache. Use of other constructors can break network-partition-detection. * * @param i * @param p * the membership port * @param splitBrainEnabled whether this feature is enabled for the member * @param canBeCoordinator whether the member is eligible to be the membership coordinator * @param attr * the member's attributes */ public InternalDistributedMember(InetAddress i, int p, boolean splitBrainEnabled, boolean canBeCoordinator, MemberAttributes attr) { this.dcPort = attr.getPort(); this.vmPid = attr.getVmPid(); this.vmKind = attr.getVmKind(); this.vmViewId = attr.getVmViewId(); this.name = attr.getName(); this.groups = attr.getGroups(); this.durableClientAttributes = attr.getDurableClientAttributes(); this.ipAddr = (JGroupMember)MemberFactory.newNetMember(i, p, splitBrainEnabled, canBeCoordinator, attr); this.hostName = SocketCreator.resolve_dns? SocketCreator.getHostName(i) : i.getHostAddress(); // checkHostName(); }
public static void setDefaults(int dcPort, int vmPid, int vmKind, int vmViewId, String name, String[] groups, DurableClientAttributes durableClientAttributes) { DEFAULT = new MemberAttributes(dcPort, vmPid, vmKind, vmViewId, name, groups, durableClientAttributes); }
public Set<String> getLocalServerGroups() { Set<String> localServerGroups = new HashSet(); GemFireCacheImpl c = getCache(); List servers = null; servers = c.getCacheServers(); Collections.addAll(localServerGroups, MemberAttributes.parseGroups(null, c.getSystem().getConfig().getGroups())); for (Object object : servers) { CacheServerImpl server = (CacheServerImpl)object; if (server.isRunning() && (server.getExternalAddress() != null)) { Collections.addAll(localServerGroups, server.getGroups()); } } return localServerGroups; } /**
/** Parses comma-separated-roles/groups into array of groups (strings). */ public static String[] parseGroups(String csvRoles, String csvGroups) { List<String> groups = new ArrayList<String>(); parseCsv(groups, csvRoles); parseCsv(groups, csvGroups); return (String[]) groups.toArray(new String[groups.size()]); } private static void parseCsv(List<String> groups, String csv) {
this.dcPort = attr.getPort(); this.vmPid = attr.getVmPid(); this.vmKind = attr.getVmKind(); this.vmViewId = attr.getVmViewId(); this.name = attr.getName(); this.groups = attr.getGroups(); this.durableClientAttributes = attr.getDurableClientAttributes(); this.netMbr = MemberFactory.newNetMember(i, p, splitBrainEnabled, canBeCoordinator, Version.CURRENT_ORDINAL, attr); this.hostName = SocketCreator.resolve_dns? SocketCreator.getHostName(i) : i.getHostAddress();
private void synchPayload() { netMbr.setAttributes(new MemberAttributes(dcPort, vmPid, vmKind, vmViewId, name, groups, durableClientAttributes)); }
public Set<String> getLocalServerGroups() { Set<String> localServerGroups = new HashSet(); GemFireCacheImpl c = getCache(); List servers = null; servers = c.getCacheServers(); Collections.addAll(localServerGroups, MemberAttributes.parseGroups(null, c.getSystem().getConfig().getGroups())); for (Object object : servers) { BridgeServerImpl server = (BridgeServerImpl)object; if (server.isRunning() && (server.getExternalAddress() != null)) { Collections.addAll(localServerGroups, server.getGroups()); } } return localServerGroups; } /**
public static void insertGemFireAttributes(IpAddress addr, Object obj) { MemberAttributes attr = (MemberAttributes)obj; addr.setProcessId(attr.getVmPid()); addr.setVmKind(attr.getVmKind()); addr.setDirectPort(attr.getPort()); addr.setBirthViewId(attr.getVmViewId()); addr.setName(attr.getName()); addr.setRoles(attr.getGroups()); addr.setDurableClientAttributes(attr.getDurableClientAttributes()); addr.setSize(-1); addr.setSize(addr.size(Version.CURRENT_ORDINAL)); }