001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002 *
003 * Copyright 2000-2014, Michael Meyling <mime@qedeq.org>.
004 *
005 * "Hilbert II" is free software; you can redistribute
006 * it and/or modify it under the terms of the GNU General Public
007 * License as published by the Free Software Foundation; either
008 * version 2 of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 */
015
016 package org.qedeq.kernel.bo.common;
017
018
019 /**
020 * Process info for a kernel service.
021 *
022 * @author Michael Meyling
023 */
024 public interface ServiceJob extends Comparable {
025
026 /**
027 * Get currently running service call.
028 *
029 * @return Module service call. Might be <code>null</code>.
030 */
031 public ModuleServiceCall getModuleServiceCall();
032
033 /**
034 * Get thread the service runs within.
035 *
036 * @return Service thread.
037 */
038 public Thread getThread();
039
040 /**
041 * Get name of currently processed QedeqBo.
042 *
043 * @return Name of QEDEQ module. Might be empty string.
044 */
045 public String getQedeqName();
046
047 /**
048 * Get URL of currently processed QedeqBo.
049 *
050 * @return URL of QEDEQ module. Might be empty string.
051 */
052 public String getQedeqUrl();
053
054 /**
055 * Get timestamp for service start.
056 *
057 * @return Service start timestamp.
058 */
059 public long getStart();
060
061 /**
062 * Get timestamp for service stop.
063 *
064 * @return Service stop timestamp.
065 */
066 public long getStop();
067
068 /**
069 * Is the process still running?
070 *
071 * @return The process is still running. (But it might be blocked.)
072 */
073 public boolean isRunning();
074
075 /**
076 * Is the process running, but is blocked?
077 *
078 * @return Process is running and blocked.
079 */
080 public boolean isBlocked();
081
082 /**
083 * Has the process normally ended?
084 *
085 * @return Has the process normally ended?
086 */
087 public boolean wasSuccess();
088
089 /**
090 * Has the process finished with an exception?
091 * This is also true, if the user canceled the execution. See {@link #wasInterrupted()}.
092 *
093 * @return The process finished with an exception.
094 */
095 public boolean wasFailure();
096
097 /**
098 * Has the process execution been canceled by the user?
099 *
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 }
|