@Test public void testIteratorConflict() { try (ScannerOptions options = new ScannerOptions()) { options.addScanIterator(new IteratorSetting(1, "NAME", DebugIterator.class)); try { options.addScanIterator(new IteratorSetting(2, "NAME", DebugIterator.class)); fail(); } catch (IllegalArgumentException e) {} try { options.addScanIterator(new IteratorSetting(1, "NAME2", DebugIterator.class)); fail(); } catch (IllegalArgumentException e) {} } }
@Override public synchronized void addScanIterator(IteratorSetting si) { checkArgument(si != null, "si is null"); if (serverSideIteratorList.isEmpty()) { serverSideIteratorList = new ArrayList<>(); } for (IterInfo ii : serverSideIteratorList) { if (ii.iterName.equals(si.getName())) { throw new IllegalArgumentException("Iterator name is already in use " + si.getName()); } if (ii.getPriority() == si.getPriority()) { throw new IllegalArgumentException( "Iterator priority is already in use " + si.getPriority()); } } serverSideIteratorList.add(new IterInfo(si.getPriority(), si.getIteratorClass(), si.getName())); if (serverSideIteratorOptions.isEmpty()) { serverSideIteratorOptions = new HashMap<>(); } serverSideIteratorOptions.computeIfAbsent(si.getName(), k -> new HashMap<>()) .putAll(si.getOptions()); }
ScannerOptions implements ScannerBase { @Override public synchronized void addScanIterator(IteratorSetting si) { checkArgument(si != null, "si is null"); if (serverSideIteratorList.isEmpty()) { serverSideIteratorList = new ArrayList<>(); } for (IterInfo ii : serverSideIteratorList) { if (ii.iterName.equals(si.getName())) { throw new IllegalArgumentException("Iterator name is already in use " + si.getName()); } if (ii.getPriority() == si.getPriority()) { throw new IllegalArgumentException( "Iterator priority is already in use " + si.getPriority()); } } serverSideIteratorList.add(new IterInfo(si.getPriority(), si.getIteratorClass(), si.getName())); if (serverSideIteratorOptions.isEmpty()) { serverSideIteratorOptions = new HashMap<>(); } serverSideIteratorOptions.computeIfAbsent(si.getName(), k -> new HashMap<>()) .putAll(si.getOptions()); } }
ScannerOptions implements ScannerBase { @Override public synchronized void addScanIterator(IteratorSetting si) { checkArgument(si != null, "si is null"); if (serverSideIteratorList.isEmpty()) { serverSideIteratorList = new ArrayList<>(); } for (IterInfo ii : serverSideIteratorList) { if (ii.iterName.equals(si.getName())) { throw new IllegalArgumentException("Iterator name is already in use " + si.getName()); } if (ii.getPriority() == si.getPriority()) { throw new IllegalArgumentException( "Iterator priority is already in use " + si.getPriority()); } } serverSideIteratorList.add(new IterInfo(si.getPriority(), si.getIteratorClass(), si.getName())); if (serverSideIteratorOptions.isEmpty()) { serverSideIteratorOptions = new HashMap<>(); } serverSideIteratorOptions.computeIfAbsent(si.getName(), k -> new HashMap<>()) .putAll(si.getOptions()); } protected  ScannerOptions();  ScannerOptions(ScannerOptions so); }
ScannerOptions implements ScannerBase { @Override public synchronized void addScanIterator(IteratorSetting si) { checkArgument(si != null, "si is null"); if (serverSideIteratorList.isEmpty()) { serverSideIteratorList = new ArrayList<>(); } for (IterInfo ii : serverSideIteratorList) { if (ii.iterName.equals(si.getName())) { throw new IllegalArgumentException("Iterator name is already in use " + si.getName()); } if (ii.getPriority() == si.getPriority()) { throw new IllegalArgumentException( "Iterator priority is already in use " + si.getPriority()); } } serverSideIteratorList.add(new IterInfo(si.getPriority(), si.getIteratorClass(), si.getName())); if (serverSideIteratorOptions.isEmpty()) { serverSideIteratorOptions = new HashMap<>(); } serverSideIteratorOptions.computeIfAbsent(si.getName(), k -> new HashMap<>()) .putAll(si.getOptions()); } protected  ScannerOptions();  ScannerOptions(ScannerOptions so); @Override synchronized void addScanIterator(IteratorSetting si); @Override synchronized void removeScanIterator(String iteratorName); @Override synchronized void updateScanIteratorOption(String iteratorName, String key, String value); @Override synchronized void fetchColumnFamily(Text col); @Override synchronized void fetchColumn(Text colFam, Text colQual); @Override void fetchColumn(IteratorSetting.Column column); @Override synchronized void clearColumns(); synchronized SortedSet<Column> getFetchedColumns(); @Override synchronized void clearScanIterators(); @Override Iterator<Entry<Key,Value>> iterator(); @Override synchronized void setTimeout(long timeout, TimeUnit timeUnit); @Override synchronized long getTimeout(TimeUnit timeunit); @Override void close(); @Override Authorizations getAuthorizations(); @Override synchronized void setSamplerConfiguration(SamplerConfiguration samplerConfig); @Override synchronized SamplerConfiguration getSamplerConfiguration(); @Override synchronized void clearSamplerConfiguration(); @Override void setBatchTimeout(long timeout, TimeUnit timeUnit); @Override long getBatchTimeout(TimeUnit timeUnit); @Override void setClassLoaderContext(String classLoaderContext); @Override void clearClassLoaderContext(); @Override String getClassLoaderContext(); @Override synchronized void setExecutionHints(Map<String,String> hints); }
ScannerOptions implements ScannerBase { @Override public synchronized void addScanIterator(IteratorSetting si) { checkArgument(si != null, "si is null"); if (serverSideIteratorList.isEmpty()) { serverSideIteratorList = new ArrayList<>(); } for (IterInfo ii : serverSideIteratorList) { if (ii.iterName.equals(si.getName())) { throw new IllegalArgumentException("Iterator name is already in use " + si.getName()); } if (ii.getPriority() == si.getPriority()) { throw new IllegalArgumentException( "Iterator priority is already in use " + si.getPriority()); } } serverSideIteratorList.add(new IterInfo(si.getPriority(), si.getIteratorClass(), si.getName())); if (serverSideIteratorOptions.isEmpty()) { serverSideIteratorOptions = new HashMap<>(); } serverSideIteratorOptions.computeIfAbsent(si.getName(), k -> new HashMap<>()) .putAll(si.getOptions()); } protected  ScannerOptions();  ScannerOptions(ScannerOptions so); @Override synchronized void addScanIterator(IteratorSetting si); @Override synchronized void removeScanIterator(String iteratorName); @Override synchronized void updateScanIteratorOption(String iteratorName, String key, String value); @Override synchronized void fetchColumnFamily(Text col); @Override synchronized void fetchColumn(Text colFam, Text colQual); @Override void fetchColumn(IteratorSetting.Column column); @Override synchronized void clearColumns(); synchronized SortedSet<Column> getFetchedColumns(); @Override synchronized void clearScanIterators(); @Override Iterator<Entry<Key,Value>> iterator(); @Override synchronized void setTimeout(long timeout, TimeUnit timeUnit); @Override synchronized long getTimeout(TimeUnit timeunit); @Override void close(); @Override Authorizations getAuthorizations(); @Override synchronized void setSamplerConfiguration(SamplerConfiguration samplerConfig); @Override synchronized SamplerConfiguration getSamplerConfiguration(); @Override synchronized void clearSamplerConfiguration(); @Override void setBatchTimeout(long timeout, TimeUnit timeUnit); @Override long getBatchTimeout(TimeUnit timeUnit); @Override void setClassLoaderContext(String classLoaderContext); @Override void clearClassLoaderContext(); @Override String getClassLoaderContext(); @Override synchronized void setExecutionHints(Map<String,String> hints);  }