org.qedeq.kernel.bo.job
Class InternalServiceJobImpl

java.lang.Object
  extended by org.qedeq.kernel.bo.job.InternalServiceJobImpl
All Implemented Interfaces:
java.lang.Comparable, ServiceJob, InternalServiceJob

public class InternalServiceJobImpl
extends java.lang.Object
implements InternalServiceJob

Process info for a kernel service.

Author:
Michael Meyling

Constructor Summary
InternalServiceJobImpl(ModuleArbiter arbiter, java.lang.String actionName)
          A new service process within the current thread.
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getActionName()
          Get action name.
 QedeqBoSet getBlockedModules()
          Get QedeqModules blocked by this process.
 QedeqBo[] getCurrentlyProcessedModules()
          Get currently processed QedeqModule list.
 java.lang.String getExecutionActionDescription()
          Get description of currently taken action.
 double getExecutionPercentage()
          Get percentage of currently running execution.
 long getId()
          Get process id.
 InternalModuleServiceCall getInternalServiceCall()
          Get currently running service call.
 ModuleServiceCall getModuleServiceCall()
          Get currently running service call.
 java.lang.String getQedeqName()
          Get name of currently processed QedeqBo.
 java.lang.String getQedeqUrl()
          Get URL of currently processed QedeqBo.
 long getStart()
          Get timestamp for service start.
 long getStop()
          Get timestamp for service stop.
 java.lang.Thread getThread()
          Get thread the service runs within.
 int hashCode()
           
 void interrupt()
          Interrupt running thread.
 boolean isBlocked()
          Is the process running, but is blocked?
 boolean isRunning()
          Is the process still running?
 void setBlocked(boolean blocked)
          Set blocked state.
 void setFailureState()
          Mark that thread execution lead to an exception.
 void setInternalServiceCall(InternalModuleServiceCall call)
          Service call.
 void setInterruptedState()
          Mark that thread execution was canceled by the user.
 void setSuccessState()
          Mark that thread execution has normally ended.
 boolean wasFailure()
          Has the process finished with an exception? This is also true, if the user canceled the execution.
 boolean wasInterrupted()
          Has the process execution been canceled by the user?
 boolean wasSuccess()
          Has the process normally ended?
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalServiceJobImpl

public InternalServiceJobImpl(ModuleArbiter arbiter,
                              java.lang.String actionName)
A new service process within the current thread.

Parameters:
arbiter - Remember module arbiter.
actionName - Main process purpose.
Method Detail

setInternalServiceCall

public void setInternalServiceCall(InternalModuleServiceCall call)
Description copied from interface: InternalServiceJob
Service call.

Specified by:
setInternalServiceCall in interface InternalServiceJob
Parameters:
call - Execute this service call.

getModuleServiceCall

public ModuleServiceCall getModuleServiceCall()
Description copied from interface: ServiceJob
Get currently running service call.

Specified by:
getModuleServiceCall in interface ServiceJob
Returns:
Module service call. Might be null.

getInternalServiceCall

public InternalModuleServiceCall getInternalServiceCall()
Description copied from interface: InternalServiceJob
Get currently running service call.

Specified by:
getInternalServiceCall in interface InternalServiceJob
Returns:
Service call.

getThread

public java.lang.Thread getThread()
Description copied from interface: ServiceJob
Get thread the service runs within.

Specified by:
getThread in interface ServiceJob
Returns:
Service thread.

getQedeqName

public java.lang.String getQedeqName()
Description copied from interface: ServiceJob
Get name of currently processed QedeqBo.

Specified by:
getQedeqName in interface ServiceJob
Returns:
Name of QEDEQ module. Might be empty string.

getQedeqUrl

public java.lang.String getQedeqUrl()
Description copied from interface: ServiceJob
Get URL of currently processed QedeqBo.

Specified by:
getQedeqUrl in interface ServiceJob
Returns:
URL of QEDEQ module. Might be empty string.

getStart

