JSR-282 SI 8.2 ------------------------------------------------ Summary --------------------- Add an option for AEH that will cause the AEH's memory area to be entered each time the AEH invokes handleAsyncEvent() Specification References --------------------- The AsyncEventHandler constructors, handleAsyncEvent() and run() methods. Memory semantic 17. Problem being Addressed --------------------- Two problems: Non-default initial memory areas that are not incremented/decremented per release are painful to finalize. Applications may not always want objects in the initial memory area to persist. Now, they have to enter a new scope in handleAsyncEvent to get per-release allocation. Proposed Solution Summary --------------------- Add a new all-args constructor that includes a boolean that calls for per-release inc/dec of the initial memory area's release count. AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters group, boolean nonheap, boolean reenterMemory, java.lang.Runnable logic) The new option is only interesting when the initial memory area is non-default, so this constructor should be enough. The alternative would be to add alternate forms for all three constructors that take MemoryArea parameters. Semantics --------------------- Constructor ----------------- AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters group, boolean nonheap, boolean reenterMemory, java.lang.Runnable logic) Like the same constructor without reenterMemory, except for the reenterMemoryArea @param If reenterMemoryArea is true the reference count of area may be zero before and after any invocation of handleAsyncEvent(). isReenterMemory() ----------------- Return the reenter memory status for this AEH. handleAsyncEvent ----------------- If the initial memory area of this AsyncEventHandler is a ScopedMemory, the initial memory area's reference count does not drop below one between invocations of handleAsyncEvent() unless this AsyncEventHandler becomes unfireable or this AsyncEventHandler was constructed with reenterMemory set to true. Run() ----------------- In the pseudo-code, while (getAndDecrementPendingFireCount() > 0) if (reenterMemory){ enter area handleAsyncEvent(); leave area } else { handleAsyncEvent(); } Memory Semantics ----------------- 17, bullet two the scoped memory area is the non-default initial memory area for a fireable AsyncEventHandler that was not constructed with reenterMemory set to true. Discussion Points --------------------- This section intentionally left blank. Compatibility Issues --------------------- Since the new behavior is not the default it should not introduce any incompatibility.