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:com.flexive.faces.messages.FxFacesMessages.java

/**
 * Generates a (server) unique message id.
 *
 * @return a (server) unique message id.
 *//*from w  w w .j  av a2 s. c o  m*/
private synchronized long generateId() {
    long result = nextId++;
    if (nextId == Long.MAX_VALUE) {
        nextId = 0;
    }
    return result;
}

From source file:info.archinnov.achilles.it.bugs.TestEntityWithNestedUdtIT.java

@Test
public void should_insert_nested_udt() throws Exception {
    //Given//from  ww  w.j a  v  a  2s. c om
    final Cluster cluster = CassandraEmbeddedServerBuilder.builder().useUnsafeCassandraDeamon()
            .withScript("functions/createFunctions.cql").buildNativeCluster();

    final ManagerFactory managerFactory = ManagerFactoryBuilder.builder(cluster)
            .withManagedEntityClasses(EntityWithNestedUDT.class).doForceSchemaCreation(true)
            .withDefaultKeyspaceName(DEFAULT_CASSANDRA_EMBEDDED_KEYSPACE_NAME).build();

    final EntityWithNestedUDT_Manager manager = managerFactory.forEntityWithNestedUDT();

    //When
    final Long id = RandomUtils.nextLong(0, Long.MAX_VALUE);
    final EntityWithNestedUDT entity = new EntityWithNestedUDT();
    final UDTWithNoKeyspace udtWithNoKeySpace = new UDTWithNoKeyspace();
    udtWithNoKeySpace.setId(id);
    udtWithNoKeySpace.setValue("udt_with_no_keyspace");
    final UDTWithNestedUDT udtWithNestedUDT = new UDTWithNestedUDT();
    udtWithNestedUDT.setValue("value");
    udtWithNestedUDT.setNestedUDT(udtWithNoKeySpace);
    udtWithNestedUDT.setUdtList(Arrays.asList(udtWithNoKeySpace));
    udtWithNestedUDT.setTupleWithUDT(new Tuple2<>(1, udtWithNoKeySpace));
    entity.setId(id);
    entity.setUdt(udtWithNoKeySpace);
    entity.setComplexUDT(udtWithNestedUDT);

    manager.crud().insert(entity).execute();

    //Then
    final EntityWithNestedUDT found = manager.crud().findById(id).get();
    assertThat(found).isNotNull();
    assertThat(found.getUdt()).isEqualTo(udtWithNoKeySpace);
    assertThat(found.getComplexUDT()).isEqualTo(udtWithNestedUDT);
}

From source file:goraci.Walker.java

public int run(String[] args) throws IOException {
    Options options = new Options();
    options.addOption("n", "num", true, "number of queries");

    GnuParser parser = new GnuParser();
    CommandLine cmd = null;//from   ww  w.  j  a va2s  . c o m
    try {
        cmd = parser.parse(options, args);
        if (cmd.getArgs().length != 0) {
            throw new ParseException("Command takes no arguments");
        }
    } catch (ParseException e) {
        System.err.println("Failed to parse command line " + e.getMessage());
        System.err.println();
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(getClass().getSimpleName(), options);
        System.exit(-1);
    }

    long maxQueries = Long.MAX_VALUE;
    if (cmd.hasOption('n')) {
        maxQueries = Long.parseLong(cmd.getOptionValue("n"));
    }

    DataStore<Long, CINode> store = DataStoreFactory.getDataStore(Long.class, CINode.class,
            new Configuration());

    Random rand = new Random();

    long numQueries = 0;

    while (numQueries < maxQueries) {
        CINode node = findStartNode(rand, store);
        numQueries++;
        while (node != null && node.getPrev() >= 0 && numQueries < maxQueries) {
            long prev = node.getPrev();

            long t1 = System.currentTimeMillis();
            node = store.get(prev, PREV_FIELD);
            long t2 = System.currentTimeMillis();
            System.out.printf("CQ %d %016x \n", t2 - t1, prev);
            numQueries++;

            t1 = System.currentTimeMillis();
            node = store.get(prev, PREV_FIELD);
            t2 = System.currentTimeMillis();
            System.out.printf("HQ %d %016x \n", t2 - t1, prev);
            numQueries++;

        }
    }

    store.close();
    return 0;
}

From source file:org.elasticsearch.xpack.qa.sql.cli.FetchSizeTestCase.java

public void testInvalidFetchSize() throws IOException {
    assertEquals(ErrorsTestCase.START + "Invalid fetch size [[3;33;22mcat" + ErrorsTestCase.END,
            command("fetch size = cat"));
    assertEquals(ErrorsTestCase.START + "Invalid fetch size [[3;33;22m0[23;31;1m]. Must be > 0.[0m",
            command("fetch size = 0"));
    assertEquals(ErrorsTestCase.START + "Invalid fetch size [[3;33;22m-1231[23;31;1m]. Must be > 0.[0m",
            command("fetch size = -1231"));
    assertEquals(ErrorsTestCase.START + "Invalid fetch size [[3;33;22m" + Long.MAX_VALUE + ErrorsTestCase.END,
            command("fetch size = " + Long.MAX_VALUE));
}

From source file:net.sf.jasperreports.data.cache.LongArrayStore.java

private void reset() {
    this.count = 0;

    this.min = Long.MAX_VALUE;
    this.max = Long.MIN_VALUE;

    this.runLengthStore.reset();
}

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

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

From source file:com.devicehive.rpcclient.RpcClientActionTest.java

@Test
public void testCommandSearchAction() throws Exception {
    CommandSearchRequest searchRequest = new CommandSearchRequest();
    searchRequest.setId(Long.MAX_VALUE); // nonexistent id
    searchRequest.setGuid(UUID.randomUUID().toString()); // random guid

    Request request = Request.newBuilder().withPartitionKey(searchRequest.getGuid()).withBody(searchRequest)
            .build();/*from  w  w  w .  j ava  2 s  . c o m*/
    CompletableFuture<Response> future = new CompletableFuture<>();
    client.call(request, future::complete);

    Response response = future.get(10, TimeUnit.SECONDS);
    CommandSearchResponse responseBody = (CommandSearchResponse) response.getBody();
    assertTrue(responseBody.getCommands().isEmpty());
}

From source file:hu.sztaki.lpds.storage.net.bes.FileUploadServlet.java

/** 
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
 * @param request servlet request//w  w  w. j ava  2 s.  com
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    response.setContentType("text/html;charset=UTF-8");
    ServletRequestContext servletRequestContext = new ServletRequestContext(request);
    boolean isMultipart = ServletFileUpload.isMultipartContent(servletRequestContext);
    if (isMultipart) {
        File newFile;
        FileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload servletFileUpload = new ServletFileUpload(factory);
        servletFileUpload.setSizeMax(Long.MAX_VALUE);
        try {
            List<FileItem> listFileItems = servletFileUpload.parseRequest(request);
            String path = PropertyLoader.getInstance().getProperty("portal.prefix.dir") + "storage/"
                    + request.getParameter("path") + "/";
            String link = request.getParameter("link");
            File f = new File(path);
            f.mkdirs();

            String[] pathData = request.getParameter("path").split("/");
            for (FileItem t : listFileItems) {
                if (!t.isFormField()) {
                    newFile = new File(path + "/" + t.getFieldName());
                    t.write(newFile);
                    QuotaService.getInstance().addPlussRtIDQuotaSize(pathData[0], pathData[1], pathData[2],
                            pathData[5], newFile.length());
                    //                        QuotaService.getInstance().get(pathData[0], pathData[1]).g
                    //                        System.out.println("STORAGE:"+newFile.getAbsolutePath());
                    if (link != null)
                        if (!t.getFieldName().equals(link))
                            FileUtils.getInstance().createLink(path, t.getFieldName(),
                                    path + link + getGeneratorPostFix(t.getFieldName()));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

From source file:org.sonews.daemon.async.AsynchronousNNTPDaemon.java

@Override
public void run() {
    try {//w ww. j  ava  2 s . co  m
        final int workerThreads = Math.max(4, 2 * Runtime.getRuntime().availableProcessors());
        channelGroup = AsynchronousChannelGroup.withFixedThreadPool(workerThreads,
                Executors.defaultThreadFactory());

        serverSocketChannel = AsynchronousServerSocketChannel.open(channelGroup);
        serverSocketChannel.bind(new InetSocketAddress(port));

        serverSocketChannel.accept(null, new AcceptCompletionHandler(serverSocketChannel));

        channelGroup.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
    } catch (IOException | InterruptedException ex) {
        Log.get().log(Level.SEVERE, ex.getLocalizedMessage(), ex);
    }
}