Java Code Examples for java.util.concurrent.atomic.LongAdder#longValue()
The following examples show how to use
java.util.concurrent.atomic.LongAdder#longValue() .
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: StandAloneLimiter.java From neural with MIT License | 6 votes |
@Override protected Acquire tryAcquireRequest() { if (cache == null) { return Acquire.SUCCESS; } try { LongAdder times = cache.get(System.currentTimeMillis() / 1000, LongAdder::new); if (limiterConfig.getRatePermit() > times.longValue()) { return Acquire.SUCCESS; } } catch (Exception e) { log.error("The try acquire memory rate limiter is exception", e); return Acquire.EXCEPTION; } return Acquire.FAILURE; }
Example 2
Source File: EffectiveRibInWriter.java From bgpcep with Eclipse Public License 1.0 | 5 votes |
@Override public long getPrefixedInstalledCount(final TablesKey tablesKey) { final LongAdder counter = this.prefixesInstalled.get(tablesKey); if (counter == null) { return 0; } return counter.longValue(); }
Example 3
Source File: EffectiveRibInWriter.java From bgpcep with Eclipse Public License 1.0 | 5 votes |
@Override public long getPrefixedReceivedCount(final TablesKey tablesKey) { final LongAdder counter = this.prefixesReceived.get(tablesKey); if (counter == null) { return 0; } return counter.longValue(); }
Example 4
Source File: Serial.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 5
Source File: Serial.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 6
Source File: Serial.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 7
Source File: Serial.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 8
Source File: Serial.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 9
Source File: Serial.java From hottub with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 10
Source File: Serial.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 11
Source File: Serial.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 12
Source File: Serial.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 13
Source File: Serial.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 14
Source File: Serial.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 15
Source File: Serial.java From native-obfuscator with GNU General Public License v3.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 16
Source File: Serial.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 17
Source File: Serial.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
static void testLongAdder() { LongAdder a = new LongAdder(); a.add(45); LongAdder result = echo(a); if (result.longValue() != a.longValue()) throw new RuntimeException("Unexpected longValue"); checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy"); }
Example 18
Source File: MonitorPlugin.java From smart-socket with Apache License 2.0 | 4 votes |
private long getAndReset(LongAdder longAdder) { long result = longAdder.longValue(); longAdder.add(-result); return result; }
Example 19
Source File: RegionsMerger.java From hbase-operator-tools with Apache License 2.0 | 4 votes |
public void mergeRegions(String tblName, int targetRegions) throws Exception { TableName table = TableName.valueOf(tblName); Path tableDir = getTablePath(table); try(Connection conn = ConnectionFactory.createConnection(conf)) { Admin admin = conn.getAdmin(); LongAdder counter = new LongAdder(); LongAdder lastTimeProgessed = new LongAdder(); //need to get all regions for the table, regardless of region state List<RegionInfo> regions = admin.getRegions(table); Map<Future, Pair<RegionInfo, RegionInfo>> regionsMerging = new ConcurrentHashMap<>(); long roundsNoProgress = 0; while (regions.size() > targetRegions) { LOG.info("Iteration: {}", counter); RegionInfo previous = null; int regionSize = regions.size(); LOG.info("Attempting to merge {} regions to reach the target {} ...", regionSize, targetRegions); //to request merge, regions must be OPEN, though regions = getOpenRegions(conn, table); for (RegionInfo current : regions) { if (!current.isSplit()) { if (previous != null && canMerge(tableDir, previous, current, regionsMerging.values())) { Future f = admin.mergeRegionsAsync(current.getEncodedNameAsBytes(), previous.getEncodedNameAsBytes(), true); Pair<RegionInfo, RegionInfo> regionPair = new Pair<>(previous, current); regionsMerging.put(f,regionPair); previous = null; if ((regionSize - regionsMerging.size()) <= targetRegions) { break; } } else { previous = current; } } else{ LOG.debug("Skipping split region: {}", current.getEncodedName()); } } counter.increment(); LOG.info("Sleeping for {} seconds before next iteration...", (sleepBetweenCycles/1000)); Thread.sleep(sleepBetweenCycles); regionsMerging.forEach((f, currentPair)-> { if (f.isDone()) { LOG.info("Merged regions {} and {} together.", currentPair.getFirst().getEncodedName(), currentPair.getSecond().getEncodedName()); regionsMerging.remove(f); lastTimeProgessed.reset(); lastTimeProgessed.add(counter.longValue()); } else { LOG.warn("Merge of regions {} and {} isn't completed yet.", currentPair.getFirst(), currentPair.getSecond()); } }); roundsNoProgress = counter.longValue() - lastTimeProgessed.longValue(); if(roundsNoProgress == this.maxRoundsStuck){ LOG.warn("Reached {} iterations without progressing with new merges. Aborting...", roundsNoProgress); break; } //again, get all regions, regardless of the state, // in order to avoid breaking the loop prematurely regions = admin.getRegions(table); } } }
Example 20
Source File: DefaultDeviceSessionManager.java From jetlinks-community with Apache License 2.0 | 4 votes |
@Override public long getCurrentSession(Transport transport) { LongAdder counter = transportCounter.get(transport.getId()); return counter == null ? 0 : counter.longValue(); }