You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f58ccb1
Browse filesBrowse the repository at this point in the historyBrowse files
Replaces SciJava Common's event package without porting it, so the bushe
fork and its attribution obligation are gone.
subscribe(Class<E>, Consumer<? super E>) is type-safe, needs no
reflection and therefore no `opens`, and returns a Subscription. The
@eventhandler ergonomics are not lost: scijava-context already reflects
over services, so it can scan annotated methods, register them as
lambdas, and hold the subscriptions -- the convenience lives in the tier
that already pays for reflection, and a service author still never writes
cleanup code.
Subscribers are held strongly. SciJava Common held them weakly, which
produced handlers that silently stopped firing, and forced a WeakHashMap
named keepEm whose only job was to stop the proxies being collected too
early. Cleanup is structural instead: EventBus.close() drops every
subscription, and a context calls it on dispose.
There is deliberately no shared instance. A bus is nothing but shared
mutable subscriber state, so an ambient singleton would let two
application contexts hear each other's events; each context owns one bus.
NB: this is the opposite call from Locations.get() and DataHandles.get(),
which are safe to share precisely because they hold no such state.
Also:
- Class-hierarchy dispatch is kept, since it is what makes a bus more
than a listener list, and any object may be an event -- no SciJavaEvent
base type, so a class from another library can be one.
- Consumption is opt-in through a Consumable interface on the event,
modeled on AWT's InputEvent.consume(), so toolkit-style input events
can stop propagation without every event paying for the concept.
- Subscriber order is by scijava-priority, descending, ties broken by
subscription order. It matters most for consumable events, where the
first subscriber gets first refusal.
- A failing subscriber does not truncate delivery: everyone still
receives the event and the failures are thrown together afterward as an
EventDeliveryException, first as cause and the rest suppressed.
Cancellation is the exception -- an interrupted subscriber, or one
throwing CancellationException, stops delivery at once rather than
being buried among unrelated failures.
EventHistory is dropped; a subscriber on Object.class reproduces it.
scijava-listeners is not folded in after all: a listener list is the
right primitive for "this object notifies its observers", and is a
different thing from a bus.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gJpzGd3ksbME4CN6Tu2ni
Copy file name to clipboardExpand all lines: docs/migration.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,7 +103,8 @@ A **dropped** row is a successful outcome, not a gap.
103
103
|`io.nio.ByteBufferByteBank`|`org.scijava.io3.ByteBufferByteBank`, with `direct()` factories and an `isDirect()` accessor. Off-heap direct buffers are its reason to exist alongside `ByteArrayByteBank`: bytes reach native code and shared memory without a copy, which matters increasingly for Appose's named shared memory blocks. **Bug fixed in the port:** growing a direct bank reallocated with `ByteBuffer.allocate`, quietly moving the bytes back onto the heap; it now grows through the bank's own provider | ported |
104
104
|`io.nio.NIOService`|**not ported** — it wraps two JDK calls behind a system-property switch, was inherited from old Bio-Formats code, and SCIFIO only exposes it as a gateway accessor (`SCIFIO.nio()`) without using it. Nothing in the ported architecture precludes `FileChannel`-based handles later: a handle is free to open a channel, and a byte bank is free to be backed by a mapped buffer | dropped |
105
105
|`io` (`IOPlugin`, `IOService`, `RecentFileService`) |`scijava-io3` (Phase 1), pending review of what is still used | open |
106
-
|`event`, `event.bushe`|`org.scijava.events` — clean-room rewrite, not a port (Phase 1) | planned |
106
+
|`event`, `event.bushe`|`org.scijava.events`, a clean-room rewrite. `EventService` becomes `EventBus`, one per context and with no shared instance. `subscribe` takes a lambda rather than scanning `@EventHandler` methods, and returns a `Subscription`; subscribers are held strongly and dropped by `EventBus.close()`. Events need no `SciJavaEvent` base type. Consumption is opt-in via `Consumable`; subscriber order is by `scijava-priority`| ported |
107
+
|`event.EventHistory`, `DefaultEventHistory`| dropped — a subscriber on `Object.class` reproduces it. The macro-recorder need behind it deserves an explicit layer | dropped |
0 commit comments