List of usage examples for java.lang Long MAX_VALUE
long MAX_VALUE
To view the source code for java.lang Long MAX_VALUE.
Click Source Link
From source file:org.lendingclub.mercator.docker.SwarmScanner.java
long saveDockerNode(String swarmClusterId, JsonNode n) { String swarmNodeId = n.get("swarmNodeId").asText(); AtomicLong updateTs = new AtomicLong(Long.MAX_VALUE); dockerScanner.getNeoRxClient().execCypher( "merge (n:DockerHost {swarmNodeId:{nodeId}}) set n+={props}, n.updateTs=timestamp() return n", "nodeId", swarmNodeId, "props", n).forEach(actual -> { removeDockerLabels("DockerHost", "swarmNodeId", swarmNodeId, n, actual); updateTs.set(Math.min(updateTs.get(), actual.path("updateTs").asLong(Long.MAX_VALUE))); });/*from w ww . j a v a 2 s . co m*/ logger.info("connecting swarm={} to node={}", swarmClusterId, swarmNodeId); dockerScanner.getNeoRxClient().execCypher( "match (s:DockerSwarm {swarmClusterId:{swarmClusterId}}), (n:DockerHost {swarmNodeId:{nodeId}}) merge (s)-[x:CONTAINS]->(n) set x.updateTs=timestamp()", "swarmClusterId", swarmClusterId, "nodeId", swarmNodeId); return updateTs.get(); }
From source file:org.starfishrespect.myconsumption.android.tasks.SensorValuesUpdater.java
public void refreshDB() { AsyncTask<Void, List, Void> task = new AsyncTask<Void, List, Void>() { @Override//from w w w . j a va 2 s . co m protected Void doInBackground(Void... params) { DatabaseHelper db = SingleInstance.getDatabaseHelper(); RestTemplate template = new RestTemplate(); HttpHeaders httpHeaders = CryptoUtils.createHeadersCurrentUser(); ResponseEntity<List> responseEnt; template.getMessageConverters().add(new MappingJacksonHttpMessageConverter()); try { SensorValuesDao valuesDao = new SensorValuesDao(db); for (SensorData sensor : db.getSensorDao().queryForAll()) { int startTime = (int) (sensor.getLastLocalValue().getTime() / 1000); String url = String.format(SingleInstance.getServerUrl() + "sensors/%s/data?start=%d", sensor.getSensorId(), startTime); Log.d(TAG, url); responseEnt = template.exchange(url, HttpMethod.GET, new HttpEntity<>(httpHeaders), List.class); List<List<Integer>> sensorData = responseEnt.getBody(); List<SensorValue> values = new ArrayList<>(); long last = 0; long first = Long.MAX_VALUE; for (List<Integer> value : sensorData) { values.add(new SensorValue(value.get(0), value.get(1))); if (value.get(0) > last) { last = value.get(0); } if (value.get(0) < first) { first = value.get(0); } } valuesDao.insertSensorValues(sensor.getSensorId(), values); sensor.setLastLocalValue(new Date(last * 1000)); long formerFirst = sensor.getFirstLocalValue().getTime() / 1000; if (formerFirst > first || formerFirst == 0) { sensor.setFirstLocalValue(new Date(first * 1000)); } db.getSensorDao().update(sensor); Log.d(TAG, "Inserted values to " + last); } } catch (SQLException e) { Log.e(TAG, "Error:" + e.toString()); } return null; } @Override protected void onPostExecute(Void aVoid) { if (updateFinishedCallback != null) { updateFinishedCallback.onUpdateFinished(); } } }; task.execute(); }
From source file:com.declum.squzer.example.hbase.table2file.Export.java
/** * Sets up the actual job.//from ww w . j av a 2s. c o m * * @param conf * The current configuration. * @param args * The command line parameters. * @return The newly created job. * @throws IOException * When setting up the job fails. */ public static Job createSubmittableJob(Configuration conf, String[] args) throws IOException { String tableName = args[0]; Path outputDir = new Path(args[1]); Job job = Job.getInstance(conf); job.setJobName(tableName); job.setJobName(NAME + "_" + tableName); job.setJarByClass(Exporter.class); // TODO: Allow passing filter and subset of rows/columns. Scan s = new Scan(); // Optional arguments. int versions = args.length > 2 ? Integer.parseInt(args[2]) : 1; s.setMaxVersions(versions); long startTime = args.length > 3 ? Long.parseLong(args[3]) : 0L; long endTime = args.length > 4 ? Long.parseLong(args[4]) : Long.MAX_VALUE; s.setTimeRange(startTime, endTime); s.setCacheBlocks(false); if (conf.get(TableInputFormat.SCAN_COLUMN_FAMILY) != null) { s.addFamily(Bytes.toBytes(conf.get(TableInputFormat.SCAN_COLUMN_FAMILY))); } LOG.info("verisons=" + versions + ", starttime=" + startTime + ", endtime=" + endTime); TableMapReduceUtil.initTableMapperJob(tableName, s, Exporter.class, null, null, job); // No reducers. Just write straight to output files. job.setNumReduceTasks(0); job.setOutputFormatClass(SequenceFileOutputFormat.class); job.setOutputKeyClass(ImmutableBytesWritable.class); job.setOutputValueClass(Result.class); FileOutputFormat.setOutputPath(job, outputDir); return job; }
From source file:info.magnolia.cms.util.QueryUtil.java
/** * Executes a query, throwing any exceptions that arise as a result. * @deprecated Since 4.5.4 use search methods. */// w ww .j a v a 2s. c om public static Collection<Content> exceptionThrowingQuery(String repository, String statement, String language, String returnItemType, long maxResultSize) throws RepositoryException { Collection<Content> results = new ArrayList<Content>(); if (maxResultSize <= 0) { maxResultSize = Long.MAX_VALUE; } NodeIterator iterator = search(repository, statement, language, returnItemType); long count = 1; while (iterator.hasNext() && count <= maxResultSize) { results.add(ContentUtil.getContent(repository, iterator.nextNode().getPath())); count++; } return results; }
From source file:com.github.rinde.rinsim.examples.core.taxi.TaxiExample.java
/** * Run the example.//from w w w. ja v a 2s .com * @param testing If <code>true</code> enables the test mode. */ public static void run(boolean testing) { run(testing, Long.MAX_VALUE, MAP_FILE, null, null, null); }
From source file:info.archinnov.achilles.it.TestNativeQueries.java
@Test public void should_perform_regular_native_query() throws Exception { //Given/*w ww.j ava 2 s .co m*/ final Long id = RandomUtils.nextLong(0L, Long.MAX_VALUE); scriptExecutor.executeScriptTemplate("SimpleEntity/insert_single_row.cql", ImmutableMap.of("id", id, "table", "simple")); final SimpleStatement statement = new SimpleStatement("SELECT * FROM simple WHERE id = " + id); //When final TypedMap actual = manager.query().nativeQuery(statement).getOne(); assertThat(actual).isNotNull(); assertThat(actual.<String>getTyped("value")).contains("0 AM"); }
From source file:net.myrrix.common.collection.FastIDSetTest.java
@Test public void testReservedValues() { FastIDSet set = new FastIDSet(); try {//from www . j a v a2 s. c om set.add(Long.MIN_VALUE); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException iae) { // good } assertFalse(set.contains(Long.MIN_VALUE)); try { set.add(Long.MAX_VALUE); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException iae) { // good } assertFalse(set.contains(Long.MAX_VALUE)); }
From source file:com.exalead.io.failover.HostState.java
/** * Return the connection that was checked least recently. * Returns null if there is no currently free connection. * Note that this does not remove this connection from the freelist. You must * call removeFreeConnection afterwards. *//*from w w w .j av a 2s. co m*/ MonitoredConnection getOldestCheckedConnection() { MonitoredConnection c = null; long oldestDate = Long.MAX_VALUE; for (MonitoredConnection free : freeConnections) { if (free.lastMonitoringTime <= oldestDate) { oldestDate = free.lastMonitoringTime; c = free; } } return c; }
From source file:info.archinnov.achilles.test.integration.tests.NamingStrategyIT.java
@Test public void should_apply_case_sensitive_naming() throws Exception { //Given//from ww w . ja v a2 s . c o m Long partitionKey = RandomUtils.nextLong(0, Long.MAX_VALUE); final ClusteredEntityWithNamingStrategy first = new ClusteredEntityWithNamingStrategy(partitionKey, "1", "fn1", "ln1"); final ClusteredEntityWithNamingStrategy second = new ClusteredEntityWithNamingStrategy(partitionKey, "2", "fn2", "ln2"); manager.insert(first); manager.insert(second); //When final List<Row> rows = session .execute("SELECT * FROM achilles_test.\"caseSensitiveNaming\" WHERE \"partitionKey\" = ? LIMIT 10", partitionKey) .all(); //Then assertThat(rows).hasSize(2); final Row firstRow = rows.get(0); final Row secondRow = rows.get(1); assertThat(firstRow.getString("clustering")).isEqualTo("1"); assertThat(firstRow.getString("firstName")).isEqualTo("fn1"); assertThat(firstRow.getString("last_name")).isEqualTo("ln1"); assertThat(secondRow.getString("clustering")).isEqualTo("2"); assertThat(secondRow.getString("firstName")).isEqualTo("fn2"); assertThat(secondRow.getString("last_name")).isEqualTo("ln2"); }
From source file:com.jxt.web.dao.hbase.HbaseAgentInfoDao.java
private Scan createScanForInitialAgentInfo(String agentId) { Scan scan = new Scan(); byte[] agentIdBytes = Bytes.toBytes(agentId); byte[] reverseStartKey = RowKeyUtils.concatFixedByteAndLong(agentIdBytes, HBaseTables.AGENT_NAME_MAX_LEN, Long.MAX_VALUE); scan.setStartRow(reverseStartKey);//from w w w . j ava2 s . c o m scan.setReversed(true); scan.setMaxVersions(1); scan.setCaching(SCANNER_CACHING); return scan; }