|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.s4.core.App
public abstract class App
Container base class to hold all processing elements. It is also where one defines the application graph: PE prototypes, internal streams, input and output streams.
Nested Class Summary | |
---|---|
static class |
App.ClockType
The internal clock can be configured as "wall clock" or "event clock". |
Constructor Summary | |
---|---|
App()
|
Method Summary | ||
---|---|---|
void |
addStream(Streamable<Event> stream)
|
|
void |
close()
|
|
protected
|
createInputStream(java.lang.String streamName,
KeyFinder<T> finder,
ProcessingElement... processingElements)
Creaters an "input" stream, i.e. |
|
protected
|
createInputStream(java.lang.String streamName,
ProcessingElement... processingElements)
|
|
protected
|
createOutputStream(java.lang.String name)
|
|
protected
|
createOutputStream(java.lang.String name,
KeyFinder<Event> finder)
Creates a "remote" stream, i.e. |
|
|
createPE(java.lang.Class<T> type)
Creates a ProcessingElement prototype. |
|
|
createPE(java.lang.Class<T> type,
java.lang.String name)
Creates a ProcessingElement prototype. |
|
|
createSlidingWindowPE(java.lang.Class<T> type,
long slotDuration,
java.util.concurrent.TimeUnit timeUnit,
int numSlots,
SlotFactory slotFactory)
|
|
|
createStream(java.lang.Class<T> type)
|
|
protected
|
createStream(java.lang.String name,
KeyFinder<T> finder,
java.lang.Class<T> eventType,
ProcessingElement... processingElements)
Creates a stream with a specific key finder. |
|
protected
|
createStream(java.lang.String name,
KeyFinder<T> finder,
ProcessingElement... processingElements)
|
|
protected
|
createStream(java.lang.String name,
ProcessingElement... processingElements)
|
|
CheckpointingFramework |
getCheckpointingFramework()
|
|
App.ClockType |
getClockType()
|
|
int |
getId()
|
|
ProcessingElement |
getPE(java.lang.String name)
|
|
Receiver |
getReceiver()
|
|
Sender |
getSender()
|
|
SerializerDeserializer |
getSerDeser()
|
|
java.util.List<Streamable<Event>> |
getStreams()
|
|
long |
getTime()
The internal clock is configured as "wall clock" or "event clock" when this object is created. |
|
long |
getTime(java.util.concurrent.TimeUnit timeUnit)
The internal clock is configured as "wall clock" or "event clock" when this object is created. |
|
void |
init()
|
|
protected abstract void |
onClose()
This method is called by the container before unloading the application. |
|
protected abstract void |
onInit()
This method is called by the container to initialize applications. |
|
protected abstract void |
onStart()
|
|
void |
setClockType(App.ClockType clockType)
Set the App.ClockType . |
|
void |
setId(int id)
|
|
void |
start()
This method is called by the container after initialization. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public App()
Method Detail |
---|
public int getId()
public void setId(int id)
id
- the unique id for this apppublic ProcessingElement getPE(java.lang.String name)
public void addStream(Streamable<Event> stream)
public java.util.List<Streamable<Event>> getStreams()
protected abstract void onStart()
public final void start()
protected abstract void onInit()
public final void init()
protected abstract void onClose()
public final void close()
public long getTime()
public long getTime(java.util.concurrent.TimeUnit timeUnit)
timeUnit
-
public void setClockType(App.ClockType clockType)
App.ClockType
.
clockType
- the clockTyoe for this app must be App.ClockType.WALL_CLOCK
(default) or
App.ClockType.EVENT_CLOCK
public App.ClockType getClockType()
public Sender getSender()
public Receiver getReceiver()
public SerializerDeserializer getSerDeser()
public CheckpointingFramework getCheckpointingFramework()
protected <T extends Event> Stream<T> createStream(java.lang.String name, KeyFinder<T> finder, java.lang.Class<T> eventType, ProcessingElement... processingElements)
If the value of the key is "joe" and the target PE prototypes are AddressPE and WorkPE, the event will be delivered to the instances with key="joe" in the PE prototypes AddressPE and WorkPE.
name
- the name of the streamfinder
- the key finder objecteventType
- expected event typeprocessingElements
- the target processing elements
protected <T extends Event> Stream<T> createStream(java.lang.String name, KeyFinder<T> finder, ProcessingElement... processingElements)
createStream(String, KeyFinder, Class, ProcessingElement...)
protected <T extends Event> Stream<T> createStream(java.lang.String name, ProcessingElement... processingElements)
createStream(String, KeyFinder, Class, ProcessingElement...)
public <T extends Event> Stream<T> createStream(java.lang.Class<T> type)
createStream(String, KeyFinder, Class, ProcessingElement...)
protected <T extends Event> RemoteStream createOutputStream(java.lang.String name, KeyFinder<Event> finder)
name
- stream name, shared across communicating clustersfinder
- key finder
protected <T extends Event> RemoteStream createOutputStream(java.lang.String name)
createOutputStream(String, KeyFinder)
protected <T extends Event> Stream<T> createInputStream(java.lang.String streamName, KeyFinder<T> finder, ProcessingElement... processingElements)
streamName
- name of the remote streamfinder
- key finderprocessingElements
- target processing elements
protected <T extends Event> Stream<T> createInputStream(java.lang.String streamName, ProcessingElement... processingElements)
createInputStream(String, KeyFinder, ProcessingElement...)
public <T extends ProcessingElement> T createPE(java.lang.Class<T> type, java.lang.String name)
ProcessingElement
prototype.
type
- the processing element type.name
- a name for this PE prototype.
public <T extends ProcessingElement> T createPE(java.lang.Class<T> type)
ProcessingElement
prototype.
type
- the processing element type.
public <T extends AbstractSlidingWindowPE> T createSlidingWindowPE(java.lang.Class<T> type, long slotDuration, java.util.concurrent.TimeUnit timeUnit, int numSlots, SlotFactory slotFactory)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |