当前位置: 首页>>代码示例>>Java>>正文


Java PoolMember类代码示例

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


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

示例1: getPoolMemberForClient

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Override
public String getPoolMemberForClient(Client source, VIP dest){

    rLogger.info("Received traffic from client : {} for VIP : {} ",source, dest);

    syncWithLoadBalancerData();

    PoolMember pm= null;

    if(this.clientMemberMap.containsKey(source)){
        pm= this.clientMemberMap.get(source);
        rLogger.info("Client {} had sent traffic before,new traffic will be routed to the same pool member {}",source,pm);
    }else{
        Pool pool = null;
        pool = this.cmgr.getPool(dest.getPoolName());
        int memberNum = this.randomGenerator.nextInt(pool.getAllMembers().size()-1);
        pm = pool.getAllMembers().get(memberNum);
        this.clientMemberMap.put(source, pm );
        rLogger.info("Network traffic from client {} will be directed to pool member {}",pm);
    }
    return pm.getIp();
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:23,代码来源:RandomLBPolicy.java

示例2: memberExists

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Override
public boolean memberExists(String name, String memberIP,String poolName){
    if(!this.pools.containsKey(poolName))
        return false;

    return this.pools.get(poolName).poolMemberExists(new PoolMember(name, memberIP, poolName));
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:8,代码来源:ConfigManager.java

示例3: getAllPoolMembers

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Override
public Set<PoolMember> getAllPoolMembers(String poolName) {

    if(pools.containsKey(poolName)){
        return new HashSet<PoolMember>(pools.get(poolName).getAllMembers());
    }
    return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:9,代码来源:ConfigManager.java

示例4: getAllPoolMembers

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Override
public Set<PoolMember> getAllPoolMembers(String poolName) {

    return configManager.getAllPoolMembers(poolName);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:6,代码来源:LoadBalancerService.java

示例5: addPoolMember

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Override
public PoolMember addPoolMember(String name,
                                String memberIP,
                                String poolName) {
    return configManager.addPoolMember(name, memberIP, poolName);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:7,代码来源:LoadBalancerService.java

示例6: removePoolMember

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Override
public PoolMember removePoolMember(String name, String poolName) {

    return configManager.removePoolMember(name, poolName);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:6,代码来源:LoadBalancerService.java

示例7: RoundRobinLBPolicy

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
public RoundRobinLBPolicy(ConfigManager cmgr){
    this.cmgr = cmgr;
    this.clientMemberMap = new HashMap<Client, PoolMember>();
    this.nextItemFromPool = new HashMap<VIP, Integer>();
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:6,代码来源:RoundRobinLBPolicy.java

示例8: getPoolMemberForClient

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Override
public String getPoolMemberForClient(Client source, VIP dest){

    rrLogger.info("Received traffic from client : {} for VIP : {} ",source, dest);

    syncWithLoadBalancerData();

    PoolMember pm= null;

    if(this.clientMemberMap.containsKey(source)){

        pm= this.clientMemberMap.get(source);
        rrLogger.info("Client {} had sent traffic before,new traffic will be routed to the same pool member {}",source,pm);
    }else{

        Pool pool = null;
        if(nextItemFromPool.containsKey(dest)){

            int memberNum = nextItemFromPool.get(dest).intValue();
            rrLogger.debug("Packet is from new client for VIP {}",dest);
            pool = this.cmgr.getPool(dest.getPoolName());
            pm = pool.getAllMembers().get(memberNum);
            this.clientMemberMap.put(source, pm );
            rrLogger.info("New client's packet will be directed to pool member {}",pm);
            memberNum++;

            if(memberNum > pool.getAllMembers().size()-1){
                memberNum = 0;
            }
            rrLogger.debug("Next pool member for new client of VIP is set to {}",pool.getAllMembers().get(memberNum));

            this.nextItemFromPool.put(dest, new Integer(memberNum));
        }else{
            rrLogger.debug("Network traffic for VIP : {} has appeared first time from client {}",dest,source);
            pool = this.cmgr.getPool(dest.getPoolName());
            pm = pool.getAllMembers().get(0);
            this.clientMemberMap.put(source, pm);

            rrLogger.info("Network traffic from client {} will be directed to pool member {}",pm);
            this.nextItemFromPool.put(dest, new Integer(1));
            rrLogger.debug("Next pool member for new client of VIP is set to {}",pool.getAllMembers().get(1));
        }
    }
    return pm.getIp();
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:46,代码来源:RoundRobinLBPolicy.java

示例9: RandomLBPolicy

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
public RandomLBPolicy(ConfigManager cmgr){
    this.cmgr = cmgr;
    this.clientMemberMap = new HashMap<Client, PoolMember>();
    randomGenerator = new Random();
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:6,代码来源:RandomLBPolicy.java

示例10: addPoolMember

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Path("/{containerName}/create/poolmember")
@POST
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@StatusCodes( {
    @ResponseCode(code = 201, condition = "Pool member created successfully"),
    @ResponseCode(code = 404, condition = "The containerName not found"),
    @ResponseCode(code = 503, condition = "Load balancer service is unavailable"),
    @ResponseCode(code = 404, condition = "Pool not found"),
    @ResponseCode(code = 409, condition = "Pool member already exist"),
    @ResponseCode(code = 415, condition = "Invalid input data")})
public Response addPoolMember(@PathParam("containerName") String containerName,
        @TypeHint(PoolMember.class) JAXBElement<PoolMember> inPoolMember){

    PoolMember pmInput = inPoolMember.getValue();
    String name = pmInput.getName();
    String memberIP = pmInput.getIp();
    String poolName = pmInput.getPoolName();

    if(name.isEmpty() ||
            memberIP.isEmpty()||
            poolName.isEmpty()){
        throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString());
    }

    IConfigManager configManager = getConfigManagerService(containerName);
    if (configManager == null) {
        throw new ServiceUnavailableException("Load Balancer "
                                    + RestMessages.SERVICEUNAVAILABLE.toString());
    }

    if(!configManager.poolExists(poolName))
        throw new ResourceNotFoundException(NBConst.RES_POOL_NOT_FOUND);

    if(!configManager.memberExists(name, memberIP, poolName)){

        PoolMember poolMember = configManager.addPoolMember(name, memberIP, poolName);
        if ( poolMember != null){
            return Response.status(Response.Status.CREATED).build();
        }
    }else{
        throw new ResourceConflictException(NBConst.RES_POOLMEMBER_ALREADY_EXIST);
    }
    throw new InternalServerErrorException(NBConst.RES_POOLMEMBER_CREATION_FAILED);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:45,代码来源:LoadBalancerNorthbound.java

示例11: addPoolMember

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Override
public PoolMember addPoolMember(String name, String memberIP, String poolName){

    PoolMember pm = new PoolMember(name,memberIP,poolName);

    cmLogger.info("Adding pool member : "+pm.toString());

    pools.get(poolName).addMember(pm);

    return pm;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:12,代码来源:ConfigManager.java

示例12: removePoolMember

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
@Override
public PoolMember removePoolMember(String name, String poolName){

    cmLogger.info("Removing pool member : {} from pool {}",name, poolName);

    Pool pool = pools.get(poolName);

    PoolMember pm = pool.getMember(name);

    pool.removeMember(name);

    cmLogger.info("Pool member {} removed from {} ",name,poolName);

    return pm;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:16,代码来源:ConfigManager.java

示例13: getAllPoolMembers

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
/**
 * Return all  pool members of the pool 'poolName'
 * @param poolName  Name of the pool
 * @return  Set of all the pool members     if pool with the name present in the configuration
 *                  null                            else
 *
 */
public Set<PoolMember> getAllPoolMembers(String poolName);
 
开发者ID:lbchen,项目名称:ODL,代码行数:9,代码来源:IConfigManager.java

示例14: addPoolMember

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
/**
 * Add new pool member to the configuration
 * @param name  Name of the pool
 * @param memberIP  IP of the pool
 * @param poolName  Attach pool member to this pool
 * @return  Newly created pool member
 */
public PoolMember addPoolMember(String name, String memberIP, String poolName);
 
开发者ID:lbchen,项目名称:ODL,代码行数:9,代码来源:IConfigManager.java

示例15: removePoolMember

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入依赖的package包/类
/**
 * Remove pool member from the pool
 * @param name  Name of the pool member
 * @param poolName  Name of the pool
 * @return  Details of the removed pool member
 */
public PoolMember removePoolMember(String name, String poolName);
 
开发者ID:lbchen,项目名称:ODL,代码行数:8,代码来源:IConfigManager.java


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