Example usage for java.lang Long valueOf

List of usage examples for java.lang Long valueOf

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static Long valueOf(long l) 

Source Link

Document

Returns a Long instance representing the specified long value.

Usage

From source file:io.mandrel.metrics.MetricsService.java

public Timeserie serie(String name) {
    Timeserie serie = metricsRepository.serie(name);

    LocalDateTime now = LocalDateTime.now();
    LocalDateTime minus4Hours = now.withMinute(0).withSecond(0).withNano(0).minusHours(4);

    LocalDateTime firstTime = CollectionUtils.isNotEmpty(serie) && serie.first() != null
            && serie.first().getTime().isBefore(minus4Hours) ? serie.first().getTime() : minus4Hours;
    LocalDateTime lastTime = now;

    Set<Data> results = LongStream.range(0, Duration.between(firstTime, lastTime).toMinutes())
            .mapToObj(minutes -> firstTime.plusMinutes(minutes)).map(time -> Data.of(time, Long.valueOf(0)))
            .collect(TreeSet::new, TreeSet::add, (left, right) -> {
                left.addAll(right);/*from w w w.j a v  a  2 s  .  co m*/
            });

    Timeserie serieWithBlank = new Timeserie();
    serieWithBlank.addAll(results);
    serieWithBlank.addAll(serie);

    return serieWithBlank;
}

From source file:se.sawano.spring.examples.jsonxmlws.RESTControllerTestIT.java

@Test
public void getUserWithXML() throws Exception {
    RestTemplate restTemplate = createXMLRestTemplate();
    User user = restTemplate.getForObject(new URI(baseUrl + "/123"), User.class);

    assertNotNull(user);//from   w  ww.  j ava2 s . c  o  m
    assertEquals(Long.valueOf(123), user.getId());
}

From source file:com.aliyun.odps.rodps.DataTunnel.UploadWorker.java

public void run() {
    LOG.info("Start to upload threadId=" + this.threadId);
    long blockID = Long.valueOf(threadId);
    try {//from  w  w  w.  j  av a 2  s.  com
        writer = context.getAction().openRecordWriter(blockID);
        midStorage.writeToDt(writer);
        if (this.writer != null) {
            this.writer.close();
        }
        isSuccessful = true;
        LOG.info("upload finish threadId=" + threadId);
    } catch (Exception e) {
        LOG.error(e);
        this.errorMessage = e.getMessage();
    } finally {
        midStorage.close();
    }
}

From source file:com.clustercontrol.platform.selfcheck.DBSizeMonitor.java

/**
 * ???//from ww  w  .j ava2s.  co  m
 */
@Override
public void execute() {
    boolean warn = true;

    if (!HinemosPropertyUtil.getHinemosPropertyBool("selfcheck.monitoring.dbsize", true)) {
        m_log.debug("skip");
        return;
    }

    long sizeThreshold = HinemosPropertyUtil.getHinemosPropertyNum("selfcheck.monitoring.dbsize.threshold",
            Long.valueOf(10240));

    m_log.debug("monitoring database size. (threshold=" + sizeThreshold + ")");
    double dbSize = getDatabaseSize();

    if (dbSize == -1) {
        m_log.info("skipped monitoring database size. (threshold = " + sizeThreshold + " [mbyte])");
        return;
    } else {
        if (dbSize <= sizeThreshold) {
            m_log.debug("database size is low. (size = " + String.format("%.2f", dbSize)
                    + " [mbyte], threshold = " + sizeThreshold + " [mbyte])");
            warn = false;
        }
    }
    if (warn) {
        m_log.info("database size is high. (usage = " + String.format("%.2f", dbSize) + " [mbyte], threshold = "
                + sizeThreshold + " [mbyte])");
    }

    if (!isNotify(subKey, warn)) {
        return;
    }

    String[] msgAttr1 = { String.format("%.2f", dbSize), Long.toString(sizeThreshold) };
    AplLogger.put(PriorityConstant.TYPE_WARNING, PLUGIN_ID, MessageConstant.MESSAGE_SYS_023_SYS_SFC, msgAttr1,
            "usage of database has exceeded its threshold (" + String.format("%.2f", dbSize)
                    + " [mbyte] > threshold " + sizeThreshold + " [mbyte])" + ").");
    return;
}

From source file:ch.ralscha.extdirectspring.bean.ExtDirectStoreResult.java

public ExtDirectStoreResult(Integer total, Collection<T> records, Boolean success) {
    this(total != null ? Long.valueOf(total) : null, records, success, null);
}

From source file:com.appdynamics.extensions.rackspace.stats.LoadBalancerStats.java

private Map<String, Map<String, Long>> getMetricsFromNode(JsonNode serviceResponse) {
    Map<String, Map<String, Long>> instanceStats = new HashMap<String, Map<String, Long>>();
    JsonNode loadBalancersNode = serviceResponse.get("loadBalancers");

    for (JsonNode loadBalancer : loadBalancersNode) {
        Map<String, Long> stats = new HashMap<String, Long>();
        stats.put("Status", Long.valueOf(Status.valueOf(loadBalancer.path("status").asText()).statusInt));
        stats.put("Node Count", loadBalancer.path("nodeCount").asLong());

        instanceStats.put(loadBalancer.path("name").asText(), stats);
    }/* ww w  . ja  v  a2 s.  c  o  m*/
    return instanceStats;
}

From source file:gov.nih.nci.caintegrator.web.action.analysis.geneexpression.GEPlotGenomicQueryBasedActionTest.java

@Override
@Before/*from w ww  . j  a va 2 s . co m*/
public void setUp() throws Exception {
    super.setUp();
    StudySubscription subscription = new StudySubscription();
    subscription.setId(Long.valueOf(1));
    Study study = createFakeStudy();
    subscription.setStudy(study);
    SessionHelper.getInstance().getDisplayableUserWorkspace().setCurrentStudySubscription(subscription);
    ActionContext.getContext().getValueStack().setValue("studySubscription", subscription);
    action = new GEPlotGenomicQueryBasedAction();
    action.setAnalysisService(analysisService);
    action.setWorkspaceService(workspaceService);
    action.setQueryManagementService(queryManagementService);
    setStudySubscription(subscription);
    SessionHelper.getInstance().getDisplayableUserWorkspace().refresh(workspaceService, true);
}

From source file:data.dao.parent.Dao.java

public T getOne(String id) {
    return (T) currentSession().get(getSupportedClass(), Long.valueOf(id));
}

From source file:com.fusesource.examples.persistence.part2.dao.impl.IncidentDAOImpl.java

public Incident getIncident(long id) {
    return (Incident) this.em.find(Incident.class, Long.valueOf(id));
}

From source file:org.lieuofs.etat.biz.GestionEtat.java

/**************************************************/

@Override
public IEtat lire(int numeroOFS) {
    return mapParId.get(Long.valueOf(numeroOFS));
}