1 /* This file is part of the project "Hilbert II" - http://www.qedeq.org" target="alexandria_uri">http://www.qedeq.org 2 * 3 * Copyright 2000-2014, Michael Meyling <mime@qedeq.org>. 4 * 5 * "Hilbert II" is free software; you can redistribute 6 * it and/or modify it under the terms of the GNU General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 */ 15 16 package org.qedeq.kernel.bo.common; 17 18 19 /** 20 * Process info for a kernel service. 21 * 22 * @author Michael Meyling 23 */ 24 public interface ServiceJob extends Comparable { 25 26 /** 27 * Get currently running service call. 28 * 29 * @return Module service call. Might be <code>null</code>. 30 */ 31 public ModuleServiceCall getModuleServiceCall(); 32 33 /** 34 * Get thread the service runs within. 35 * 36 * @return Service thread. 37 */ 38 public Thread getThread(); 39 40 /** 41 * Get name of currently processed QedeqBo. 42 * 43 * @return Name of QEDEQ module. Might be empty string. 44 */ 45 public String getQedeqName(); 46 47 /** 48 * Get URL of currently processed QedeqBo. 49 * 50 * @return URL of QEDEQ module. Might be empty string. 51 */ 52 public String getQedeqUrl(); 53 54 /** 55 * Get timestamp for service start. 56 * 57 * @return Service start timestamp. 58 */ 59 public long getStart(); 60 61 /** 62 * Get timestamp for service stop. 63 * 64 * @return Service stop timestamp. 65 */ 66 public long getStop(); 67 68 /** 69 * Is the process still running? 70 * 71 * @return The process is still running. (But it might be blocked.) 72 */ 73 public boolean isRunning(); 74 75 /** 76 * Is the process running, but is blocked? 77 * 78 * @return Process is running and blocked. 79 */ 80 public boolean isBlocked(); 81 82 /** 83 * Has the process normally ended? 84 * 85 * @return Has the process normally ended? 86 */ 87 public boolean wasSuccess(); 88 89 /** 90 * Has the process finished with an exception? 91 * This is also true, if the user canceled the execution. See {@link #wasInterrupted()}. 92 * 93 * @return The process finished with an exception. 94 */ 95 public boolean wasFailure(); 96 97 /** 98 * Has the process execution been canceled by the user? 99 * 100 * @return The process has been canceled by the user. 101 */ 102 public boolean wasInterrupted(); 103 104 /** 105 * Interrupt running thread. Usually because of user canceling. This should initiate a 106 * {@link org.qedeq.kernel.se.visitor.InterruptException} when {@link Thread.interrupted()} 107 * is <code>true</code>. 108 */ 109 public void interrupt(); 110 111 /** 112 * Get action name. This is what the process mainly does. 113 * 114 * @return Action name. 115 */ 116 public String getActionName(); 117 118 /** 119 * Get percentage of currently running execution. 120 * 121 * @return Number between 0 and 100. 122 */ 123 public double getExecutionPercentage(); 124 125 /** 126 * Get description of currently taken action. 127 * 128 * @return We are doing this currently. 129 */ 130 public String getExecutionActionDescription(); 131 132 /** 133 * Get {@link QedeqModule}s blocked by this process. 134 * 135 * @return Blocked QEDEQ modules. 136 */ 137 public QedeqBoSet getBlockedModules(); 138 139 /** 140 * Get currently processed {@link QedeqModule} list. This includes QEDEQ modules we try to get a lock for. 141 * 142 * @return QEDEQ modules we currently try to process. 143 */ 144 public QedeqBo[] getCurrentlyProcessedModules(); 145 146 /** 147 * Get process id. 148 * 149 * @return Process identifying number. 150 */ 151 public long getId(); 152 153 }