Class PNSpoolEntry
- All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
PNMessageProp payload plus the bookkeeping that says where it was going and when to try again.Why a wrapper. Where a notification was going and when to retry it are properties of the attempt, not of the notification, so they live here and PNMessageProp stays pure payload. The same message object can therefore be spooled for several targets without any of them contaminating it.
Server-only. A spool entry never reaches a JavaScript client: it goes to disk as XML and comes back, Java to Java. Its own leaves may therefore use any Java property type, unlike the message it wraps. It is nevertheless registered in com/iizix/schema/base-properties.xml like every other serialised class, because PropFactory refuses to write an element for a class it has no entry for.
AN ENTRY IS IMMUTABLE ONCE IT HAS BEEN ADDED TO A PNSpoolerRoot. This is not a style preference; it is what makes the spool safe to snapshot. PropCnr.clone() takes the root's child array inside the tree and instance monitors but deep-clones the children outside them, so a clone-then-write persist is consistent only if no child mutates while it is being copied. Consequently:
- a retry is remove-then-add-new: build a fresh entry carrying the incremented retry count and the new next-retry time, add it, and remove the old one;
- never
setInt(RETRY_COUNT,...),setNextRetryTime(...)or any other in-place edit on an entry that is already a child of the spool root.
Temporal fields are DateTimeProp holding a ZonedDateTime, never a long and never a NumberProp. A ZonedDateTime carries the zone's identity and its rules, so a reader in another region can derive the correct offset for any date, daylight saving included - which a frozen OffsetDateTime cannot, and which a naked millisecond count loses entirely. It also sidesteps the NumberProp double precision cliff at 253, because it is a temporal object and not a number.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe creation timestamp property: "createdAt".static final StringThe notification payload property: "message".static final AtomThe atom of the notification payload property, i.e.static final StringThe next-attempt timestamp property: "nextRetryTime".static final StringThe attempt counter property: "retryCount".static final StringThe delivery target property: "target", i.e.static final StringThe expiry timestamp property: "ttlDeadline".Fields inherited from class PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_IDFields inherited from class GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2Fields inherited from interface IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_INCLUDE_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATEConstructor Summary
ConstructorsConstructorDescriptionCreates a spool entry container without name and with a null value.PNSpoolEntry(Atom propertyAtom) Creates a spool entry container with the specified name with a null value.PNSpoolEntry(Atom propertyAtom, PNMessageProp message, String target, ZonedDateTime createdAt, ZonedDateTime nextRetryTime, ZonedDateTime ttlDeadline, int retryCount) Creates a complete spool entry ready to be added to aPNSpoolerRoot.Method Summary
Modifier and TypeMethodDescriptionclone()Creates a clone out of this property.Gets the creation timestamp.Gets the notification payload.Gets the timestamp of the next delivery attempt.intGets the number of delivery attempts made so far.Gets the delivery target, i.e.Gets the expiry timestamp, past which the entry is dropped rather than replayed.booleansetCreatedAt(ZonedDateTime createdAt) Sets the creation timestamp.booleansetNextRetryTime(ZonedDateTime nextRetryTime) Sets the timestamp of the next delivery attempt.booleansetRetryCount(int retryCount) Sets the number of delivery attempts made so far.booleanSets the delivery target.booleansetTTLDeadline(ZonedDateTime ttlDeadline) Sets the expiry timestamp.Methods inherited from class PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getPredefinedProps, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isPropValueTreeLockNeeded, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropDispose, onPropRemoved, onPropTreeInitialized, onReferenceEvent, onVirtualContainerCreated, onVirtualizationCompleted, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verify, verifyInternalUseOnly, verifyTree, virtualizeMethods inherited from class GProp
addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getReferencePropNameNoAssert, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParentNoAssert, getTreeLock, hasChanged, hasCircularReferencesError, hashCode, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropUSER, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onPrepare, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onRemoteEvent, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getRelativePropName, getRootParent, getTreeLock, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, isSibling, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onEventSelf, onRemoteEvent, removePropError, removePropListener, renameProp, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IPropCnr
canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
Field Details
MESSAGE
The notification payload property: "message". APNMessageProp.- See Also:
TARGET
The delivery target property: "target", i.e. the subscription, user or region this entry was going to. AStringProp.- See Also:
RETRY_COUNT
The attempt counter property: "retryCount". AnIntProp.- See Also:
CREATED_AT
The creation timestamp property: "createdAt". ADateTimePropholding aZonedDateTime. This is the primary key of the spool's replay order.- See Also:
NEXT_RETRY_TIME
The next-attempt timestamp property: "nextRetryTime". ADateTimePropholding aZonedDateTime.- See Also:
TTL_DEADLINE
The expiry timestamp property: "ttlDeadline". ADateTimePropholding aZonedDateTime. An entry past this instant is dropped rather than replayed.- See Also:
MESSAGE_ATOM
The atom of the notification payload property, i.e.Atom.get(MESSAGE). APNMessagePropadded to a spool entry must carry this atom, so it is public: construct the payload asnew PNMessageProp(PNSpoolEntry.MESSAGE_ATOM).
Constructor Details
PNSpoolEntry
public PNSpoolEntry()Creates a spool entry container without name and with a null value.PNSpoolEntry
Creates a spool entry container with the specified name with a null value.- Parameters:
propertyAtom- The property atom.
PNSpoolEntry
public PNSpoolEntry(Atom propertyAtom, PNMessageProp message, String target, ZonedDateTime createdAt, ZonedDateTime nextRetryTime, ZonedDateTime ttlDeadline, int retryCount) throws PropException Creates a complete spool entry ready to be added to aPNSpoolerRoot.Once it has been added, the entry must not be modified: see the class documentation.
- Parameters:
propertyAtom- The property atom, unique within the spool root.message- The notification payload, which must carryMESSAGE_ATOMand must not already have a parent. The instance is added as a child, not copied.target- The subscription, user or region this entry is going to.createdAt- When the entry was created.nextRetryTime- When the next attempt is due.ttlDeadline- When the entry expires and must be dropped rather than replayed.retryCount- The number of attempts made so far.- Throws:
PropException- If a property cannot be added, or if the payload does not carryMESSAGE_ATOM.
Method Details
clone
Creates a clone out of this property.getMessage
Gets the notification payload.- Returns:
- The payload, or
nullfor a malformed entry that carries none.
getTarget
Gets the delivery target, i.e. the subscription, user or region this entry was going to.- Returns:
- The target, or
nullwhen not set.
setTarget
Sets the delivery target. Call only while building the entry, before it is added to the spool root.- Parameters:
target- The target.- Returns:
- true when this property container has been changed, false otherwise.
getRetryCount
public int getRetryCount()Gets the number of delivery attempts made so far.- Returns:
- The retry count, or zero when not set.
setRetryCount
public boolean setRetryCount(int retryCount) Sets the number of delivery attempts made so far. Call only while building the entry, before it is added to the spool root: incrementing this in place on a live spool child is exactly the mutation the class documentation forbids.- Parameters:
retryCount- The retry count.- Returns:
- true when this property container has been changed, false otherwise.
getCreatedAt
Gets the creation timestamp.- Returns:
- The creation timestamp, or
nullwhen not set or not a zoned date/time.
setCreatedAt
Sets the creation timestamp. Call only while building the entry.- Parameters:
createdAt- The creation timestamp, carrying the originating server's own zone.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added.NullPointerException- IfcreatedAtisnull.
getNextRetryTime
Gets the timestamp of the next delivery attempt.- Returns:
- The next-attempt timestamp, or
nullwhen not set or not a zoned date/time.
setNextRetryTime
Sets the timestamp of the next delivery attempt. Call only while building the entry.- Parameters:
nextRetryTime- The next-attempt timestamp.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added.NullPointerException- IfnextRetryTimeisnull.
getTTLDeadline
Gets the expiry timestamp, past which the entry is dropped rather than replayed.- Returns:
- The expiry timestamp, or
nullwhen not set or not a zoned date/time.
setTTLDeadline
Sets the expiry timestamp. Call only while building the entry.- Parameters:
ttlDeadline- The expiry timestamp.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added.NullPointerException- IfttlDeadlineisnull.