/** * It is used to create table names for old META, and ROOT table. * These tables are not really legal tables. They are not added into the cache. * @return a dummy TableName instance (with no validation) for the passed qualifier */ private static TableName getADummyTableName(String qualifier) { return new TableName(qualifier); }
/** * Check that the object does not exist already. There are two reasons for creating the objects * only once: * 1) With 100K regions, the table names take ~20MB. * 2) Equals becomes much faster as it's resolved with a reference and an int comparison. */ private static TableName createTableNameIfNecessary(ByteBuffer bns, ByteBuffer qns) { for (TableName tn : tableCache) { if (Bytes.equals(tn.getQualifier(), qns) && Bytes.equals(tn.getNamespace(), bns)) { return tn; } } TableName newTable = new TableName(bns, qns); if (tableCache.add(newTable)) { // Adds the specified element if it is not already present return newTable; } // Someone else added it. Let's find it. for (TableName tn : tableCache) { if (Bytes.equals(tn.getQualifier(), qns) && Bytes.equals(tn.getNamespace(), bns)) { return tn; } } // this should never happen. throw new IllegalStateException(newTable + " was supposed to be in the cache"); }
/** * It is used to create table names for old META, and ROOT table. * These tables are not really legal tables. They are not added into the cache. * @return a dummy TableName instance (with no validation) for the passed qualifier */ private static TableName getADummyTableName(String qualifier) { return new TableName(qualifier); }
/** * It is used to create table names for old META, and ROOT table. * These tables are not really legal tables. They are not added into the cache. * @return a dummy TableName instance (with no validation) for the passed qualifier */ private static TableName getADummyTableName(String qualifier) { return new TableName(qualifier); }
/** * It is used to create table names for old META, and ROOT table. * These tables are not really legal tables. They are not added into the cache. * @return a dummy TableName instance (with no validation) for the passed qualifier */ private static TableName getADummyTableName(String qualifier) { return new TableName(qualifier); }
TableName papa = new TableName(); papa.setParent(null); // parent TableName kid1 = new TableName(); kid1.setParent(papa); papa.getChildren().add(kid1); TableName kid1_1 = new TableName(); kid1_1.setParent(kid1); kid1.getChildren().add(kid1_1); TableName kid2 = new TableName(); kid2.setParent(papa); papa.getChildren().add(kid2); session.save(papa)
/** * Check that the object does not exist already. There are two reasons for creating the objects * only once: * 1) With 100K regions, the table names take ~20MB. * 2) Equals becomes much faster as it's resolved with a reference and an int comparison. */ private static TableName createTableNameIfNecessary(ByteBuffer bns, ByteBuffer qns) { for (TableName tn : tableCache) { if (Bytes.equals(tn.getQualifier(), qns) && Bytes.equals(tn.getNamespace(), bns)) { return tn; } } TableName newTable = new TableName(bns, qns); if (tableCache.add(newTable)) { // Adds the specified element if it is not already present return newTable; } // Someone else added it. Let's find it. for (TableName tn : tableCache) { if (Bytes.equals(tn.getQualifier(), qns) && Bytes.equals(tn.getNamespace(), bns)) { return tn; } } // this should never happen. throw new IllegalStateException(newTable + " was supposed to be in the cache"); }
/** * Check that the object does not exist already. There are two reasons for creating the objects * only once: * 1) With 100K regions, the table names take ~20MB. * 2) Equals becomes much faster as it's resolved with a reference and an int comparison. */ private static TableName createTableNameIfNecessary(ByteBuffer bns, ByteBuffer qns) { for (TableName tn : tableCache) { if (Bytes.equals(tn.getQualifier(), qns) && Bytes.equals(tn.getNamespace(), bns)) { return tn; } } TableName newTable = new TableName(bns, qns); if (tableCache.add(newTable)) { // Adds the specified element if it is not already present return newTable; } // Someone else added it. Let's find it. for (TableName tn : tableCache) { if (Bytes.equals(tn.getQualifier(), qns) && Bytes.equals(tn.getNamespace(), bns)) { return tn; } } // this should never happen. throw new IllegalStateException(newTable + " was supposed to be in the cache"); }
/** * Check that the object does not exist already. There are two reasons for creating the objects * only once: * 1) With 100K regions, the table names take ~20MB. * 2) Equals becomes much faster as it's resolved with a reference and an int comparison. */ private static TableName createTableNameIfNecessary(ByteBuffer bns, ByteBuffer qns) { for (TableName tn : tableCache) { if (Bytes.equals(tn.getQualifier(), qns) && Bytes.equals(tn.getNamespace(), bns)) { return tn; } } TableName newTable = new TableName(bns, qns); if (tableCache.add(newTable)) { // Adds the specified element if it is not already present return newTable; } // Someone else added it. Let's find it. for (TableName tn : tableCache) { if (Bytes.equals(tn.getQualifier(), qns) && Bytes.equals(tn.getNamespace(), bns)) { return tn; } } // this should never happen. throw new IllegalStateException(newTable + " was supposed to be in the cache"); }