accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubbsii <...@git.apache.org>
Subject [GitHub] accumulo pull request #292: ACCUMULO-4681 Created Table & Namespace WeakRefe...
Date Wed, 16 Aug 2017 00:27:57 GMT
Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/292#discussion_r133335412
  
    --- Diff: server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java ---
    @@ -59,21 +57,16 @@ static void checkTableDoesNotExist(Instance instance, String tableName,
Table.ID
           throw new AcceptableThriftTableOperationException(null, tableName, operation, TableOperationExceptionType.EXISTS,
null);
       }
     
    -  static <T extends AbstractId> T getNextTableId(String tableName, Instance instance,
Class<T> idClassType) throws AcceptableThriftTableOperationException {
    +  static String getNextTableId(String tableName, Instance instance) throws AcceptableThriftTableOperationException
{
         try {
           IZooReaderWriter zoo = ZooReaderWriter.getInstance();
           final String ntp = ZooUtil.getRoot(instance) + Constants.ZTABLES;
    -      byte[] nid = zoo.mutate(ntp, ZERO_BYTE, ZooUtil.PUBLIC, new Mutator() {
    -        @Override
    -        public byte[] mutate(byte[] currentValue) throws Exception {
    -          BigInteger nextId = new BigInteger(new String(currentValue, UTF_8), Character.MAX_RADIX);
    -          nextId = nextId.add(BigInteger.ONE);
    -          return nextId.toString(Character.MAX_RADIX).getBytes(UTF_8);
    -        }
    +      byte[] nid = zoo.mutate(ntp, ZERO_BYTE, ZooUtil.PUBLIC, currentValue -> {
    +        BigInteger nextId = new BigInteger(new String(currentValue, UTF_8), Character.MAX_RADIX);
    +        nextId = nextId.add(BigInteger.ONE);
    +        return nextId.toString(Character.MAX_RADIX).getBytes(UTF_8);
           });
    -      Constructor<T> constructor = idClassType.getConstructor(String.class);
    -      return constructor.newInstance(new String(nid, UTF_8));
    --- End diff --
    
    Very big +1 to getting rid of this reflection implementation.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message