Skip to content

Update to the listeners() API (cloudsimplus#613) - #42

Merged
manoelcampos merged 1 commit into
masterfrom
update-listeners-api
Oct 28, 2026
Merged

manoelcampos merged 1 commit into
masterfrom
update-listeners-api

Conversation

@manoelcampos

@manoelcampos manoelcampos commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Updates this project to cloudsimplus/cloudsimplus#613, where the addOn...Listener()/removeOn...Listener() methods of the entities moved to the *Listeners views returned by listeners().

Changes

  • x.addOnFooListener(l) → x.listeners().addOnFoo(l) and x.removeOnFooListener(l) → x.listeners().removeOnFoo(l), for Simulation, DatacenterBroker, Datacenter, Host, Vm and Cloudlet.
  • The *Listeners views return themselves, so the 3 builder chains that ended with a listener registration (CloudletListenersExample1, CloudletListenersExample2_ResourceUsageAlongTime, VmListenersExample3_DynamicVmCreation) now register the listeners in a separate statement and return the created object.
  • Javadoc links to the old methods now point to the *Listeners classes (e.g. [SimulationListeners#addOnClockTick(EventListener)]), with the import added so the links stay short.
  • CLAUDE.md uses the new API in its example.

All examples compile. The 30 changed examples run to the end without exceptions (e.g. vertical/horizontal scaling, migration, pause and the listeners examples still trigger their listeners).

Engineering principles

Principle How it applies
Interface Segregation Principle (ISP) The code registers listeners through the focused *Listeners views, instead of methods spread across the entity interfaces.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manoelcampos manoelcampos self-assigned this Oct 28, 2026
@manoelcampos
manoelcampos merged commit 3fa1049 into master Oct 28, 2026
1 check passed
@manoelcampos
manoelcampos deleted the update-listeners-api branch October 28, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant