⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serverjobmanager.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                int connectionId = serverConnections.size();                StreamClient conn;                lock();                try {                    conn = new StreamClient(connectionId, socket.getInputStream(), socket.getOutputStream(), currentSnapshot);                    serverConnections.add(conn);                } finally {                    unlock();                }                System.out.println("Accepted connection " + connectionId);                conn.start();            }        } catch (IOException e) {            e.printStackTrace(System.out);        }    }    /**     * This method is executed in Swing thread.     */    public void run() {        assert !Job.BATCHMODE;        Job.logger.logp(Level.FINE, CLASS_NAME, "run", "ENTER");        while (guiChanged()) {            ArrayList<Job> jobs = new ArrayList<Job>();            for (Iterator<Job> it = Job.getAllJobs(); it.hasNext();) {                Job j = it.next();                if (j.getDisplay()) {                    jobs.add(j);                }            }            JobTree.update(jobs);            TopLevel.setBusyCursor(isChangeJobQueuedOrRunning());//            for (;;) {//                EJob ejob = selectTerminateIt();//                if (ejob == null) break;////                Job.logger.logp(Level.FINE, CLASS_NAME, "run", "terminate {0}", ejob.jobName);//                Job.runTerminate(ejob);//                setEJobState(ejob, EJob.State.CLIENT_DONE, null);//                Job.logger.logp(Level.FINE, CLASS_NAME, "run", "terminated {0}", ejob.jobName);//            }            Job.logger.logp(Level.FINE, CLASS_NAME, "run", "wantToRedoJobTree");        }        Job.logger.logp(Level.FINE, CLASS_NAME, "run", "EXIT");    }    public static void setUndoRedoStatus(boolean undoEnabled, boolean redoEnabled) {        assert Job.jobManager instanceof ServerJobManager;        Job.currentUI.showUndoRedoStatus(undoEnabled, redoEnabled);        // transmit to connection    }    EJob selectEJob(EJob finishedEJob) {        EJob selectedEJob = null;        lock();        try {            if (finishedEJob != null) {//                EJob.State state = finishedEJob.state;                setEJobState(finishedEJob, EJob.State.SERVER_DONE, "done");            }            for (;;) {                signalledEThread = false;                // Search for examine                if (canDoIt()) {                    EJob ejob = waitingJobs.remove(0);                    startedJobs.add(ejob);                    if (ejob.isExamine()) {                        assert !runningChangeJob;                        invokeEThread();                    } else {                        assert startedJobs.size() == 1;                        assert !runningChangeJob;                        runningChangeJob = true;                    }                    setEJobState(ejob, EJob.State.RUNNING, "running");                    selectedEJob = ejob;                    break;                }                if (Job.threadMode == Job.Mode.BATCH && startedJobs.isEmpty()) {                    ActivityLogger.finished();                    System.exit(1);                }                Job.logger.logp(Level.FINE, CLASS_NAME, "selectConnection", "pause");                databaseChangesMutex.awaitUninterruptibly();                Job.logger.logp(Level.FINE, CLASS_NAME, "selectConnection", "resume");            }        } finally {            unlock();        }        return selectedEJob;    }    /*private*/ static class UserInterfaceRedirect implements UserInterface	{    	private static void printStackTrace(String methodName) {            if (true) return;            if (!Job.getDebug()) return;            System.out.println("UserInterface." + methodName + " was called from DatabaseChangesThread");    		Exception e = new Exception();			e.printStackTrace(System.out);    	}        /**         * Method to start the display of a progress dialog.         * @param msg the message to show in the progress dialog.         * @param the file being read (null if not reading a file).         */        public void startProgressDialog(String msg, String filePath)        {//            printStackTrace("startProgressDialog");            Job.currentUI.startProgressDialog(msg, filePath);        }        /**         * Method to stop the progress bar         */        public void stopProgressDialog()        {//            printStackTrace("stopProgressDialog");            Job.currentUI.stopProgressDialog();        }        /**         * Method to update the progress bar         * @param pct the percentage done (from 0 to 100).         */        public void setProgressValue(long pct)        {//            printStackTrace("updateProgressDialog");            Job.currentUI.setProgressValue(pct);        }        /**	     * Method to set a text message in the progress dialog.	     * @param message the new progress message.         */        public void setProgressNote(String message)        {//            printStackTrace("setProgressNote");            Job.currentUI.setProgressNote(message);        }        /**	     * Method to get text message in the progress dialog.	     * @return text message in the progress dialog.         */        public String getProgressNote()        {//            printStackTrace("setProgressNote");            return Job.currentUI.getProgressNote();        }		public EditWindow_ getCurrentEditWindow_() {            printStackTrace("getCurrentEditWindow");            return Job.currentUI.getCurrentEditWindow_();        }		public EditWindow_ needCurrentEditWindow_()		{            printStackTrace("needCurrentEditWindow");			return null;		}        /** Get current cell from current library */		public Cell getCurrentCell()        {            printStackTrace("getCurrentCell");			Library lib = Library.getCurrent();			if (lib == null) return null;			return lib.getCurCell();        }        /** Get current cell from current library */		public Cell getCurrentCell(Library lib)        {            printStackTrace("getCurrentCell(lib)");			return Job.currentUI.getCurrentCell(lib);        }		public Cell needCurrentCell()		{            printStackTrace("needCurrentCell");            /** Current cell based on current library */            Cell curCell = getCurrentCell();            if (curCell == null)            {                System.out.println("There is no current cell for this operation.  To create one, use the 'New Cell' command from the 'Cell' menu.");            }            return curCell;		}		/**		 * Method to set the current Cell in a Library.		 * @param lib the library in which to set a current cell.		 * @param curCell the new current Cell in the Library (can be null).		 */		public void setCurrentCell(Library lib, Cell curCell)		{            printStackTrace("setCurrentCell");            Job.currentUI.setCurrentCell(lib, curCell);		}		public void repaintAllWindows() {            printStackTrace("repaintAllWindows");            Job.currentUI.repaintAllWindows();        }        public void adjustReferencePoint(Cell cell, double cX, double cY) {//            System.out.println("UserInterface.adjustReferencePoint was called from DatabaseChangesThread");        };		public void alignToGrid(Point2D pt) {            printStackTrace("alignToGrid");        }		public Dimension2D getGridAlignment() { return new Dimension2D.Double(1.0, 1.0); }		public int getDefaultTextSize() { return 14; }//		public Highlighter getHighlighter();		public EditWindow_ displayCell(Cell cell) { throw new IllegalStateException(); }        public void termLogging(final ErrorLogger logger, boolean explain, boolean terminate) {            Job.currentUI.termLogging(logger, explain, terminate);            // transmit to client        }        public void updateNetworkErrors(Cell cell, List<ErrorLogger.MessageLog> errors) { throw new IllegalStateException(); }        public void updateIncrementalDRCErrors(Cell cell, List<ErrorLogger.MessageLog> errors) { throw new IllegalStateException(); }        /**         * Method to return the error message associated with the current error.         * Highlights associated graphics if "showhigh" is nonzero.  Fills "g1" and "g2"         * with associated geometry modules (if nonzero).         */        public String reportLog(ErrorLogger.MessageLog log, boolean showhigh, Geometric [] gPair)        {            printStackTrace("reportLog");            // return the error message            return log.getMessageString();        }        /**         * Method to show an error message.         * @param message the error message to show.         * @param title the title of a dialog with the error message.         */        public void showErrorMessage(Object message, String title)        {            Job.currentUI.showErrorMessage(message, title);//            System.out.println("UserInterface.showErrorMessage was called from DatabaseChangesThread");//        	System.out.println(message);        }        /**         * Method to show an informational message.         * @param message the message to show.         * @param title the title of a dialog with the message.         */        public void showInformationMessage(Object message, String title)        {            Job.currentUI.showInformationMessage(message, title);//            System.out.println("UserInterface.showInformationMessage was called from DatabaseChangesThread");//        	System.out.println(message);        }        /**         * Method to show a message and ask for confirmation.         * @param message the message to show.         * @return true if "yes" was selected, false if "no" was selected.         */        public boolean confirmMessage(Object message) {            printStackTrace("confirmMessage");            return true;        }        /**         * Method to ask for a choice among possibilities.         * @param message the message to show.         * @param title the title of the dialog with the query.         * @param choices an array of choices to present, each in a button.         * @param defaultChoice the default choice.         * @return the index into the choices array that was selected.         */        public int askForChoice(String message, String title, String [] choices, String defaultChoice) {            throw new IllegalStateException(message);        }        /**         * Method to ask for a line of text.         * @param message the prompt message.         * @param title the title of a dialog with the message.         * @param def the default response.         * @return the string (null if cancelled).         */        public String askForInput(Object message, String title, String def) { throw new IllegalStateException(); }        /** For Pref */        public void restoreSavedBindings(boolean initialCall) {            printStackTrace("restoreSavedBindings");        }        /**         * Method to import the preferences from an XML file.         * Prompts the user and reads the file.         */        public void importPrefs() {            printStackTrace("importPrefs");        }        /**         * Method to export the preferences to an XML file.         * Prompts the user and writes the file.         */        public void exportPrefs() {            printStackTrace("exportPrefs");        }        /**         * Save current state of highlights and return its ID.         */        public int saveHighlights() { return -1; }        /**         * Restore state of highlights by its ID.         * @param highlightsId id of saved highlights.         */        public void restoreHighlights(int highlightsId) {}        /**         * Show status of undo/redo buttons         * @param newUndoEnabled new status of undo button.         * @param newRedoEnabled new status of redo button.         */        public void showUndoRedoStatus(boolean newUndoEnabled, boolean newRedoEnabled) {}    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -