com.google.common.util.concurrent.Striped Java Examples

The following examples show how to use com.google.common.util.concurrent.Striped. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FeedRefreshUpdater.java    From commafeed with Apache License 2.0 6 votes vote down vote up
@Inject
public FeedRefreshUpdater(SessionFactory sessionFactory, FeedUpdateService feedUpdateService, PubSubService pubSubService,
		FeedQueues queues, CommaFeedConfiguration config, MetricRegistry metrics, FeedSubscriptionDAO feedSubscriptionDAO,
		CacheService cache) {
	this.sessionFactory = sessionFactory;
	this.feedUpdateService = feedUpdateService;
	this.pubSubService = pubSubService;
	this.queues = queues;
	this.config = config;
	this.feedSubscriptionDAO = feedSubscriptionDAO;
	this.cache = cache;

	ApplicationSettings settings = config.getApplicationSettings();
	int threads = Math.max(settings.getDatabaseUpdateThreads(), 1);
	pool = new FeedRefreshExecutor("feed-refresh-updater", threads, Math.min(50 * threads, 1000), metrics);
	locks = Striped.lazyWeakLock(threads * 100000);

	entryCacheMiss = metrics.meter(MetricRegistry.name(getClass(), "entryCacheMiss"));
	entryCacheHit = metrics.meter(MetricRegistry.name(getClass(), "entryCacheHit"));
	feedUpdated = metrics.meter(MetricRegistry.name(getClass(), "feedUpdated"));
	entryInserted = metrics.meter(MetricRegistry.name(getClass(), "entryInserted"));
}
 
Example #2
Source File: TopicTreeImpl.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Inject
public TopicTreeImpl(@NotNull final MetricsHolder metricsHolder) {

    this.subscriptionCounter = metricsHolder.getSubscriptionCounter();
    this.mapCreationThreshold = TOPIC_TREE_MAP_CREATION_THRESHOLD.get();

    segmentLocks = Striped.readWriteLock(64);
}
 
Example #3
Source File: HelixRetriggeringJobCallable.java    From incubator-gobblin with Apache License 2.0 5 votes vote down vote up
public HelixRetriggeringJobCallable(
    GobblinHelixJobScheduler jobScheduler,
    MutableJobCatalog jobCatalog,
    Properties sysProps,
    Properties jobProps,
    JobListener jobListener,
    GobblinHelixPlanningJobLauncherMetrics planningJobLauncherMetrics,
    GobblinHelixMetrics helixMetrics,
    Path appWorkDir,
    HelixManager jobHelixManager,
    Optional<HelixManager> taskDriverHelixManager,
    HelixJobsMapping jobsMapping,
    Striped<Lock> locks) {
  this.jobScheduler = jobScheduler;
  this.jobCatalog = jobCatalog;
  this.sysProps = sysProps;
  this.jobProps = jobProps;
  this.jobListener = jobListener;
  this.planningJobLauncherMetrics = planningJobLauncherMetrics;
  this.helixMetrics = helixMetrics;
  this.appWorkDir = appWorkDir;
  this.jobHelixManager = jobHelixManager;
  this.taskDriverHelixManager = taskDriverHelixManager;
  this.isDistributeJobEnabled = isDistributeJobEnabled();
  this.jobUri = jobProps.getProperty(GobblinClusterConfigurationKeys.JOB_SPEC_URI);
  this.jobsMapping = jobsMapping;
  this.locks = locks;
}
 
Example #4
Source File: TxVersionedCache.java    From kareldb with Apache License 2.0 4 votes vote down vote up
public TxVersionedCache(VersionedCache cache, boolean conflictFree) {
    this.cache = cache;
    this.conflictFree = conflictFree;
    this.snapshotFilter = new SnapshotFilterImpl(cache);
    this.striped = Striped.readWriteLock(128);
}
 
Example #5
Source File: MessageIDPools.java    From hivemq-community-edition with Apache License 2.0 4 votes vote down vote up
MessageIDPools() {
    //Do not instantiate manually
    lock = Striped.readWriteLock(InternalConfigurations.MESSAGE_ID_PRODUCER_LOCK_SIZE.get());
}
 
Example #6
Source File: KeyLock.java    From hugegraph-common with Apache License 2.0 4 votes vote down vote up
public KeyLock(int size) {
    this.locks = Striped.lock(size);
}
 
Example #7
Source File: Caches.java    From kcache with Apache License 2.0 4 votes vote down vote up
ConcurrentCache(Cache<K, V> m) {
    this.m = Objects.requireNonNull(m);
    striped = Striped.readWriteLock(128);
}
 
Example #8
Source File: Caches.java    From kcache with Apache License 2.0 4 votes vote down vote up
ConcurrentCache(Cache<K, V> m, Striped<ReadWriteLock> striped) {
    this.m = m;
    this.striped = striped;
}
 
Example #9
Source File: Caches.java    From kcache with Apache License 2.0 4 votes vote down vote up
ConcurrentCollection(Collection<E> c, Striped<ReadWriteLock> striped) {
    this.c = Objects.requireNonNull(c);
    this.striped = Objects.requireNonNull(striped);
}
 
Example #10
Source File: Caches.java    From kcache with Apache License 2.0 4 votes vote down vote up
ConcurrentSet(Set<E> s, Striped<ReadWriteLock> striped) {
    super(s, striped);
}
 
Example #11
Source File: StripedLocks.java    From che with Eclipse Public License 2.0 4 votes vote down vote up
public StripedLocks(int stripesCount) {
  striped = Striped.readWriteLock(stripesCount);
}
 
Example #12
Source File: DefaultBrokerCache.java    From incubator-gobblin with Apache License 2.0 4 votes vote down vote up
public DefaultBrokerCache() {
  this.sharedResourceCache = CacheBuilder.newBuilder().build();
  this.autoScopeCache = CacheBuilder.newBuilder().build();
  this.invalidationLock = Striped.lazyWeakLock(20);
}
 
Example #13
Source File: StripedKeyedLocker.java    From bazel with Apache License 2.0 4 votes vote down vote up
public StripedKeyedLocker(int stripes) {
  locks = Striped.readWriteLock(stripes);
}
 
Example #14
Source File: StripedLock.java    From tutorials with MIT License 4 votes vote down vote up
public StripedLock(int buckets) {
    stripedLock = Striped.lock(buckets);
}