K
- type of key read from input topicM
- type of message read from input topicU
- type of update message read/writtenpublic abstract class AbstractSpeedModelManager<K,M,U> extends Object implements SpeedModelManager<K,M,U>
SpeedModelManager
that provides default implementations.Constructor and Description |
---|
AbstractSpeedModelManager() |
Modifier and Type | Method and Description |
---|---|
void |
consume(Iterator<KeyMessage<String,U>> updateIterator,
org.apache.hadoop.conf.Configuration hadoopConf)
Called by the framework to initiate a continuous process of reading models, and reading
from the input topic and updating model state in memory, and issuing updates to the
update topic.
|
void |
consumeKeyMessage(String key,
U message,
org.apache.hadoop.conf.Configuration hadoopConf)
Convenience method that is called by the default implementation of
consume(Iterator, Configuration) , to process one key-message pair. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
buildUpdates, close
public void consume(Iterator<KeyMessage<String,U>> updateIterator, org.apache.hadoop.conf.Configuration hadoopConf) throws IOException
SpeedModelManager
consume
in interface SpeedModelManager<K,M,U>
updateIterator
- iterator to read models fromhadoopConf
- Hadoop context, which may be required for reading from HDFSIOException
- if an error occurs while reading updatespublic void consumeKeyMessage(String key, U message, org.apache.hadoop.conf.Configuration hadoopConf) throws IOException
consume(Iterator, Configuration)
, to process one key-message pair.
It does nothing, except log the message. This should generally be overridden
if and only if consume(Iterator, Configuration)
is not.key
- key to process (non-null)message
- message to processhadoopConf
- Hadoop configuration for processIOException
- if an error occurs while processing the messageCopyright © 2014–2018. All rights reserved.