/** * By default, put up an Admin and a Client Service. * Set booleans <code>hbase.regionserver.admin.executorService</code> and * <code>hbase.regionserver.client.executorService</code> if you want to enable/disable services. * Default is that both are enabled. * @return immutable list of blocking services and the security info classes that this server * supports */ protected List<BlockingServiceAndInterface> getServices() { boolean admin = getConfiguration().getBoolean(REGIONSERVER_ADMIN_SERVICE_CONFIG, true); boolean client = getConfiguration().getBoolean(REGIONSERVER_CLIENT_SERVICE_CONFIG, true); List<BlockingServiceAndInterface> bssi = new ArrayList<>(); if (client) { bssi.add(new BlockingServiceAndInterface( ClientService.newReflectiveBlockingService(this), ClientService.BlockingInterface.class)); } if (admin) { bssi.add(new BlockingServiceAndInterface( AdminService.newReflectiveBlockingService(this), AdminService.BlockingInterface.class)); } return new org.apache.hbase.thirdparty.com.google.common.collect. ImmutableList.Builder<BlockingServiceAndInterface>().addAll(bssi).build(); }
/** * Returns an immutable list containing the given elements, in order. * * @throws NullPointerException if any of {@code elements} is null */ public static <E> ImmutableList<E> copyOf(Iterator<? extends E> elements) { // We special-case for 0 or 1 elements, but going further is madness. if (!elements.hasNext()) { return of(); } E first = elements.next(); if (!elements.hasNext()) { return of(first); } else { return new ImmutableList.Builder<E>().add(first).addAll(elements).build(); } }