/** * Register an un-named dependency provider * * @param providers the providers to register */ public static void register(DependencyProvider... providers) { for (DependencyProvider o : providers) { Injector.providers.add(o); } }
/** * Register an un-named dependency provider * * @param providers the providers to register */ public static void register(DependencyProvider... providers) { for (DependencyProvider o : providers) { Injector.providers.add(o); } }
public void scheduleHintDelivery(final InetAddress to, final boolean precompact) { // We should not deliver hints to the same host in 2 different threads if (!queuedDeliveries.add(to)) return; logger.debug("Scheduling delivery of Hints to {}", to); hintDeliveryExecutor.execute(new Runnable() { public void run() { try { // If it's an individual node hint replay (triggered by Gossip or via JMX), and not the global scheduled replay // (every 10 minutes), force a major compaction to get rid of the tombstones and expired hints. if (precompact) compact(); deliverHintsToEndpoint(to); } finally { queuedDeliveries.remove(to); } } }); }
/** * Add a new pool to the partition. Checks to see if the pool already * existed. If so then there is no need to refresh the pool. * @param pool * @return True if anything changed */ public synchronized boolean addPool(HostConnectionPool<CL> pool) { if (this.pools.add(pool)) { refresh(); return true; } return false; }
/** * Add a new pool to the partition. Checks to see if the pool already * existed. If so then there is no need to refresh the pool. * @param pool * @return True if anything changed */ public synchronized boolean addPool(HostConnectionPool<CL> pool) { if (this.pools.add(pool)) { refresh(); return true; } return false; }
/** * Sets all pools for this partition. Removes old partitions and adds new * one. * * @param newPools */ public synchronized boolean setPools(Collection<HostConnectionPool<CL>> newPools) { Set<HostConnectionPool<CL>> toRemove = Sets.newHashSet(this.pools); // Add new pools not previously seen boolean didChange = false; for (HostConnectionPool<CL> pool : newPools) { if (this.pools.add(pool)) didChange = true; toRemove.remove(pool); } // Remove pools for hosts that no longer exist for (HostConnectionPool<CL> pool : toRemove) { if (this.pools.remove(pool)) didChange = true; } if (didChange) refresh(); return didChange; }
/** * Sets all pools for this partition. Removes old partitions and adds new * one. * * @param newPools */ public synchronized boolean setPools(Collection<HostConnectionPool<CL>> newPools) { Set<HostConnectionPool<CL>> toRemove = Sets.newHashSet(this.pools); // Add new pools not previously seen boolean didChange = false; for (HostConnectionPool<CL> pool : newPools) { if (this.pools.add(pool)) didChange = true; toRemove.remove(pool); } // Remove pools for hosts that no longer exist for (HostConnectionPool<CL> pool : toRemove) { if (this.pools.remove(pool)) didChange = true; } if (didChange) refresh(); return didChange; }