Skip to content

Commit

Permalink
Added javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
nilshoffmann committed Aug 2, 2023
1 parent 08e1a84 commit cfbb16e
Show file tree
Hide file tree
Showing 28 changed files with 550 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,21 @@ public void configure(File pathToConfig) {
cr.configure(pathToConfig);
}

@Override
/**
*
* @return
* @throws Exception
*/
@Override
public V call() throws Exception {
run();
return get();
}

@Override
/**
*
*/
@Override
public void run() {
cr.run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ public Progress getProgress() {
return p;
}

@Override
/**
*
*/
@Override
public void run() {
p.setMessage("Starting execution of " + this.name);
p.setProgress(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ public Progress getProgress() {
return p;
}

@Override
/**
*
*/
@Override
public void run() {
p.setMessage("Starting execution of " + r.getClass().getName());
p.setProgress(0);
Expand Down
24 changes: 20 additions & 4 deletions mpaxs/mpaxs-api/src/main/java/net/sf/mpaxs/api/job/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ public int getErrorCounter() {
return errorCounter;
}

@Override
/**
*
*/
@Override
public synchronized void errorOccurred() {
errorCounter++;
}
Expand Down Expand Up @@ -296,7 +299,12 @@ public final void setClassToExecute(ConfigurableRunnable<T> cr) throws IllegalSt
this.classToExecute = cr;
}

@Override
/**
*
* @param obj
* @return
*/
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
Expand All @@ -308,7 +316,11 @@ public boolean equals(Object obj) {
return this.id == other.id || (this.id != null && this.id.equals(other.id));
}

@Override
/**
*
* @return
*/
@Override
public int hashCode() {
int hash = 3;
hash = 83 * hash + (this.id != null ? this.id.hashCode() : 0);
Expand All @@ -335,7 +347,11 @@ public synchronized void setPriority(int priority) {
this.priority = priority;
}

@Override
/**
*
* @return
*/
@Override
public String toString() {
return "Job{classToExecute=" + classToExecute + ", id=" + id + ", jobConfigFile=" + jobConfigFile + ", status=" + status + ", errorCounter=" + errorCounter + ", priority=" + priority + ", throwable=" + throwable + '}';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ public TimeUnit getTimeUnit() {
return timeUnit;
}

@Override
/**
*
*/
@Override
public void errorOccurred() {
delegate.errorOccurred();
}
Expand Down Expand Up @@ -175,7 +178,11 @@ public void setPriority(int priority) {
delegate.setPriority(priority);
}

@Override
/**
*
* @return
*/
@Override
public int hashCode() {
int hash = 7;
hash = 11 * hash + (int) (this.initialDelay ^ (this.initialDelay >>> 32));
Expand All @@ -185,7 +192,12 @@ public int hashCode() {
return hash;
}

@Override
/**
*
* @param obj
* @return
*/
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
Expand All @@ -206,7 +218,11 @@ public boolean equals(Object obj) {
return this.delegate == other.delegate || (this.delegate != null && this.delegate.equals(other.delegate));
}

@Override
/**
*
* @return
*/
@Override
public String toString() {
return "ScheduledJob{" + "initialDelay=" + initialDelay + ", period=" + period + ", timeUnit=" + timeUnit + ", delegate=" + delegate + '}';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,46 @@ protected void authenticate(UUID remoteAuthToken) throws RemoteException {
}
}

@Override
/**
*
* @param authToken
* @param host
*/
@Override
public void setHost(UUID authToken, IRemoteHost host) {
this.host = host;
}

@Override
/**
*
* @param authToken
* @param job
* @throws RemoteException
*/
@Override
public void runJob(UUID authToken, IJob job) throws RemoteException {
authenticate(authToken);
JobExecutor executor = new JobExecutor(job, host, settings.getRemoteReference(), jobLocation);
executor.start();
}

@Override
/**
*
* @param authToken
* @throws RemoteException
*/
@Override
public void terminateHost(UUID authToken) throws RemoteException {
authenticate(authToken);
System.exit(1);
}

@Override
/**
*
* @param authToken
* @throws RemoteException
*/
@Override
public void masterServerShuttingDown(UUID authToken) throws RemoteException {
authenticate(authToken);
if (!settings.getSilentMode()) {
Expand All @@ -107,13 +128,26 @@ public void masterServerShuttingDown(UUID authToken) throws RemoteException {
host.shutdown(this);
}

@Override
/**
*
* @param authToken
* @return
* @throws RemoteException
*/
@Override
public boolean stillAlive(UUID authToken) throws RemoteException {
authenticate(authToken);
return true;
}

@Override
/**
*
* @param authToken
* @param jobID
* @return
* @throws RemoteException
*/
@Override
public Progress getJobProgress(UUID authToken, UUID jobID) throws RemoteException {
authenticate(authToken);
if (jobLocation.containsKey(jobID)) {
Expand All @@ -123,7 +157,14 @@ public Progress getJobProgress(UUID authToken, UUID jobID) throws RemoteExceptio
}
}

@Override
/**
*
* @param authToken
* @param jobID
* @return
* @throws RemoteException
*/
@Override
public boolean cancelJob(UUID authToken, UUID jobID) throws RemoteException {
authenticate(authToken);
if (jobLocation.containsKey(jobID)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ public ExceptionSafeThreadFactory(Thread.UncaughtExceptionHandler handler) {
this.handler = handler;
}

@Override
/**
*
* @param r
* @return
*/
@Override
public Thread newThread(Runnable r) {
Thread t = threadFactory.newThread(r);
t.setUncaughtExceptionHandler(handler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ public class Host implements IRemoteHost {
private Settings settings = null;
private UUID authToken = null;

@Override
/**
*
* @param cfg
*/
@Override
public void configure(Configuration cfg) {
settings = new Settings(cfg);
Logger.getLogger(Host.class.getName()).log(Level.INFO, "Running ComputeHost at IP {0}", settings.getLocalIp());
Expand All @@ -86,7 +90,11 @@ public void configure(Configuration cfg) {
}
}

@Override
/**
*
* @param job
*/
@Override
public void sendDoneJob(IJob job) {
IRemoteServer remRef = settings.getRemoteReference();
try {
Expand Down Expand Up @@ -251,20 +259,32 @@ public void run() {
}.start();
}

@Override
/**
*
* @param t
* @param e
*/
@Override
public void uncaughtException(Thread t, Throwable e) {
Logger.getLogger(Host.class.getName()).log(Level.SEVERE, "Unknown error:", e);
System.exit(1);
}

@Override
/**
*
* @param authToken
*/
@Override
public void setAuthenticationToken(UUID authToken) {
this.authToken = authToken;
Logger.getLogger(Host.class.getName()).log(Level.FINE,
"AuthToken for Host is: " + authToken);
}

@Override
/**
*
*/
@Override
public void startComputeHost() {
getReadyForClients();
connectToMasterServer();
Expand All @@ -274,12 +294,20 @@ public void startComputeHost() {
}
}

@Override
/**
*
* @return
*/
@Override
public UUID getAuthenticationToken() {
return this.authToken;
}

@Override
/**
*
* @return
*/
@Override
public UUID getHostId() {
return settings.getHostID();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ public JobExecutor(IJob job, IRemoteHost host, IRemoteServer server, Map<UUID, J
this.jobLocation = jobLocation;
}

@Override
/**
*
*/
@Override
public void run() {
try {
Logger.getLogger(JobExecutor.class.getName()).log(Level.INFO, "Running job {0}", job);
Expand Down Expand Up @@ -107,7 +110,10 @@ private void returnFailedJob() {
}
}

@Override
/**
*
*/
@Override
public void interrupt() {
super.interrupt();
if (executor != null) {
Expand All @@ -123,7 +129,12 @@ public Progress getJobProgress() {
return job.getClassToExecute().getProgress();
}

@Override
/**
*
* @param t
* @param e
*/
@Override
public void uncaughtException(Thread t, Throwable e) {
jobFailed = true;
job.setThrowable(e);
Expand Down
Loading

0 comments on commit cfbb16e

Please sign in to comment.