Example usage for java.lang Long MAX_VALUE

List of usage examples for java.lang Long MAX_VALUE

Introduction

In this page you can find the example usage for java.lang Long MAX_VALUE.

Prototype

long MAX_VALUE

To view the source code for java.lang Long MAX_VALUE.

Click Source Link

Document

A constant holding the maximum value a long can have, 263-1.

Usage

From source file:info.archinnov.achilles.it.TestViewSensorByType.java

@Test
public void should_select_by_slice() throws Exception {
    //Given//from   w w  w  .  j  av  a 2  s. c o m
    final long id = RandomUtils.nextLong(0, Long.MAX_VALUE);
    sensorManager.crud().insert(new EntitySensor(id, 20160215L, SensorType.TEMPERATURE, 18.34d)).execute();
    sensorManager.crud().insert(new EntitySensor(id, 20160216L, SensorType.PRESSURE, 1.05d)).execute();
    sensorManager.crud().insert(new EntitySensor(id, 20160217L, SensorType.TEMPERATURE, 21.5d)).execute();
    sensorManager.crud().insert(new EntitySensor(id, 20160218L, SensorType.PRESSURE, 1.04d)).execute();
    sensorManager.crud().insert(new EntitySensor(id, 20160219L, SensorType.TEMPERATURE, 17.8d)).execute();
    sensorManager.crud().insert(new EntitySensor(id, 20160220L, SensorType.PRESSURE, 1.03d)).execute();

    //When
    final List<ViewSensorByType> found = viewSensorManager.dsl().select().value().fromBaseTable().where()
            .type_Eq(SensorType.TEMPERATURE).sensorId_Eq(id).date_Gte_And_Lte(20160215L, 20160218L).getList();

    //Then
    assertThat(found).hasSize(2);
    assertThat(found.get(0).getValue()).isEqualTo(18.34d);
    assertThat(found.get(1).getValue()).isEqualTo(21.5d);
}

From source file:JVMRandom.java

/**
 * <p>Returns the next pseudorandom, uniformly distributed long value
 * from the Math.random() sequence.</p>
 * @return the random long//w  w  w  . j  a va2s . c o m
 */
public long nextLong() {
    // possible loss of precision?
    return nextLong(Long.MAX_VALUE);
}

From source file:com.metamx.emitter.core.EmitterTest.java

private HttpPostEmitter manualFlushEmitterWithBasicAuthenticationAndNewlineSeparating(String authentication) {
    HttpPostEmitter emitter = new HttpPostEmitter(new HttpEmitterConfig(Long.MAX_VALUE, Integer.MAX_VALUE,
            TARGET_URL, authentication, BatchingStrategy.NEWLINES, 1024 * 1024, 100 * 1024 * 1024), httpClient,
            jsonMapper);/*from   w w w.  ja  v  a2s . co m*/
    emitter.start();
    return emitter;
}

From source file:org.lendingclub.mercator.solarwinds.SolarwindsScanner.java

public void getNodeInformation() {
    try {//from  www  .j ava 2 s  .  com
        ObjectNode response = querySolarwinds("SELECT Nodes.NodeID, Nodes.SysName, Nodes.Caption, "
                + "Nodes.Description, Nodes.IOSVersion, Nodes.CustomProperties.SerialNumber, Nodes.MachineType, "
                + "Nodes.Vendor, Nodes.IPAddress, Nodes.SysObjectID, Nodes.DNS, Nodes.ObjectSubType, "
                + "Nodes.Status, Nodes.StatusDescription, Nodes.CustomProperties.Department, Nodes.Location,"
                + " Nodes.CustomProperties.City FROM Orion.Nodes ORDER BY Nodes.SysName");

        AtomicLong earlistUpdate = new AtomicLong(Long.MAX_VALUE);
        AtomicBoolean error = new AtomicBoolean(false);
        response.path("results").forEach(v -> {
            try {
                //solarwindsID is the hashedURL+nodeID
                getProjector().getNeoRxClient().execCypher(
                        "merge(a: SolarwindsNode {solarwindsID:{solarwindsID}}) set a+={props}, a.updateTs=timestamp() return a",
                        "solarwindsID", solarwindsScannerBuilder.hashURL + v.path("NodeID"), "props",
                        flattenNode(v)).blockingFirst(MissingNode.getInstance());
            } catch (Exception e) {
                logger.warn("problem", e);
                error.set(true);
            }

        });
        if (error.get() == false) {
            getNeoRxClient().execCypher(
                    "match(a: SolarwindsNode) where a.solarwindsID={solarwindsID} and  a.updateTs<{cutoff} detach delete a",
                    "solarwindsID", solarwindsScannerBuilder.hashURL, "cutoff", earlistUpdate.get());
        }
    } catch (Exception e) {
        logger.info(e.toString());
    }
}

From source file:co.cask.cdap.data2.increment.hbase11.IncrementSummingScanner.java

IncrementSummingScanner(Region region, int batchSize, InternalScanner internalScanner, ScanType scanType) {
    this(region, batchSize, internalScanner, scanType, Long.MAX_VALUE, -1);
}

From source file:com.sematext.hbase.hut.RollbackUpdatesMrJob.java