public long getStart()
Description copied from interface: ServiceJob
Get timestamp for service start.

Specified by:
getStart in interface ServiceJob
Returns:
Service start timestamp.

getStop

public long getStop()
Description copied from interface: ServiceJob
Get timestamp for service stop.

Specified by:
getStop in interface ServiceJob
Returns:
Service stop timestamp.

setSuccessState

public void setSuccessState()
Description copied from interface: InternalServiceJob
Mark that thread execution has normally ended.

Specified by:
setSuccessState in interface InternalServiceJob

setInterruptedState

public void setInterruptedState()
Description copied from interface: InternalServiceJob
Mark that thread execution was canceled by the user.

Specified by:
setInterruptedState in interface InternalServiceJob

setFailureState

public void setFailureState()
Description copied from interface: InternalServiceJob
Mark that thread execution lead to an exception.

Specified by:
setFailureState in interface InternalServiceJob

isRunning

public boolean isRunning()
Description copied from interface: ServiceJob
Is the process still running?

Specified by:
isRunning in interface ServiceJob
Returns:
The process is still running. (But it might be blocked.)

isBlocked

public boolean isBlocked()
Description copied from interface: ServiceJob
Is the process running, but is blocked?

Specified by:
isBlocked in interface ServiceJob
Returns:
Process is running and blocked.

setBlocked

public void setBlocked(boolean blocked)
Description copied from interface: InternalServiceJob
Set blocked state.

Specified by:
setBlocked in interface InternalServiceJob
Parameters:
blocked - Blocked state.

wasSuccess

public boolean wasSuccess()
Description copied from interface: ServiceJob
Has the process normally ended?

Specified by:
wasSuccess in interface ServiceJob
Returns:
Has the process normally ended?

wasFailure

public boolean wasFailure()
Description copied from interface: ServiceJob
Has the process finished with an exception? This is also true, if the user canceled the execution. See ServiceJob.wasInterrupted().

Specified by:
wasFailure in interface ServiceJob
Returns:
The process finished with an exception.

wasInterrupted

public boolean wasInterrupted()
Description copied from interface: ServiceJob
Has the process execution been canceled by the user?

Specified by:
wasInterrupted in interface ServiceJob
Returns:
The process has been canceled by the user.

interrupt

public void interrupt()
Description copied from interface: ServiceJob
Interrupt running thread. Usually because of user canceling. This should initiate a InterruptException when Thread.interrupted() is true.

Specified by:
interrupt in interface ServiceJob

getExecutionPercentage

public double getExecutionPercentage()
Description copied from interface: ServiceJob
Get percentage of currently running execution.

Specified by:
getExecutionPercentage in interface ServiceJob
Returns:
Number between 0 and 100.

getActionName

public java.lang.String getActionName()
Description copied from interface: ServiceJob
Get action name. This is what the process mainly does.

Specified by:
getActionName in interface ServiceJob
Returns:
Action name.

getExecutionActionDescription

public java.lang.String getExecutionActionDescription()
Description copied from interface: ServiceJob
Get description of currently taken action.

Specified by:
getExecutionActionDescription in interface ServiceJob
Returns:
We are doing this currently.

getBlockedModules

public QedeqBoSet getBlockedModules()
Description copied from interface: ServiceJob
Get QedeqModules blocked by this process.

Specified by:
getBlockedModules in interface ServiceJob
Returns:
Blocked QEDEQ modules.

getId

public long getId()
Description copied from interface: ServiceJob
Get process id.

Specified by:
getId in interface ServiceJob
Returns:
Process identifying number.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

getCurrentlyProcessedModules

public QedeqBo[] getCurrentlyProcessedModules()
Description copied from interface: ServiceJob
Get currently processed QedeqModule list. This includes QEDEQ modules we try to get a lock for.

Specified by:
getCurrentlyProcessedModules in interface ServiceJob
Returns:
QEDEQ modules we currently try to process.


Copyright © 2014. All Rights Reserved.