/** * {@inheritDoc} */ @Override public boolean execute(Object o) { final HostAddress hostAddr = (HostAddress)o; if (this.keepLocators) { if (hostAddr.getServerType().isThriftLocator()) { this.outServers.add(hostAddr); } } if (this.keepServers) { if (hostAddr.getServerType().isThriftSnappy()) { this.outServers.add(hostAddr); } } return true; } }
if (serverType.isThriftSnappy()) { locatorType = serverType.getCorrespondingLocatorType(); if (!serverTypes.contains(locatorType)) { allTypes.add(locatorType);
@SuppressWarnings("unchecked") @Override public Object process(Object arg, Set<DistributedMember> members, GfxdConfigMessage<?> msg) { try { final Collection<String> serverGroups; final Collection<String> intersectGroups; final String excludedServers; if (arg instanceof Object[]) { Object[] args = (Object[])arg; // new case of serverGroups+excludedServers serverGroups = (Collection<String>)args[0]; intersectGroups = (Collection<String>)args[1]; excludedServers = (String)args[2]; } else { // old case of CSV excludedServers serverGroups = Collections.singletonList(ServerType.DRDA .getServerGroupName()); intersectGroups = null; excludedServers = arg != null ? arg.toString() : null; } return GemFireXDUtils.getPreferredServer(serverGroups, intersectGroups, excludedServers, false); } catch (SQLException ex) { throw GemFireXDRuntimeException.newRuntimeException( "failed in GET_PREFERREDSERVER", ex); } } },
useSSL = false; socketParams.setServerType(ServerType.getServerType(isServer, useBinaryProtocol, useSSL));
private void refreshAllHosts(List<HostAddress> allHosts) { // refresh the locator list first (keep old but push current to front) final ArrayList<HostAddress> locators = this.locators; final ArrayList<HostAddress> newLocators = new ArrayList<>(locators.size()); for (HostAddress host : allHosts) { if (host.getServerType().isThriftLocator() || locators.contains(host)) { newLocators.add(host); } } for (HostAddress host : locators) { if (!newLocators.contains(host)) { newLocators.add(host); } } this.locators = newLocators; // refresh the new server list // we remove all from the set and re-populate since we would like // to prefer the ones coming as "allServers" with "isServer" flag // correctly set rather than the ones in "secondary-locators" this.controlHostSet.clear(); this.controlHostSet.addAll(newLocators); this.controlHostSet.addAll(allHosts); }
public void write(org.apache.thrift.protocol.TProtocol oprot, HostAddress struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.hostName != null) { oprot.writeFieldBegin(HOST_NAME_FIELD_DESC); oprot.writeString(struct.hostName); oprot.writeFieldEnd(); } oprot.writeFieldBegin(PORT_FIELD_DESC); oprot.writeI32(struct.port); oprot.writeFieldEnd(); if (struct.ipAddress != null) { if (struct.isSetIpAddress()) { oprot.writeFieldBegin(IP_ADDRESS_FIELD_DESC); oprot.writeString(struct.ipAddress); oprot.writeFieldEnd(); } } if (struct.serverType != null) { if (struct.isSetServerType()) { oprot.writeFieldBegin(SERVER_TYPE_FIELD_DESC); oprot.writeI32(struct.serverType.getValue()); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } }
case 4: // SERVER_TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.serverType = ServerType.findByValue(iprot.readI32()); struct.setServerTypeIsSet(true);
if (netImpl.getServerType().isThrift()) { serverType += (" (" + netImpl.getServerType().getProtocolString() + ')');
serverType = ServerType.findByGroupName(groups[0]); if (ServerType.DRDA.equals(serverType)) { isAdded = addMemberServer(m, bp.getHost() + '[' + bp.getPort() + ']', this.drdaServerMap, true);
if (service != null) { for (NetworkInterface ni : service.getAllNetworkServers()) { if (!ni.getServerType().isDRDA()) { continue;
this.socketParams.setServerType(ServerType.getServerType(true, binaryProtocol, useSSL)); this.framedTransport = framedTransport;
for (ServerType _iter279 : struct.serverTypes) oprot.writeI32(_iter279.getValue());
for (int _i272 = 0; _i272 < _set270.size; ++_i272) _elem271 = io.snappydata.thrift.ServerType.findByValue(iprot.readI32()); struct.serverTypes.add(_elem271);
/** * Get all the DRDA servers running on the given member as a * comma-separated host[port] list. */ public final String getDRDAServers(DistributedMember member) { this.mapLock.readLock().lock(); try { final InternalDistributedMember myId = getDistributionManager() .getDistributionManagerId(); final Set<String> networkServers; if (myId.equals(member)) { networkServers = new TreeSet<>(); final FabricService service = FabricServiceManager .currentFabricServiceInstance(); if (service != null) { for (NetworkInterface ni : service.getAllNetworkServers()) { if (ni.getServerType().isDRDA()) { networkServers.add(ni.asString()); } } } } else { networkServers = this.drdaServerMap.get(member); } return SharedUtils.toCSV(networkServers); } finally { this.mapLock.readLock().unlock(); } }
for (ServerType _iter303 : struct.serverTypes) oprot.writeI32(_iter303.getValue());
for (int _i296 = 0; _i296 < _set294.size; ++_i296) _elem295 = io.snappydata.thrift.ServerType.findByValue(iprot.readI32()); struct.serverTypes.add(_elem295);
/** * Get the preferred server to which the next connection should be made. A set * of servers to be excluded from consideration can be passed as a * comma-separated string (e.g. to ignore the failed server during failover). * No server groups are provided here since JDBC clients do not know about * those currently. */ public static void GET_PREFSERVER(String excludedServers, String[] prefServerName, int[] prefServerPort) throws SQLException { prefServerName[0] = null; prefServerPort[0] = -1; // add the special group for DRDA servers ServerLocation server = GemFireXDUtils.getPreferredServer(Collections .singletonList(ServerType.DRDA.getServerGroupName()), null, excludedServers, true); if (server != null) { prefServerName[0] = server.getHostName(); prefServerPort[0] = server.getPort(); } }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, HostAddress struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol)prot; oprot.writeString(struct.hostName); oprot.writeI32(struct.port); BitSet optionals = new BitSet(); if (struct.isSetIpAddress()) { optionals.set(0); } if (struct.isSetServerType()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); if (struct.isSetIpAddress()) { oprot.writeString(struct.ipAddress); } if (struct.isSetServerType()) { oprot.writeI32(struct.serverType.getValue()); } }
for (int _i287 = 0; _i287 < _set285.size; ++_i287) _elem286 = io.snappydata.thrift.ServerType.findByValue(iprot.readI32()); struct.serverTypes.add(_elem286);