public static int stopMembersOnHost(String hostName)
	{
		
		JMX jmx = SingletonGemFireJmx.getJmx();
		
		
		String objectNamePattern = "GemFire:type=Member,member=*";
		QueryExp queryExp = null;
		ValueExp[] values = null;
		
		
		//Also get the IP
		try
		{
			InetAddress[] addresses = InetAddress.getAllByName(hostName); 
			InetAddress address = null;
			if(addresses != null)
			{
				values = new ValueExp[addresses.length];
				
				for (int i=0; i <addresses.length;i++)
				{
					address = addresses[i];
					values[i] = Query.value(address.getHostAddress());
					
				}
			}
		}
		catch (UnknownHostException e)
		{
			Debugger.println(e.getMessage());
		}
		
		if(values != null)
		{
			queryExp = Query.or(Query.eq(Query.attr("Host"), Query.value(hostName)),
								Query.in(Query.attr("Host"), values));
		}
		else
		{
			queryExp = Query.eq(Query.attr("Host"), Query.value(hostName));
		}
		
		/*
		 * QueryExp query = Query.and(Query.eq(Query.attr("Enabled"), Query.value(true)),
               Query.eq(Query.attr("Owner"), Query.value("Duke")));
		 */
		Set<ObjectName> memberObjectNames =  jmx.searchObjectNames(objectNamePattern, queryExp);
		
		if(memberObjectNames == null || memberObjectNames.isEmpty())
			return 0;
		
		
		int memberCount = memberObjectNames.size();
		
		MemberMXBean member = null;
		
		Collection<String> locators = new ArrayList<String>();
		for (ObjectName objectName : memberObjectNames)
		{
			member = GemFireJmxClient.getMember(objectName.getKeyProperty("member"), SingletonGemFireJmx.getJmx());
			
			if(member.isLocator())
			{
				locators.add(member.getName());
			}
			else
			{
				shutDownMember(member.getName());
			}
			
		}
		
		for (String locatorName : locators)
		{			
			shutDownMember(locatorName);
		}
		
		return memberCount;
	}
public static int stopMembersOnHost(String hostName)
	{
		
		JMX jmx = SingletonGemFireJmx.getJmx();
		
		
		String objectNamePattern = "GemFire:type=Member,member=*";
		QueryExp queryExp = null;
		ValueExp[] values = null;
		
		
		
		try
		{
			InetAddress[] addresses = InetAddress.getAllByName(hostName); 
			InetAddress address = null;
			if(addresses != null)
			{
				values = new ValueExp[addresses.length];
				
				for (int i=0; i <addresses.length;i++)
				{
					address = addresses[i];
					values[i] = Query.value(address.getHostAddress());
					
				}
			}
		}
		catch (UnknownHostException e)
		{
			Debugger.println(e.getMessage());
		}
		
		if(values != null)
		{
			queryExp = Query.or(Query.eq(Query.attr("Host"), Query.value(hostName)),
								Query.in(Query.attr("Host"), values));
		}
		else
		{
			queryExp = Query.eq(Query.attr("Host"), Query.value(hostName));
		}
		
		
		Set<ObjectName> memberObjectNames =  jmx.searchObjectNames(objectNamePattern, queryExp);
		
		if(memberObjectNames == null || memberObjectNames.isEmpty())
			return 0;
		
		
		int memberCount = memberObjectNames.size();
		
		MemberMXBean member = null;
		
		Collection<String> locators = new ArrayList<String>();
		for (ObjectName objectName : memberObjectNames)
		{
			member = GemFireJmxClient.getMember(objectName.getKeyProperty("member"), SingletonGemFireJmx.getJmx());
			
			if(member.isLocator())
			{
				locators.add(member.getName());
			}
			else
			{
				shutDownMember(member.getName());
			}
			
		}
		
		for (String locatorName : locators)
		{			
			shutDownMember(locatorName);
		}
		
		return memberCount;
	}
public static int stopMembersOnHost ( String hostName ) { JMX jmx = SingletonGemFireJmx . getJmx ( ) ; String objectNamePattern = "GemFire:type=Member,member=*" ; QueryExp queryExp = null ; ValueExp [ ] values = null ; //Also get the IP try { InetAddress [ ] addresses = InetAddress . getAllByName ( hostName ) ; InetAddress address = null ; if ( addresses != null ) { values = new ValueExp [ addresses . length ] ; for ( int i = 0 ; i < addresses . length ; i ++ ) { address = addresses [ i ] ; values [ i ] = Query . value ( address . getHostAddress ( ) ) ; } } } catch ( UnknownHostException e ) { Debugger . println ( e . getMessage ( ) ) ; } if ( values != null ) { queryExp = Query . or ( Query . eq ( Query . attr ( "Host" ) , Query . value ( hostName ) ) , Query . in ( Query . attr ( "Host" ) , values ) ) ; } else { queryExp = Query . eq ( Query . attr ( "Host" ) , Query . value ( hostName ) ) ; } /*
		 * QueryExp query = Query.and(Query.eq(Query.attr("Enabled"), Query.value(true)),
               Query.eq(Query.attr("Owner"), Query.value("Duke")));
		 */ Set < ObjectName > memberObjectNames = jmx . searchObjectNames ( objectNamePattern , queryExp ) ; if ( memberObjectNames == null || memberObjectNames . isEmpty ( ) ) return 0 ; int memberCount = memberObjectNames . size ( ) ; MemberMXBean member = null ; Collection < String > locators = new ArrayList < String > ( ) ; for ( ObjectName objectName : memberObjectNames ) { member = GemFireJmxClient . getMember ( objectName . getKeyProperty ( "member" ) , SingletonGemFireJmx . getJmx ( ) ) ; if ( member . isLocator ( ) ) { locators . add ( member . getName ( ) ) ; } else { shutDownMember ( member . getName ( ) ) ; } } for ( String locatorName : locators ) { shutDownMember ( locatorName ) ; } return memberCount ; }
Stops all cache servers followed by locators on a given server
@param hostName the host name and or IP address
@return the number of members
Stops all cache servers followed by locators on a given server