當前位置: 首頁>>代碼示例>>Java>>正文


Java DumpResponse類代碼示例

本文整理匯總了Java中com.mysql.fabric.DumpResponse的典型用法代碼示例。如果您正苦於以下問題:Java DumpResponse類的具體用法?Java DumpResponse怎麽用?Java DumpResponse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DumpResponse類屬於com.mysql.fabric包,在下文中一共展示了DumpResponse類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getServerGroups

import com.mysql.fabric.DumpResponse; //導入依賴的package包/類
/**
 * Facade for "dump.servers".
 */
public FabricStateResponse<Set<ServerGroup>> getServerGroups(String groupPattern) throws FabricCommunicationException {
	int version = 0; // necessary but unused
	DumpResponse response = callDumpMethod("dump.servers", new Object[] {version, groupPattern});
	// collect all servers by group name
	Map<String, Set<Server>> serversByGroupName = new HashMap<String, Set<Server>>();
	for (List server : (List<List>) response.getReturnValue()) {
		Server s = unmarshallServer(server);
		if (serversByGroupName.get(s.getGroupName()) == null) {
			serversByGroupName.put(s.getGroupName(), new HashSet<Server>());
		}
		serversByGroupName.get(s.getGroupName()).add(s);
	}
	// create group set
	Set<ServerGroup> serverGroups = new HashSet<ServerGroup>();
	for (Map.Entry<String, Set<Server>> entry : serversByGroupName.entrySet()) {
		ServerGroup g = new ServerGroup(entry.getKey(), entry.getValue());
		serverGroups.add(g);
	}
	return new FabricStateResponse<Set<ServerGroup>>(serverGroups, response.getTtl());
}
 
開發者ID:hinsenchan,項目名稱:fil_project_mgmt_app_v2,代碼行數:24,代碼來源:XmlRpcClient.java

示例2: getShardTables

import com.mysql.fabric.DumpResponse; //導入依賴的package包/類
private FabricStateResponse<Set<ShardTable>> getShardTables(String shardMappingId) throws FabricCommunicationException {
	int version = 0;
	Object args[] = new Object[] {version, shardMappingId};
	DumpResponse tablesResponse = callDumpMethod("dump.shard_tables", args);
	Set<ShardTable> tables = new HashSet<ShardTable>();
	// construct the tables
	for (List rawTable : (List<List>) tablesResponse.getReturnValue()) {
		String database = (String)rawTable.get(0);
		String table = (String)rawTable.get(1);
		String column = (String)rawTable.get(2);
		String mappingId = (String)rawTable.get(3);
		ShardTable st = new ShardTable(database, table, column);
		tables.add(st);
	}
	return new FabricStateResponse<Set<ShardTable>>(tables, tablesResponse.getTtl());
}
 
開發者ID:hinsenchan,項目名稱:fil_project_mgmt_app_v2,代碼行數:17,代碼來源:XmlRpcClient.java

示例3: getShardIndices

import com.mysql.fabric.DumpResponse; //導入依賴的package包/類
private FabricStateResponse<Set<ShardIndex>> getShardIndices(String shardMappingId) throws FabricCommunicationException {
	int version = 0;
	Object args[] = new Object[] {version, shardMappingId};
	DumpResponse indexResponse = callDumpMethod("dump.shard_index", args);
	Set<ShardIndex> indices = new HashSet<ShardIndex>();

	// construct the index
	for (List rawIndexEntry : (List<List>) indexResponse.getReturnValue()) {
		String bound = (String)rawIndexEntry.get(0);
		String mappingId = (String)rawIndexEntry.get(1);
		String shardId = (String)rawIndexEntry.get(2);
		String groupName = (String)rawIndexEntry.get(3);
		ShardIndex si = new ShardIndex(bound, Integer.valueOf(shardId), groupName);
		indices.add(si);
	}
	return new FabricStateResponse<Set<ShardIndex>>(indices, indexResponse.getTtl());
}
 
開發者ID:hinsenchan,項目名稱:fil_project_mgmt_app_v2,代碼行數:18,代碼來源:XmlRpcClient.java

示例4: getShardMappings

import com.mysql.fabric.DumpResponse; //導入依賴的package包/類
/**
 * Retrieve a set of complete shard mappings. The returned mappings include all information
 * available about the mapping.
 * @param shardMappingIdPattern the shard mapping id to retrieve
 */
public FabricStateResponse<Set<ShardMapping>> getShardMappings(String shardMappingIdPattern) throws FabricCommunicationException {
	int version = 0;
	Object args[] = new Object[] {version, shardMappingIdPattern}; // common to all calls
	DumpResponse mapsResponse = callDumpMethod("dump.shard_maps", args);
	// use the lowest ttl of all the calls
	long minExpireTimeMillis = System.currentTimeMillis() + (1000 * mapsResponse.getTtl());

	// construct the maps
	Set<ShardMapping> mappings = new HashSet<ShardMapping>();
	for (List rawMapping : (List<List>) mapsResponse.getReturnValue()) {
		String mappingId = (String)rawMapping.get(0);
		ShardingType shardingType = ShardingType.valueOf((String)rawMapping.get(1));
		String globalGroupName = (String)rawMapping.get(2);

		FabricStateResponse<Set<ShardTable>> tables = getShardTables(mappingId);
		FabricStateResponse<Set<ShardIndex>> indices = getShardIndices(mappingId);

		if (tables.getExpireTimeMillis() < minExpireTimeMillis)
			minExpireTimeMillis = tables.getExpireTimeMillis();
		if (indices.getExpireTimeMillis() < minExpireTimeMillis)
			minExpireTimeMillis = indices.getExpireTimeMillis();

		ShardMapping m = new ShardMappingFactory().createShardMapping(mappingId, shardingType, globalGroupName,
																	  tables.getData(), indices.getData());
		mappings.add(m);
	}

	return new FabricStateResponse<Set<ShardMapping>>(mappings, minExpireTimeMillis);
}
 
開發者ID:hinsenchan,項目名稱:fil_project_mgmt_app_v2,代碼行數:35,代碼來源:XmlRpcClient.java

示例5: callDumpMethod

import com.mysql.fabric.DumpResponse; //導入依賴的package包/類
/**
 * Call a dump.* method.
 */
private DumpResponse callDumpMethod(String methodName, Object args[])
	throws FabricCommunicationException {
	List<?> responseData = this.methodCaller.call(methodName, args);
	return new DumpResponse(responseData);
}
 
開發者ID:hinsenchan,項目名稱:fil_project_mgmt_app_v2,代碼行數:9,代碼來源:XmlRpcClient.java


注:本文中的com.mysql.fabric.DumpResponse類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。