/**
 * Sets up the actual job.//from  www.  ja v a  2 s  .c  om
 *
 * @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];

    conf.set("mapred.map.tasks.speculative.execution", "false");

    Job job = new Job(conf, NAME + "_" + tableName);
    job.setJobName(NAME + "_" + tableName);
    job.setJarByClass(RollbackUpdatesMapper.class);
    // TODO: Allow passing filter and subset of rows/columns.
    Scan s = new Scan();
    // Optional arguments.
    long startTime = args.length > 1 ? Long.parseLong(args[1]) : 0L;
    long endTime = args.length > 2 ? Long.parseLong(args[2]) : Long.MAX_VALUE;

    // TODO: consider using scan.setTimeRange() for limiting scanned data range. It may
    //       not be good way to do if tss are artificial in HutPuts though
    //    s.setTimeRange(startTime, endTime);
    job.getConfiguration().set(RollbackUpdatesMapper.HUT_ROLLBACK_UPDATE_MIN_TIME_ATTR,
            String.valueOf(startTime));
    job.getConfiguration().set(RollbackUpdatesMapper.HUT_ROLLBACK_UPDATE_MAX_TIME_ATTR,
            String.valueOf(endTime));

    s.setFilter(new HutWriteTimeRowsFilter(endTime, startTime));

    s.setCacheBlocks(false);
    // TODO: allow user change using job params
    s.setCaching(512);
    s.setCacheBlocks(false);

    LOG.info("Using scan: " + s.toString());

    // TODO: allow better limiting of data to be fetched
    if (conf.get(TableInputFormat.SCAN_COLUMN_FAMILY) != null) {
        s.addFamily(Bytes.toBytes(conf.get(TableInputFormat.SCAN_COLUMN_FAMILY)));
    }

    LOG.info("starttime (inclusive): " + startTime + " (" + new Date(startTime) + ")"
            + ", endtime (inclusive): " + endTime + " (" + new Date(endTime) + ")");

    TableMapReduceUtil.initTableMapperJob(tableName, s, RollbackUpdatesMapper.class, null, null, job);
    TableMapReduceUtil.initTableReducerJob(tableName, null, job);
    // No reducers.  Just write straight to output files.
    job.setNumReduceTasks(0);
    return job;
}

From source file:info.magnolia.cms.util.QueryUtil.java

/**
 * @deprecated Since 4.5.4 use search methods.
 *//*w  ww .ja  va2 s  .c  o m*/
public static Collection<Content> query(String repository, String statement, String language,
        String returnItemType) {
    return query(repository, statement, language, returnItemType, Long.MAX_VALUE);
}

From source file:com.optimizely.ab.event.AsyncEventHandler.java

@VisibleForTesting
public AsyncEventHandler(OptimizelyHttpClient httpClient, ExecutorService workerExecutor) {
    this.httpClient = httpClient;
    this.workerExecutor = workerExecutor;
    this.closeTimeout = Long.MAX_VALUE;
    this.closeTimeoutUnit = TimeUnit.MILLISECONDS;
}

From source file:nl.jk_5.nailed.plugin.nmm.NmmMappack.java

@Override
public void prepareWorld(File destination, SettableFuture<Void> future) {
    HttpClient httpClient = HttpClientBuilder.create().build();
    try {/*from  www  .  j  a v a 2 s .c  om*/
        String mappack = this.path.split("/", 2)[1];
        HttpGet request = new HttpGet("http://nmm.jk-5.nl/" + this.path + "/versions.json");
        HttpResponse response = httpClient.execute(request);
        MappackInfo list = NmmPlugin.gson.fromJson(EntityUtils.toString(response.getEntity(), "UTF-8"),
                MappackInfo.class);

        HttpGet request2 = new HttpGet(
                "http://nmm.jk-5.nl/" + this.path + "/" + mappack + "-" + list.latest + ".zip");
        HttpEntity response2 = httpClient.execute(request2).getEntity();
        if (response2 != null) {
            File mappackZip = new File(destination, "mappack.zip");
            try (ReadableByteChannel source = Channels.newChannel(response2.getContent());
                    FileChannel out = FileChannel.open(mappackZip.toPath(), StandardOpenOption.CREATE_NEW,
                            StandardOpenOption.WRITE)) {
                out.transferFrom(source, 0, Long.MAX_VALUE);
            }
            ZipUtils.extract(mappackZip, destination);
            mappackZip.delete();
            this.dir = destination;
            File dataDir = new File(destination, ".data");
            dataDir.mkdir();
            File metadataLocation = new File(dataDir, "game.xml");
            new File(destination, "game.xml").renameTo(metadataLocation);
            new File(destination, "scripts").renameTo(new File(dataDir, "scripts"));
            File worldsDir = new File(destination, "worlds");
            for (File f : worldsDir.listFiles()) {
                f.renameTo(new File(destination, f.getName()));
            }
            worldsDir.delete();
            //metadata = XmlMappackMetadata.fromFile(metadataLocation);
            future.set(null);
        } else {
            future.setException(new RuntimeException(
                    "Got an empty response while downloading mappack " + this.path + " from nmm.jk-5.nl"));
        }
    } catch (Exception e) {
        future.setException(
                new RuntimeException("Was not able to download mappack " + this.path + " from nmm.jk-5.nl", e));
    }
}

From source file:com.parivero.swagger.demo.controller.PersonaController.java

@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)/*from  w  w w.  j av a  2 s. c  om*/
@ApiOperation(value = "Alta de Persona")
@ApiErrors(errors = { @ApiError(code = 400, reason = "request invalido") })
@ApiModel(type = Persona.class)
public @ResponseBody Persona alta(
        @ApiParam(value = "recurso a crear sin id", required = true) @RequestBody Persona persona) {
    if (persona.getId() != null) {
        throw new IllegalArgumentException();
    }
    persona.setId(Long.MAX_VALUE);
    persona.setNombre(persona.getNombre() + "- Modificado");
    return persona;
}