public class DBLoadAgent extends AbstractSequencedAgent<ClientContext,ServerContext> implements PrintableAgent
| Constructor and Description |
|---|
DBLoadAgent(ClientContext clientCtx,
int chunkSize,
DBRecord master,
SqlCondition condition,
SqlOrder order) |
DBLoadAgent(ClientContext clientCtx,
int chunkSize,
DBRecordTableModel tableModel,
DBRecord master,
SqlCondition condition,
SqlOrder order) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearClientParams()
Clears the parameters in the client cache that have been set by this agent.
|
void |
doOnMessageReceived()
Is called on the client side when the agent has been received in a message.
|
boolean |
equals(java.lang.Object obj)
Evaluates equality by comparing the AgentId object.
|
void |
executeOnServer()
This is the agent's main execution method called on the server.
|
java.lang.Object |
getArgument()
Returns the optional argument of this agent.
|
<T> T |
getClientParam(java.lang.String key)
Fetches an agent specific parameter from the client cache.
|
java.util.Map |
getClientParams()
Allows an async agent to store an Agent-specific parameter in a client cache.
|
java.lang.Exception |
getError()
Returns the Exception that may have been raised during agent execution on the server.
|
java.lang.String |
getName()
Returns a meaningful name for debugging purposes.
|
SessionId |
getOwnerSessionId()
Returns session id of the actual originator client
(which cannot be a CoClient, but just a normal client)
|
int |
getPriority()
Returns the thread priority which is used to execute this agent
|
long |
getProcessingDuration()
Returns the time (in millis) it has taken to process the agent on server side.
|
long |
getReceivedTime()
Tells when the agent was received by the client
|
int |
getRecordCount() |
DBRecord[] |
getRecords() |
int |
getResponseTimeout()
Returns the desired timeout (in seconds) that should apply to this agent, or 0 if no timeout
should be used.
|
long |
getSentTime()
Tells when the agent was sent by the client
|
SessionId |
getSessionId()
Returns the SessionId of the owner of this agent
|
java.lang.String |
getTargetServer()
Returns the target server if one is set.
|
TaskId |
getTaskId()
Returns the unique identifier for this task.
|
long |
getTotalDuration()
Returns the time (in millis) it has taken from sending to finishing postprocessing of the agent.
|
long |
getTransferDuration()
Returns the time (in millis) it has taken from sending to receiving the agent.
|
protected int |
getZippedArgumentLength() |
boolean |
hasClientParam(java.lang.String key)
Checks whether an agent specific parameter exists in the client cache.
|
boolean |
hasError()
Tells whether the agent had an Exception during execution on server side.
|
int |
hashCode() |
boolean |
hasRun()
Tells whether this agent has been executed on the server.
|
boolean |
isPartialResultsEnabled()
Tells whether the agent supports partial results.
|
boolean |
isReceived()
Tells whether this agent yet has been received by the client.
|
boolean |
isReceivedInMessage()
Returns true if the agent has been received within a message.
|
boolean |
isReceivedInResponse()
Returns true if the agent has been received within a response.
|
boolean |
isRejectable()
Tells whether this agent can be rejected when the server is on heavy load.
|
void |
logDebug(java.lang.String message) |
void |
logDump(java.lang.String message) |
void |
logError(java.lang.String message) |
void |
logError(java.lang.String message,
java.lang.Exception error) |
void |
logFatal(java.lang.String message,
java.lang.Exception error) |
void |
logInfo(java.lang.String message) |
void |
logVerbose(java.lang.String message) |
void |
logWarning(java.lang.String message) |
void |
putClientParam(java.lang.String key,
java.lang.Object value)
Putting a null value results in removing the key
|
boolean |
sendForBooleanExecution()
Same as
Agent.sendForExecution() but does not return the agent, rather it returns true if
the agent has successfully being processed, false otherwise. |
<A extends Agent<C,S>> |
sendForExecution()
Sends the agent to the server for execution and returns the readily processed agent.
|
<A extends Agent<C,S>> |
sendForSilentExecution()
Same as
Agent.sendForExecution() just without throwing an Exception. |
void |
setArgument(java.lang.Object arg)
Besides any internal variables the agent may optionally carry an arbitrary argument.
|
void |
setArgument(java.lang.Object arg,
boolean doZip)
Same as setArgument(Object) but compresses the argument to a zipped byte array.
|
void |
setCancelledBy(SessionId killerSessId)
Marks the agent to be cancelled without performing any further
cancel action.
|
void |
setFailed(java.lang.Exception error)
Sets the internal Exception of the Agent.
|
void |
setFinished()
Is called by the server to mark this agent as being processed and stores the processing
duration.
|
void |
setName(java.lang.String agentName)
Sets a meaningful name for debugging purposes.
|
void |
setOwnerSessionId(SessionId ownerSessId)
Sets the sessionId of the user who creates the agent
|
void |
setPartialResultsEnabled(boolean isEnabled)
Tells whether the agent supports partial results.
|
void |
setPriority(int priority)
Sets the thread priority which is used to execute this agent
|
void |
setReceivedInMessage(boolean isReceivedInMessage)
Is set when this agent has been received within a message
|
void |
setReceivedTime(long receivedTime)
Is called by the client when the agent is received
|
void |
setRejectable(boolean state)
If set to false, then the agent cannot be rejected by the server even if the server is on
heavy load.
|
void |
setResponseTimeout(int seconds)
Sets the response timeout in seconds.
|
void |
setSentTime(long sentTime)
Is called by the client when the agent is sent
|
void |
setServerContext(S serverCtx)
Sets the server runtime environment
|
void |
setSessionId(SessionId sessId)
Allows for setting the SessionId of this agent
|
void |
setTargetServer(java.lang.String targetServer)
Sets the target server.
|
DumpString |
toDumpString(DumpString s)
This method creates a multi line debug output to display the full content of the agent.
|
ToString |
toString(ToString s)
This method creates a single line debug output to display the most important properties of the agent
|
createAgentId, createNetMessage, getAgentId, getChunkSize, getMaxSequenceId, getSequenceId, isLast, processLast, sendLast, sendNextSequence, setChunkSize, setMaxSequenceIdcheckCancelled, checkPermission, doFinallyOnClient, doFinallyOnServer, doInitiallyOnClient, doInitiallyOnServer, doOnClientSideCancellation, doOnMessageError, doOnResponseConfirmed, doOnResponseError, doOnResponseReceived, doOnServerSideCancellation, executeForResponse, getKillerSessionId, getMessageTimeout, getRenderColor, getRenderIcon, getRenderText, isAsync, isIgnoreMessageError, isNoReturn, isTimedOut, setAsync, setIgnoreMessageError, setMessageTimeout, setNoReturn, sleepChecked, wasCancelledcheckOnClient, checkOnServer, getClientContext, getLogChannel, getServerContext, isLogDebug, isLogVerbose, isOnClient, isOnServer, setClientContext, setLogChannelclone, deepCloneconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitclearClientParams, getArgument, getClientParam, getClientParams, getError, getName, getOwnerSessionId, getPriority, getResponseTimeout, getSessionId, getTargetServer, hasClientParam, hasError, hasRun, isPartialResultsEnabled, isReceived, isReceivedInMessage, isReceivedInResponse, isRejectable, putClientParam, sendForBooleanExecution, sendForExecution, sendForSilentExecution, setArgument, setArgument, setFailed, setFinished, setName, setOwnerSessionId, setPartialResultsEnabled, setPriority, setReceivedInMessage, setRejectable, setResponseTimeout, setSessionId, setTargetServerisOnClient, isOnServer, setClientContext, setServerContextgetClientContextgetServerContexttoDumpString, toStringdeepClonegetProcessingDuration, getReceivedTime, getSentTime, getTotalDuration, getTransferDuration, setReceivedTime, setSentTimegetLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelpublic DBLoadAgent(ClientContext clientCtx, int chunkSize, DBRecord master, SqlCondition condition, SqlOrder order)
public DBLoadAgent(ClientContext clientCtx, int chunkSize, DBRecordTableModel tableModel, DBRecord master, SqlCondition condition, SqlOrder order)
public void executeOnServer()
throws java.lang.Exception
AgentexecuteOnServer in interface Agent<ClientContext,ServerContext>java.lang.Exceptionpublic DBRecord[] getRecords()
public int getRecordCount()
public void setCancelledBy(SessionId killerSessId)
AbstractAgentsetCancelledBy in interface AsyncAgent<ClientContext,ServerContext>setCancelledBy in class AbstractAgent<ClientContext,ServerContext>public void doOnMessageReceived()
AbstractAgentdoOnMessageReceived in interface AsyncAgent<ClientContext,ServerContext>doOnMessageReceived in class AbstractAgent<ClientContext,ServerContext>public ToString toString(ToString s)
toString in interface DumpabletoString in class AbstractSequencedAgent<ClientContext,ServerContext>public DumpString toDumpString(DumpString s)
toDumpString in interface DumpabletoDumpString in class AbstractSequencedAgent<ClientContext,ServerContext>public final java.util.Map getClientParams()
AgentgetClientParams in interface Agent<C extends ClientContext,S extends ServerContext>public final void putClientParam(java.lang.String key,
java.lang.Object value)
putClientParam in interface Agent<C extends ClientContext,S extends ServerContext>Agent.getClientParams()public final <T> T getClientParam(java.lang.String key)
AgentgetClientParam in interface Agent<C extends ClientContext,S extends ServerContext>Agent.getClientParams()public final boolean hasClientParam(java.lang.String key)
AgenthasClientParam in interface Agent<C extends ClientContext,S extends ServerContext>public final void clearClientParams()
AgentclearClientParams in interface Agent<C extends ClientContext,S extends ServerContext>public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic final TaskId getTaskId()
TaskIdHolderTaskId.getTaskId in interface TaskIdHolderpublic final SessionId getSessionId()
getSessionId in interface Agent<C extends ClientContext,S extends ServerContext>Agent.setSessionId(SessionId),
Agent.getOwnerSessionId()public final void setSessionId(SessionId sessId)
AgentsetSessionId in interface Agent<C extends ClientContext,S extends ServerContext>Agent.getSessionId()public final void setServerContext(S serverCtx)
CrossPlatformObjectsetServerContext in interface CrossPlatformObject<C extends ClientContext,S extends ServerContext>setServerContext in class AbstractCrossPlatformObject<C extends ClientContext,S extends ServerContext>ServerObject.getServerContext()public final boolean isPartialResultsEnabled()
AgentisPartialResultsEnabled in interface Agent<C extends ClientContext,S extends ServerContext>Agent.setPartialResultsEnabled(boolean)public final void setPartialResultsEnabled(boolean isEnabled)
AgentsetPartialResultsEnabled in interface Agent<C extends ClientContext,S extends ServerContext>Agent.isPartialResultsEnabled()public final void setRejectable(boolean state)
AgentsetRejectable in interface Agent<C extends ClientContext,S extends ServerContext>public final boolean isRejectable()
AgentisRejectable in interface Agent<C extends ClientContext,S extends ServerContext>public final SessionId getOwnerSessionId()
getOwnerSessionId in interface Agent<C extends ClientContext,S extends ServerContext>public void setOwnerSessionId(SessionId ownerSessId)
AgentsetOwnerSessionId in interface Agent<C extends ClientContext,S extends ServerContext>public final java.lang.String getTargetServer()
AgentgetTargetServer in interface Agent<C extends ClientContext,S extends ServerContext>Agent.setTargetServer(String)public final void setTargetServer(java.lang.String targetServer)
AgentNote that target server routing is not supported for async agents.
setTargetServer in interface Agent<C extends ClientContext,S extends ServerContext>Agent.getTargetServer()public void setName(java.lang.String agentName)
AgentsetName in interface Agent<C extends ClientContext,S extends ServerContext>public final java.lang.String getName()
AgentgetName in interface Agent<C extends ClientContext,S extends ServerContext>public final void setResponseTimeout(int seconds)
setResponseTimeout in interface Agent<C extends ClientContext,S extends ServerContext>Agent.getResponseTimeout()public final int getResponseTimeout()
AgentgetResponseTimeout in interface Agent<C extends ClientContext,S extends ServerContext>Agent.setResponseTimeout(int)public final boolean hasRun()
AgenthasRun in interface Agent<C extends ClientContext,S extends ServerContext>Agent.hasError()public final boolean hasError()
AgenthasError in interface Agent<C extends ClientContext,S extends ServerContext>Agent.getError()public final java.lang.Exception getError()
AgentAgent.hasError() whether an Exception exists in the agent.getError in interface Agent<C extends ClientContext,S extends ServerContext>Agent.setFailed(Exception),
Agent.hasError()public final void setFinished()
AgentsetFinished in interface Agent<C extends ClientContext,S extends ServerContext>CrossPlatformObject.setServerContext(ServerContext ctx)public final void setFailed(java.lang.Exception error)
AgentsetFailed in interface Agent<C extends ClientContext,S extends ServerContext>Agent.getError(),
Agent.hasError()public final boolean isReceivedInResponse()
AgentisReceivedInResponse in interface Agent<C extends ClientContext,S extends ServerContext>public final boolean isReceivedInMessage()
AgentisReceivedInMessage in interface Agent<C extends ClientContext,S extends ServerContext>Agent.setReceivedInMessage(boolean)public final void setReceivedInMessage(boolean isReceivedInMessage)
AgentsetReceivedInMessage in interface Agent<C extends ClientContext,S extends ServerContext>Agent.isReceivedInMessage()public final int getPriority()
AgentgetPriority in interface Agent<C extends ClientContext,S extends ServerContext>public final void setPriority(int priority)
AgentsetPriority in interface Agent<C extends ClientContext,S extends ServerContext>public final void setSentTime(long sentTime)
TimeMeasurablesetSentTime in interface TimeMeasurablepublic final long getSentTime()
TimeMeasurablegetSentTime in interface TimeMeasurablepublic final void setReceivedTime(long receivedTime)
TimeMeasurablesetReceivedTime in interface TimeMeasurablepublic final long getReceivedTime()
TimeMeasurablegetReceivedTime in interface TimeMeasurablepublic final boolean isReceived()
AgentisReceived in interface Agent<C extends ClientContext,S extends ServerContext>public final long getProcessingDuration()
TimeMeasurablegetProcessingDuration in interface TimeMeasurablepublic final long getTotalDuration()
TimeMeasurablegetTotalDuration in interface TimeMeasurablepublic final long getTransferDuration()
TimeMeasurablegetTransferDuration in interface TimeMeasurablepublic final void setArgument(java.lang.Object arg,
boolean doZip)
AgentsetArgument in interface Agent<C extends ClientContext,S extends ServerContext>public final void setArgument(java.lang.Object arg)
AgentsetArgument in interface Agent<C extends ClientContext,S extends ServerContext>public final java.lang.Object getArgument()
AgentgetArgument in interface Agent<C extends ClientContext,S extends ServerContext>protected final int getZippedArgumentLength()
public <A extends Agent<C,S>> A sendForExecution() throws java.lang.Exception
AgentsendForExecution in interface Agent<C extends ClientContext,S extends ServerContext>java.lang.Exception - on failureAgent.sendForSilentExecution(),
Agent.sendForBooleanExecution()public final <A extends Agent<C,S>> A sendForSilentExecution()
AgentAgent.sendForExecution() just without throwing an Exception. The returned Agent should be
manually checked if it contains an Exception.sendForSilentExecution in interface Agent<C extends ClientContext,S extends ServerContext>Agent.sendForExecution(),
Agent.sendForBooleanExecution()public final boolean sendForBooleanExecution()
AgentAgent.sendForExecution() but does not return the agent, rather it returns true if
the agent has successfully being processed, false otherwise. In the case of agent processing
failure the error Exception is stored in the original input agent and can be requested from
there.sendForBooleanExecution in interface Agent<C extends ClientContext,S extends ServerContext>Agent.sendForExecution(),
Agent.sendForSilentExecution()public final void logFatal(java.lang.String message,
java.lang.Exception error)
logFatal in interface SimpleLogSupportlogFatal in class AbstractCrossPlatformObject<C extends ClientContext,S extends ServerContext>public final void logError(java.lang.String message,
java.lang.Exception error)
logError in interface SimpleLogSupportlogError in class AbstractCrossPlatformObject<C extends ClientContext,S extends ServerContext>public final void logError(java.lang.String message)
logError in interface SimpleLogSupportlogError in class AbstractCrossPlatformObject<C extends ClientContext,S extends ServerContext>public final void logWarning(java.lang.String message)
logWarning in interface SimpleLogSupportlogWarning in class AbstractCrossPlatformObject<C extends ClientContext,S extends ServerContext>public final void logInfo(java.lang.String message)
logInfo in interface SimpleLogSupportlogInfo in class AbstractCrossPlatformObject<C extends ClientContext,S extends ServerContext>public final void logVerbose(java.lang.String message)
logVerbose in interface SimpleLogSupportlogVerbose in class AbstractCrossPlatformObject<C extends ClientContext,S extends ServerContext>public final void logDebug(java.lang.String message)
logDebug in interface SimpleLogSupportlogDebug in class AbstractCrossPlatformObject<C extends ClientContext,S extends ServerContext>public final void logDump(java.lang.String message)
logDump in interface SimpleLogSupportlogDump in class AbstractCrossPlatformObject<C extends ClientContext,S extends ServerContext>Copyright © 2014 EsprIT-Systems. All Rights Reserved.