public abstract class AbstractImporter
extends java.lang.Object
implements org.voltdb.InternalConnectionContext, org.voltdb.importer.ImporterLifecycle, org.voltdb.importer.ImporterLogger
while (shouldRun())
loop,
which will make sure that that the importer will stop its work when the framework calls stop. The framework stops the importer by calling stopImporter
, which will stop the executor service and
call stop
on the importer instance to close resources used by the specific importer.
stop(resourceID)
will also be called on the importer instances when the resources are redistributed
because of addition/deletion of nodes to the cluster.
Modifier and Type | Method and Description |
---|---|
boolean |
callProcedure(org.voltdb.importer.Invocation invocation,
org.voltdb.client.ProcedureCallback callback)
This should be used importer implementations to execute a stored procedure.
|
void |
debug(java.lang.Throwable t,
java.lang.String msgFormat,
java.lang.Object... args)
Log a DEBUG level log message.
|
void |
error(java.lang.Throwable t,
java.lang.String msgFormat,
java.lang.Object... args)
Log a ERROR level log message.
|
abstract java.net.URI |
getResourceID()
Returns the resource id for which this importer was started.
|
java.lang.String |
getTaskThreadName() |
boolean |
hasTransaction() |
void |
info(java.lang.Throwable t,
java.lang.String msgFormat,
java.lang.Object... args)
Log a INFO level log message.
|
boolean |
isDebugEnabled() |
void |
rateLimitedLog(org.voltcore.logging.Level level,
java.lang.Throwable cause,
java.lang.String format,
java.lang.Object... args)
This rate limited log must be used by the importers to log messages that may
happen frequently and must be rate limited.
|
void |
reportInitializedStat(java.lang.String procName) |
void |
setImportServerAdapter(org.voltdb.importer.ImporterServerAdapter adapter)
Passes in the server adapter that may be used by this importer to access the server,
like calling a procedure.
|
boolean |
shouldRun()
This method indicates if the importer has been stopped or if it should continue running.
|
abstract void |
stop()
This is called by the importer framework to stop the importer.
|
void |
stopImporter()
Called to stop the importer from processing more data.
|
void |
warn(java.lang.Throwable t,
java.lang.String msgFormat,
java.lang.Object... args)
Log a WARN level log message.
|
public boolean hasTransaction()
hasTransaction
in interface org.voltdb.importer.ImporterLifecycle
public final void setImportServerAdapter(org.voltdb.importer.ImporterServerAdapter adapter)
adapter
- the server adapter that may be used by this to access the server.public final boolean shouldRun()
shouldRun
in interface org.voltdb.importer.ImporterLifecycle
public boolean callProcedure(org.voltdb.importer.Invocation invocation, org.voltdb.client.ProcedureCallback callback)
invocation
- Invocation object with procedure name and parameter informationcallback
- the callback that will receive procedure invocation statuspublic void stopImporter()
public void reportInitializedStat(java.lang.String procName)
public void rateLimitedLog(org.voltcore.logging.Level level, java.lang.Throwable cause, java.lang.String format, java.lang.Object... args)
rateLimitedLog
in interface org.voltdb.importer.ImporterLogger
level
- the log levelcause
- cause exception, if there is oneformat
- error message formatargs
- arguments to format the error messagepublic boolean isDebugEnabled()
isDebugEnabled
in interface org.voltdb.importer.ImporterLogger
public void debug(java.lang.Throwable t, java.lang.String msgFormat, java.lang.Object... args)
debug
in interface org.voltdb.importer.ImporterLogger
msgFormat
- Formatt
- Throwable to logpublic void error(java.lang.Throwable t, java.lang.String msgFormat, java.lang.Object... args)
error
in interface org.voltdb.importer.ImporterLogger
msgFormat
- Formatt
- Throwable to logpublic void info(java.lang.Throwable t, java.lang.String msgFormat, java.lang.Object... args)
info
in interface org.voltdb.importer.ImporterLogger
msgFormat
- Formatt
- Throwable to logpublic void warn(java.lang.Throwable t, java.lang.String msgFormat, java.lang.Object... args)
warn
in interface org.voltdb.importer.ImporterLogger
msgFormat
- Formatt
- Throwable to logpublic abstract java.net.URI getResourceID()
public java.lang.String getTaskThreadName()
public abstract void stop()
stop
in interface org.voltdb.importer.ImporterLifecycle