public ThrottleContextCleanupTask() { ScheduledExecutorService executor = Executors.newScheduledThreadPool(1, new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("Throttle Cleanup Task"); return t; } }); String throttleFrequency = ThrottleServiceDataHolder.getInstance().getThrottleProperties().getThrottleFrequency(); if (log.isDebugEnabled()) { log.debug("Throttling Cleanup Task Frequency set to " + throttleFrequency); } executor.scheduleAtFixedRate(new CleanupTask(), Integer.parseInt(throttleFrequency), Integer.parseInt(throttleFrequency), TimeUnit.MILLISECONDS); }
public static ThrottleServiceDataHolder getInstance() { if (thisInstance != null && thisInstance.getThrottleProperties() == null) { thisInstance.setThrottleProperties( ThrottleUtil.loadThrottlePropertiesFromConfigurations()); } return thisInstance; }
public ThrottleWindowReplicator() { throttleProperties = ThrottleServiceDataHolder.getInstance().getThrottleProperties(); replicatorPoolSize = Integer.parseInt(throttleProperties.getWindowReplicatorPoolSize()); if (log.isDebugEnabled()) { log.debug("Throttle window replicator pool size set to " + replicatorPoolSize); } ScheduledExecutorService executor = Executors.newScheduledThreadPool(replicatorPoolSize, new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("Throttle window replicator - " + replicatorCount++); return t; } }); String windowReplicationFrequency = throttleProperties.getWindowReplicatorFrequency(); if (log.isDebugEnabled()) { log.debug("Throttling window replication frequency set to " + windowReplicationFrequency); } for (int i = 0; i < replicatorPoolSize; i++) { executor.scheduleAtFixedRate(new ReplicatorTask(), Integer.parseInt(windowReplicationFrequency), Integer.parseInt(windowReplicationFrequency), TimeUnit.MILLISECONDS); } }
public ThrottleReplicator() { throttleProperties = ThrottleServiceDataHolder.getInstance().getThrottleProperties(); replicatorPoolSize = Integer.parseInt(throttleProperties.getThrottlingPoolSize()); log.debug("Replicator pool size set to " + replicatorPoolSize); ScheduledExecutorService executor = Executors.newScheduledThreadPool(replicatorPoolSize, new ThreadFactory() { @Override public Thread newThread( Runnable r) { Thread t = new Thread(r); t.setName("Throttle Replicator - " + replicatorCount++); return t; } }); String throttleFrequency =throttleProperties.getThrottlingReplicationFrequency(); log.debug("Throttling Frequency set to " + throttleFrequency); keysToReplicate = Integer.parseInt(throttleProperties.getThrottlingKeysToReplicates()); log.debug("Max keys to Replicate " + keysToReplicate); for (int i = 0; i < replicatorPoolSize; i++) { executor.scheduleAtFixedRate(new ReplicatorTask(), Integer.parseInt(throttleFrequency), Integer.parseInt(throttleFrequency), TimeUnit.MILLISECONDS); } }
protected void activate(ComponentContext context) { log.debug("Activating throttle core service component"); if (ThrottleServiceDataHolder.getInstance().getThrottleProperties() == null){ ThrottleServiceDataHolder.getInstance().setThrottleProperties( ThrottleUtil.loadThrottlePropertiesFromConfigurations()); } }
public ThrottleDistributedInstancesCleanupTask() { throttleProperties = ThrottleServiceDataHolder.getInstance().getThrottleProperties(); cleanUpPoolSize = Integer.parseInt(throttleProperties.getThrottleDistributedCleanupPoolSize());