@Override public boolean waitForReady(int timeoutMs) { try { CommonUtils.waitFor(this + " to start", () -> isServing() && mWebServer != null && mWebServer.getServer().isRunning(), WaitForOptions.defaults().setTimeoutMs(timeoutMs)); return true; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } catch (TimeoutException e) { return false; } }
/** * @return a new instance of {@link AlluxioMasterProcess} */ public static AlluxioMasterProcess create() { return create(MasterProcess.setupBindSocket(ServiceType.MASTER_RPC), MasterProcess.setupBindSocket(ServiceType.MASTER_WEB)); }
abstract void startServing(String startMessage, String stopMessage);
BlockMaster blockMaster = mMasterProcess.getMaster(BlockMaster.class); FileSystemMaster fileSystemMaster = mMasterProcess.getMaster(FileSystemMaster.class); request.setAttribute("masterNodeAddress", mMasterProcess.getRpcAddress().toString());
/** * @return the externally resolvable address of the master */ public InetSocketAddress getAddress() { return mMasterProcess.getRpcAddress(); }
/** * Creates a new instance of {@link WebInterfaceGeneralServlet}. * * @param masterProcess Alluxio master process */ public WebInterfaceGeneralServlet(MasterProcess masterProcess) { mMasterProcess = masterProcess; mMetaMaster = mMasterProcess.getMaster(MetaMaster.class); }
@Override public void run() { try { LOG.info("Starting Alluxio master {}.", mMasterProcess); mMasterProcess.start(); } catch (InterruptedException e) { // this is expected } catch (Exception e) { // Log the exception as the RuntimeException will be caught and handled silently by JUnit LOG.error("Start master error", e); throw new RuntimeException(e + " \n Start Master Error \n" + e.getMessage(), e); } } };
/** * @summary get the start time of the master * @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()); }
/** * @summary get the uptime of the master * @return the response object * @deprecated since version 1.4 and will be removed in version 2.0 * @see #getInfo(Boolean) */ @GET @Path(GET_UPTIME_MS) @ReturnType("java.lang.Long") @Deprecated public Response getUptimeMs() { return RestUtils.call(() -> mMasterProcess.getUptimeMs()); }
/** * Stops the master processes and cleans up client connections. */ public void stop() throws Exception { if (mSecondaryMasterThread != null) { mSecondaryMaster.stop(); while (mSecondaryMasterThread.isAlive()) { LOG.info("Stopping thread {}.", mSecondaryMasterThread.getName()); mSecondaryMasterThread.interrupt(); mSecondaryMasterThread.join(1000); } mSecondaryMasterThread = null; } if (mMasterThread != null) { mMasterProcess.stop(); while (mMasterThread.isAlive()) { LOG.info("Stopping thread {}.", mMasterThread.getName()); mMasterThread.interrupt(); mMasterThread.join(1000); } mMasterThread = null; } clearClients(); System.clearProperty("alluxio.web.resources"); System.clearProperty("alluxio.master.min.worker.threads"); }
AuthenticatedClientUser.set(LoginUser.get().getName()); request.setAttribute("masterNodeAddress", mMasterProcess.getRpcAddress().toString()); request.setAttribute("fatalError", ""); request.setAttribute("showPermissions", Configuration.getBoolean(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_ENABLED)); FileSystemMaster fileSystemMaster = mMasterProcess.getMaster(FileSystemMaster.class);
/** * Gets the actual port that the RPC service is listening on. * * @return the RPC local port */ public int getRpcLocalPort() { return mMasterProcess.getRpcAddress().getPort(); }
/** * Constructs a new {@link AlluxioMasterRestServiceHandler}. * * @param context context for the servlet */ public AlluxioMasterRestServiceHandler(@Context ServletContext context) { // Poor man's dependency injection through the Jersey application scope. mMasterProcess = (MasterProcess) context .getAttribute(MasterWebServer.ALLUXIO_MASTER_SERVLET_RESOURCE_KEY); mBlockMaster = mMasterProcess.getMaster(BlockMaster.class); mFileSystemMaster = mMasterProcess.getMaster(FileSystemMaster.class); }
Configuration.getBoolean(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_ENABLED)); request.setAttribute("masterNodeAddress", mMasterProcess.getRpcAddress().toString()); request.setAttribute("invalidPathError", ""); List<FileInfo> filesInfo; request.setAttribute("currentPath", currentPath.toString()); request.setAttribute("viewingOffset", 0); FileSystemMaster fileSystemMaster = mMasterProcess.getMaster(FileSystemMaster.class);
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("masterNodeAddress", mMasterProcess.getRpcAddress().toString()); request.setAttribute("filePath", request.getParameter("filePath")); request.setAttribute("error", ""); List<String> parentFileNames = new ArrayList<>(); List<String> childrenFileNames = new ArrayList<>(); Collections.sort(parentFileNames); Collections.sort(childrenFileNames); request.setAttribute("parentFileNames", parentFileNames); request.setAttribute("childrenFileNames", childrenFileNames); }
/** * Constructs a new {@link FileSystemMasterClientRestServiceHandler}. * * @param context context for the servlet */ public FileSystemMasterClientRestServiceHandler(@Context ServletContext context) { // Poor man's dependency injection through the Jersey application scope. mFileSystemMaster = ((MasterProcess) context .getAttribute(MasterWebServer.ALLUXIO_MASTER_SERVLET_RESOURCE_KEY)) .getMaster(FileSystemMaster.class); }
public static AlluxioJobMasterProcess create() { return create(MasterProcess.setupBindSocket(ServiceType.JOB_MASTER_RPC), MasterProcess.setupBindSocket(ServiceType.JOB_MASTER_WEB)); }
/** * @return true if the master is serving, false otherwise */ public boolean isServing() { return mMasterProcess.isServing(); }
/** * @summary get the master rpc address * @return the response object * @deprecated since version 1.4 and will be removed in version 2.0 * @see #getInfo(Boolean) */ @GET @Path(GET_RPC_ADDRESS) @ReturnType("java.lang.String") @Deprecated public Response getRpcAddress() { return RestUtils.call(() -> mMasterProcess.getRpcAddress().toString()); }
/** * Constructs a new {@link LineageMasterClientRestServiceHandler}. * * @param context context for the servlet */ public LineageMasterClientRestServiceHandler(@Context ServletContext context) { // Poor man's dependency injection through the Jersey application scope. mLineageMaster = ((MasterProcess) context .getAttribute(MasterWebServer.ALLUXIO_MASTER_SERVLET_RESOURCE_KEY)) .getMaster(LineageMaster.class); }