/** * @summary get the start time of the master in milliseconds * @return the response object * @deprecated since version 1.4 and will be removed in version 2.0 * @see #getInfo(Boolean) */ @GET @Path(GET_START_TIME_MS) @ReturnType("java.lang.Long") @Deprecated public Response getStartTimeMs() { return RestUtils.call(() -> mMasterProcess.getStartTimeMs(), ServerConfiguration.global()); }
@Test public void getStartTimeMs() { when(mMasterProcess.getStartTimeMs()).thenReturn(100L); Response response = mHandler.getStartTimeMs(); try { assertNotNull("Response must be not null!", response); assertNotNull("Response must have a entry!", response.getEntity()); assertEquals("Entry must be a Long!", Long.class, response.getEntity().getClass()); Long entry = (Long) response.getEntity(); assertEquals(100L, entry.longValue()); } finally { response.close(); } }
/** * @summary get the Alluxio master information * @param rawConfiguration if it's true, raw configuration values are returned, * otherwise, they are looked up; if it's not provided in URL queries, then * it is null, which means false. * @return the response object */ @GET @Path(GET_INFO) @ReturnType("alluxio.wire.AlluxioMasterInfo") public Response getInfo(@QueryParam(QUERY_RAW_CONFIGURATION) final Boolean rawConfiguration) { // TODO(jiri): Add a mechanism for retrieving only a subset of the fields. return RestUtils.call(() -> { boolean rawConfig = false; if (rawConfiguration != null) { rawConfig = rawConfiguration; } return new AlluxioMasterInfo().setCapacity(getCapacityInternal()) .setConfiguration(getConfigurationInternal(rawConfig)) .setLostWorkers(mBlockMaster.getLostWorkersInfoList()).setMetrics(getMetricsInternal()) .setMountPoints(getMountPointsInternal()) .setRpcAddress(mMasterProcess.getRpcAddress().toString()) .setStartTimeMs(mMasterProcess.getStartTimeMs()) .setStartupConsistencyCheck(getStartupConsistencyCheckInternal()) .setTierCapacity(getTierCapacityInternal()).setUfsCapacity(getUfsCapacityInternal()) .setUptimeMs(mMasterProcess.getUptimeMs()).setVersion(RuntimeConstants.VERSION) .setWorkers(mBlockMaster.getWorkerInfoList()); }, ServerConfiguration.global()); }