streamcruncher.api
Class QueryConfig

java.lang.Object
  extended by streamcruncher.api.QueryConfig
All Implemented Interfaces:
java.io.Serializable

public abstract class QueryConfig
extends java.lang.Object
implements java.io.Serializable

Each registered Query has a configuration object that can be retrieved after parsing or at any time during the life of the Query from the API provided.

A handle to the instance must not be serialized and stored through a restart, but must be retrieved afresh after the Kernel restarts. Any changes made to the configuration will take effect immediately. This class is Thread-safe. All values have defaults.

See Also:
Serialized Form

Nested Class Summary
static class QueryConfig.QuerySchedulePolicy
           
static class QueryConfig.QuerySchedulePolicyValue
           
 
Field Summary
static int defaultAllowedPendingEvents
          2147483647
static float defaultEventWeight
          1.0f
static long defaultForceScheduleMarginMsecs
          250L
static long defaultResumeCheckTimeMsecs
          5000L
static QueryConfig.QuerySchedulePolicy defaultSchPolicy
           
static long defaultSchTimeMillis
          1500L
static long defaultStuckJobIntTimeMsecs
          45000L
 
Method Summary
 int getAllowedPendingEvents(java.lang.String key)
           
 java.util.Set<java.lang.String> getAllowedPendingEventsKeys()
           
 long getForceScheduleMarginMsecs()
           
 java.util.Set<java.lang.String> getKeys()
           
 int getQueryErrorCount()
           
 long getQueryLastRanAt()
           
 int getQueryRunCount()
           
 QueryConfig.QuerySchedulePolicyValue getQuerySchedulePolicy()
           
 long getResumeCheckTimeMsecs()
           
 long getStuckJobInterruptionTimeMsecs()
           
 float getUnprocessedEventWeight(java.lang.String key)
           
 java.util.Set<java.lang.String> getUnprocessedEventWeightKeys()
           
 boolean isQueryPaused()
           
 void pauseQuery()
           
 void resumeQuery()
           
 void setAllowedPendingEvents(java.lang.String key, int events)
           
 void setForceScheduleMarginMsecs(long forceScheduleMarginMsecs)
          The duration in milliseconds below which a forced schedule will not occur, even if the event-weights have crossed 1.0 if the time left before a natural/periodic schedule occurs is less than or equal to this margin.
 void setQuerySchedulePolicy(QueryConfig.QuerySchedulePolicyValue policyValue)
          Set the Query's scheduling policy.
 void setResumeCheckTimeMsecs(long resumeCheckTimeMsecs)
          The duration in milliseconds after which the Query wakes up to check if it has been resumed.
 void setStuckJobInterruptionTimeMsecs(long stuckJobInterruptionTimeMsecs)
          Some parts of the Query processing are multi-threaded.
 void setUnprocessedEventWeight(java.lang.String key, float weight)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultSchPolicy

public static final QueryConfig.QuerySchedulePolicy defaultSchPolicy

defaultSchTimeMillis

public static final long defaultSchTimeMillis
1500L

See Also:
Constant Field Values

defaultEventWeight

public static final float defaultEventWeight
1.0f

See Also:
Constant Field Values

defaultAllowedPendingEvents

public static final int defaultAllowedPendingEvents
2147483647

See Also:
Constant Field Values

defaultForceScheduleMarginMsecs

public static final long defaultForceScheduleMarginMsecs
250L

See Also:
Constant Field Values

defaultResumeCheckTimeMsecs

public static final long defaultResumeCheckTimeMsecs
5000L

See Also:
Constant Field Values

defaultStuckJobIntTimeMsecs

public static final long defaultStuckJobIntTimeMsecs
45000L

See Also:
Constant Field Values
Method Detail

getQueryLastRanAt

public long getQueryLastRanAt()
Returns:
Time in Milliseconds at which this Query ran successfully.

getQueryErrorCount

public int getQueryErrorCount()
Returns:
Number of consecutive Runs that faced errors. Resets to zero as soon as a Round succeeds.

getQueryRunCount

public int getQueryRunCount()
Returns:
Number of Runs that were successful.

getKeys

public java.util.Set<java.lang.String> getKeys()
Returns:
Unmodifiable Set of Keys that are used in Event-weights and Pending-events.

getQuerySchedulePolicy

public QueryConfig.QuerySchedulePolicyValue getQuerySchedulePolicy()

setQuerySchedulePolicy

public void setQuerySchedulePolicy(QueryConfig.QuerySchedulePolicyValue policyValue)
Set the Query's scheduling policy. The change will reflect only in the next cycle, whenever it is due, based on the current policy value.

Parameters:
policyValue -

getUnprocessedEventWeight

public float getUnprocessedEventWeight(java.lang.String key)

getUnprocessedEventWeightKeys

public java.util.Set<java.lang.String> getUnprocessedEventWeightKeys()

setUnprocessedEventWeight

public void setUnprocessedEventWeight(java.lang.String key,
                                      float weight)
Parameters:
key - The fully-qualified-name (Ex: "stocks.symbols", "traffic" etc) of the Input Stream/Table that supplies Events to this Query system.
weight -

getAllowedPendingEvents

public int getAllowedPendingEvents(java.lang.String key)

getAllowedPendingEventsKeys

public java.util.Set<java.lang.String> getAllowedPendingEventsKeys()

setAllowedPendingEvents

public void setAllowedPendingEvents(java.lang.String key,
                                    int events)
Parameters:
key - The fully-qualified-name (Ex: "stocks.symbols", "traffic" etc) of the Input-Stream/Table that supplies events to this Query system.
events -

isQueryPaused

public boolean isQueryPaused()

pauseQuery

public void pauseQuery()

resumeQuery

public void resumeQuery()

getForceScheduleMarginMsecs

public long getForceScheduleMarginMsecs()

setForceScheduleMarginMsecs

public void setForceScheduleMarginMsecs(long forceScheduleMarginMsecs)
The duration in milliseconds below which a forced schedule will not occur, even if the event-weights have crossed 1.0 if the time left before a natural/periodic schedule occurs is less than or equal to this margin.

Parameters:
forceScheduleMarginMsecs -

getResumeCheckTimeMsecs

public long getResumeCheckTimeMsecs()

setResumeCheckTimeMsecs

public void setResumeCheckTimeMsecs(long resumeCheckTimeMsecs)
The duration in milliseconds after which the Query wakes up to check if it has been resumed. If it has not been resumed, then it goes back to sleep.

Parameters:
resumeCheckTimeMsecs -

getStuckJobInterruptionTimeMsecs

public long getStuckJobInterruptionTimeMsecs()

setStuckJobInterruptionTimeMsecs

public void setStuckJobInterruptionTimeMsecs(long stuckJobInterruptionTimeMsecs)
Some parts of the Query processing are multi-threaded. If some Threads do not complete, then they will be interrupted. The current cycle of the Query will stop but does not affect subsequent runs.

Parameters:
stuckJobInterruptionTimeMsecs -


Copyright © 2006 - 2008 Ashwin Jayaprakash. All Rights Reserved. (Docs generated on 3-November-2007 )