Package org.makersoft.shards

Examples of org.makersoft.shards.ShardId


      new MyBaseHasShardIdList(shardIdList);
      Assert.fail("expected iae");
    } catch (IllegalArgumentException iae) {
      // good
    }
    shardIdList.add(new ShardId(0));
    BaseHasShardIdList bhsil = new MyBaseHasShardIdList(shardIdList);
    ShardId anotherId = new ShardId(1);
    shardIdList.add(anotherId);
    // demonstrate that external changes to the list that was passed in
    // aren't reflected inside the object
    Assert.assertFalse(bhsil.getShardIds().contains(anotherId));
  }
View Full Code Here


@ShardStrategy(mapper = UserMapper.class)
public class UserShardStrategy implements SelectionStrategy<User>{
 
  public ShardId selectShardIdForNewObject(User entity) {
    if(User.SEX_MALE == entity.getGender()){
      return new ShardId(1);
    }else if(User.SEX_FEMALE == entity.getGender()){
      return new ShardId(2);
    }
   
    // 或指向写库
   
    return null;
View Full Code Here

TOP

Related Classes of org.makersoft.shards.ShardId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.