Class AbstractPollingBinding<P>
- java.lang.Object
- 
- com.inductiveautomation.perspective.gateway.binding.AbstractPollingBinding<P>
 
- 
- All Implemented Interfaces:
- Binding
 - Direct Known Subclasses:
- HttpBinding,- QueryBinding
 
 public abstract class AbstractPollingBinding<P> extends java.lang.Object implements Binding Abstract base class which takes care of executing bindings which have a polling option in a thread-safe manner. Also has a debouncing feature built in.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected static classAbstractPollingBinding.State
 - 
Field SummaryFields Modifier and Type Field Description protected BindingContextcontextprotected AbstractPollingBinding.Statestate- 
Fields inherited from interface com.inductiveautomation.perspective.gateway.api.BindingBAD_CONFIG, BAD_REF, BIDIRECTIONAL_KEY, INITIAL_VALUE, MDC_BINDING_TARGET, NOT_FOUND
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractPollingBinding(BindingContext bindingContext, java.lang.String pollingRateExpression, java.util.function.Function<P,QualifiedValue> fetchFunction, boolean valueCacheEnabled)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract PbuildFetchParameters()This method will be called when it is time to fetch a new value.protected abstract booleanisDirty()If any dependencies of the implementation have changed, this method should return true, which will kick off another execution if dependencies have changed while the execution was running.protected abstract booleanisReady()Indicates whether or not the instance of the underlying implementation is ready for execution.voidonUserRefresh()Called to prompt the binding to produce a value as soon as possible.java.util.Collection<PropertyReference>resolveReferences()protected voidscheduleNow()Schedule the next execution immediately.voidshutdown()Shut down the binding.voidstartup()Start up the binding.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.BindingisBidirectional, onTargetUpdated
 
- 
 
- 
- 
- 
Field Detail- 
contextprotected final BindingContext context 
 - 
stateprotected volatile AbstractPollingBinding.State state 
 
- 
 - 
Constructor Detail- 
AbstractPollingBindingprotected AbstractPollingBinding(@Nonnull BindingContext bindingContext, @Nullable java.lang.String pollingRateExpression, @Nonnull java.util.function.Function<P,QualifiedValue> fetchFunction, boolean valueCacheEnabled) throws ConfigurationException- Parameters:
- fetchFunction- A function to retrieve a new value. Must be a pure function of P - this function may not use anything but what is available through the parameter object, otherwise a memory leak will occur because the param object and the fetch function may outlive this binding instance in the- ValueCache.
- Throws:
- ConfigurationException
 
 
- 
 - 
Method Detail- 
resolveReferencespublic java.util.Collection<PropertyReference> resolveReferences() - Specified by:
- resolveReferencesin interface- Binding
 
 - 
startuppublic void startup() Description copied from interface:BindingStart up the binding. Will be called on-queue
 - 
shutdownpublic void shutdown() Description copied from interface:BindingShut down the binding. Will be called on-queue
 - 
isReadyprotected abstract boolean isReady() Indicates whether or not the instance of the underlying implementation is ready for execution.
 - 
isDirtyprotected abstract boolean isDirty() If any dependencies of the implementation have changed, this method should return true, which will kick off another execution if dependencies have changed while the execution was running.
 - 
buildFetchParametersprotected abstract P buildFetchParameters() This method will be called when it is time to fetch a new value. The parameter object must implement hashcode and equals, and must contain everything needed to run this parameter's fetch function. The parameter object will be given to theValueCache, which will then execute the fetch function if a new value is needed. This method will be called within a synchronized block holding this lock.
 - 
scheduleNowprotected void scheduleNow() Schedule the next execution immediately. This method is debounced.
 - 
onUserRefreshpublic void onUserRefresh() Description copied from interface:BindingCalled to prompt the binding to produce a value as soon as possible. This _not_ the normal way that bindings work. Bindings are expected to produce a value un-prompted after startup, and then again whenever they feel is appropriate. This is there to allow the user to call component.refreshBinding(property) and prompt a non-polling binding to run.- Specified by:
- onUserRefreshin interface- Binding
 
 
- 
 
-