@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); } } },
@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); } } },
/** * 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(); } }
/** * 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(); } }
if (ntypes == 1) { intersectGroups = Collections.singleton(serverTypes.iterator().next() .getServerGroupName()); intersectGroups = igroups; for (ServerType serverType : serverTypes) { intersectGroups.add(serverType.getServerGroupName());
if (ntypes == 1) { intersectGroups = Collections.singleton(serverTypes.iterator().next() .getServerGroupName()); intersectGroups = igroups; for (ServerType serverType : serverTypes) { intersectGroups.add(serverType.getServerGroupName());
@Override public void fillInProfile(Profile profile) { assert profile instanceof BridgeServerProfile; final BridgeServerProfile bp = (BridgeServerProfile)profile; bp.setHost(getHostName()); bp.setPort(getPort()); final String[] groups = ServerGroupUtils.getMyGroupsArray(); // add special group for thrift/DRDA server if (groups == null || groups.length == 0) { bp.setGroups(new String[] { getServerType().getServerGroupName() }); } else { final String[] allGroups = new String[groups.length + 1]; allGroups[0] = getServerType().getServerGroupName(); System.arraycopy(groups, 0, allGroups, 1, groups.length); bp.setGroups(allGroups); } bp.setMaxConnections(getMaxConnections()); bp.setInitialLoad(this.probe.getLoad(this)); bp.setLoadPollInterval(CacheServer.DEFAULT_LOAD_POLL_INTERVAL); bp.serialNumber = getSerialNumber(); bp.finishInit(); this.initialLoad = bp.getInitialLoad().toString(); }
@Override public void fillInProfile(Profile profile) { assert profile instanceof BridgeServerProfile; final BridgeServerProfile bp = (BridgeServerProfile)profile; bp.setHost(getHostName()); bp.setPort(getPort()); final String[] groups = ServerGroupUtils.getMyGroupsArray(); // add special group for thrift/DRDA server if (groups == null || groups.length == 0) { bp.setGroups(new String[] { getServerType().getServerGroupName() }); } else { final String[] allGroups = new String[groups.length + 1]; allGroups[0] = getServerType().getServerGroupName(); System.arraycopy(groups, 0, allGroups, 1, groups.length); bp.setGroups(allGroups); } bp.setMaxConnections(getMaxConnections()); bp.setInitialLoad(this.probe.getLoad(this)); bp.setLoadPollInterval(CacheServer.DEFAULT_LOAD_POLL_INTERVAL); bp.serialNumber = getSerialNumber(); bp.finishInit(); this.initialLoad = bp.getInitialLoad().toString(); }