• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FabricStateResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.mysql.fabric.FabricStateResponse的典型用法代码示例。如果您正苦于以下问题:Java FabricStateResponse类的具体用法?Java FabricStateResponse怎么用?Java FabricStateResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FabricStateResponse类属于com.mysql.fabric包,在下文中一共展示了FabricStateResponse类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getServerGroups

import com.mysql.fabric.FabricStateResponse; //导入依赖的package包/类
/**
 * Facade for "dump.servers". Will not return empty server groups.
 */
public FabricStateResponse<Set<ServerGroup>> getServerGroups(String groupPattern) throws FabricCommunicationException {
    int version = 0; // necessary but unused
    Response response = errorSafeCallMethod(METHOD_DUMP_SERVERS, new Object[] { version, groupPattern });
    // collect all servers by group name
    Map<String, Set<Server>> serversByGroupName = new HashMap<String, Set<Server>>();
    for (Map<String, ?> server : response.getResultSet()) {
        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:bragex,项目名称:the-vigilantes,代码行数:24,代码来源:XmlRpcClient.java


示例2: getShardIndices

import com.mysql.fabric.FabricStateResponse; //导入依赖的package包/类
private FabricStateResponse<Set<ShardIndex>> getShardIndices(int shardMappingId) throws FabricCommunicationException {
    int version = 0;
    Object args[] = new Object[] { version, String.valueOf(shardMappingId) };
    Response indexResponse = errorSafeCallMethod(METHOD_DUMP_SHARD_INDEX, args);
    Set<ShardIndex> indices = new HashSet<ShardIndex>();

    // construct the index
    for (Map<String, ?> rawIndexEntry : indexResponse.getResultSet()) {
        String bound = (String) rawIndexEntry.get(FIELD_LOWER_BOUND);
        int shardId = (Integer) rawIndexEntry.get(FIELD_SHARD_ID);
        String groupName = (String) rawIndexEntry.get(FIELD_GROUP_ID);
        ShardIndex si = new ShardIndex(bound, shardId, groupName);
        indices.add(si);
    }
    return new FabricStateResponse<Set<ShardIndex>>(indices, indexResponse.getTtl());
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:17,代码来源:XmlRpcClient.java


示例3: getServerGroups

import com.mysql.fabric.FabricStateResponse; //导入依赖的package包/类
/**
 * Facade for "dump.servers". Will not return empty server groups.
 */
public FabricStateResponse<Set<ServerGroup>> getServerGroups(String groupPattern) throws FabricCommunicationException {
    int version = 0; // necessary but unused
    Response response = errorSafeCallMethod(METHOD_DUMP_SERVERS, new Object[] { version, groupPattern });
    // collect all servers by group name
    Map<String, Set<Server>> serversByGroupName = new HashMap<String, Set<Server>>();
    for (Map server : response.getResultSet()) {
        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:lamsfoundation,项目名称:lams,代码行数:24,代码来源:XmlRpcClient.java


示例4: getShardIndices

import com.mysql.fabric.FabricStateResponse; //导入依赖的package包/类
private FabricStateResponse<Set<ShardIndex>> getShardIndices(int shardMappingId) throws FabricCommunicationException {
    int version = 0;
    Object args[] = new Object[] { version, String.valueOf(shardMappingId) };
    Response indexResponse = errorSafeCallMethod(METHOD_DUMP_SHARD_INDEX, args);
    Set<ShardIndex> indices = new HashSet<ShardIndex>();

    // construct the index
    for (Map rawIndexEntry : indexResponse.getResultSet()) {
        String bound = (String) rawIndexEntry.get(FIELD_LOWER_BOUND);
        int shardId = (Integer) rawIndexEntry.get(FIELD_SHARD_ID);
        String groupName = (String) rawIndexEntry.get(FIELD_GROUP_ID);
        ShardIndex si = new ShardIndex(bound, shardId, groupName);
        indices.add(si);
    }
    return new FabricStateResponse<Set<ShardIndex>>(indices, indexResponse.getTtl());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:XmlRpcClient.java


示例5: getServerGroups

import com.mysql.fabric.FabricStateResponse; //导入依赖的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


示例6: getShardTables

import com.mysql.fabric.FabricStateResponse; //导入依赖的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


示例7: getShardIndices

import com.mysql.fabric.FabricStateResponse; //导入依赖的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


示例8: getShardTables

import com.mysql.fabric.FabricStateResponse; //导入依赖的package包/类
private FabricStateResponse<Set<ShardTable>> getShardTables(int shardMappingId) throws FabricCommunicationException {
    int version = 0;
    Object args[] = new Object[] { version, String.valueOf(shardMappingId) };
    Response tablesResponse = errorSafeCallMethod(METHOD_DUMP_SHARD_TABLES, args);
    Set<ShardTable> tables = new HashSet<ShardTable>();
    // construct the tables
    for (Map<String, ?> rawTable : tablesResponse.getResultSet()) {
        String database = (String) rawTable.get(FIELD_SCHEMA_NAME);
        String table = (String) rawTable.get(FIELD_TABLE_NAME);
        String column = (String) rawTable.get(FIELD_COLUMN_NAME);
        ShardTable st = new ShardTable(database, table, column);
        tables.add(st);
    }
    return new FabricStateResponse<Set<ShardTable>>(tables, tablesResponse.getTtl());
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:16,代码来源:XmlRpcClient.java


示例9: getShardMappings

import com.mysql.fabric.FabricStateResponse; //导入依赖的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
    Response mapsResponse = errorSafeCallMethod(METHOD_DUMP_SHARD_MAPS, args);
    // use the lowest ttl of all the calls
    long minExpireTimeMillis = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(mapsResponse.getTtl());
    int baseTtl = mapsResponse.getTtl();

    // construct the maps
    Set<ShardMapping> mappings = new HashSet<ShardMapping>();
    for (Map<String, ?> rawMapping : mapsResponse.getResultSet()) {
        int mappingId = (Integer) rawMapping.get(FIELD_MAPPING_ID);
        ShardingType shardingType = ShardingType.valueOf((String) rawMapping.get(FIELD_TYPE_NAME));
        String globalGroupName = (String) rawMapping.get(FIELD_GLOBAL_GROUP_ID);

        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, baseTtl, minExpireTimeMillis);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:39,代码来源:XmlRpcClient.java


示例10: getShardTables

import com.mysql.fabric.FabricStateResponse; //导入依赖的package包/类
private FabricStateResponse<Set<ShardTable>> getShardTables(int shardMappingId) throws FabricCommunicationException {
    int version = 0;
    Object args[] = new Object[] { version, String.valueOf(shardMappingId) };
    Response tablesResponse = errorSafeCallMethod(METHOD_DUMP_SHARD_TABLES, args);
    Set<ShardTable> tables = new HashSet<ShardTable>();
    // construct the tables
    for (Map rawTable : tablesResponse.getResultSet()) {
        String database = (String) rawTable.get(FIELD_SCHEMA_NAME);
        String table = (String) rawTable.get(FIELD_TABLE_NAME);
        String column = (String) rawTable.get(FIELD_COLUMN_NAME);
        ShardTable st = new ShardTable(database, table, column);
        tables.add(st);
    }
    return new FabricStateResponse<Set<ShardTable>>(tables, tablesResponse.getTtl());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:XmlRpcClient.java


示例11: getShardMappings

import com.mysql.fabric.FabricStateResponse; //导入依赖的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
    Response mapsResponse = errorSafeCallMethod(METHOD_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 (Map rawMapping : mapsResponse.getResultSet()) {
        int mappingId = (Integer) rawMapping.get(FIELD_MAPPING_ID);
        ShardingType shardingType = ShardingType.valueOf((String) rawMapping.get(FIELD_TYPE_NAME));
        String globalGroupName = (String) rawMapping.get(FIELD_GLOBAL_GROUP_ID);

        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:lamsfoundation,项目名称:lams,代码行数:38,代码来源:XmlRpcClient.java



注:本文中的com.mysql.fabric.FabricStateResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WrongRepositoryStateException类代码示例发布时间:2022-05-21
下一篇:
Java ScriptBasedMapping类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap