DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. About Javeleon's Special Hooks in the NetBeans Platform

About Javeleon's Special Hooks in the NetBeans Platform

Allan Gregersen user avatar by
Allan Gregersen
·
Jun. 22, 12 · Interview
Like (0)
Save
Tweet
Share
4.80K Views

Join the DZone community and get the full member experience.

Join For Free

Recently, there have been questions around some Javeleon specific code in the NetBeans source tree:

http://hg.netbeans.org/main-golden/file/963b40ce3181/o.n.bootstrap/src/org/netbeans/JaveleonModule.java

and:

http://hg.netbeans.org/main-golden/file/963b40ce3181/o.n.bootstrap/src/org/netbeans/StandardModule.java#l624

The above indicates that Javeleon has special hooks in the NetBeans Platform code. But not many know why this code is there and what it really does.

So here is the story behind the small piece of Javeleon-code that ended up in the NetBeans Platform!

Introduction

Before we get to the code some introduction is probably required. First of all, Javeleon uses classloaders to accomplish the task of class reloading. Basically, Javeleon replaces the class loader of a NetBeans module to allow new code to be loaded.

The inner workings of Javeleon then handles the state transfer between the old and the new module, as well as all of the assignability issues between differently versioned classes and objects that pop up because of this setup. Hence, Javeleon needs to know which class loaders should be marked as updateable, meaning that each class loaded by that particular class loader object is reloadable.

StandardModule & JaveleonModule

This brings us to the one-liner within the constructor of StandardModule$OneModuleClassLoader that simply registers the class loader object for a module. This will allow Javeleon to replace particular class loaders when specific modules are reloaded. Because Javeleon will bring multiple versions of class loaders in play within the running application, we need to keep track of the currently active class loaders, which is why the JaveleonModule class was introduced.

JaveleonModuleClassLoader

In order for any of this to take effect we have also introduced the JaveleonModuleClassLoader class that piggy backs on the standard module reloading mechanism in NetBeans IDE also known as the “Reload in target platform” feature. The class can be viewed here:

http://hg.netbeans.org/main-golden/file/963b40ce3181/core.startup/src/org/netbeans/core/startup/JaveleonModuleReloader.java

This class utilizes the mentioned hooks in o.n.bootstrap to actually perform module reloading. What happens is that whenever the "Reload in target platform" is invoked a check is performed to see if Javeleon is present in the running system. If not, normal module reloading is performed. Otherwise, JaveleonModuleReloader kicks in and creates a new class loader, also modifying the NetBeans system class loader to enable loading of the most up-to-date classes in the module system. Also as seen in the JaveleonModuleReloader class, the meta-data as defined by annotations that end up within the layer.xml file is reflected right into the running application, making developing with Javeleon a truly live experience.

Recent Changes

Before NetBeans 7.0 came out Javeleon relied on runtime binary patching of the said NetBeans Platform classes to inject the Javeleon functionality at load time. This solution worked well, but everytime the core NetBeans developers changed something that our patch-code relied on, we had to make a new version-specific patch. But since 7.0 we have been fortunate to have built-in support for Javeleon module reloading directly within the NetBeans Platform code tree.

For that, we send our gratitiute to the NetBeans team and especially Jesse Glick and Jaroslav Tulach who made it all possible.

Now you can enjoy real module reloading with Javeleon. If you haven't already tried Javeleon with you NetBeans Platform application, please do so and let us know about the outcome. We are always ready to step in helping people to get set up and in case of issues we usually fix those on a day to day basis.

We're currently running out of bugs, so we need more bug-reports to keep us busy making Javeleon for the NetBeans Platform even more stable.

Also, success stories where you've been using Javeleon for a project, wheather it is a commercial product, an OSS project or a personal hobby project always keep us motivated to do even better. So please, send any comments, bug-reports and/or your story with Javeleon to support@javeleon.org.

I hope you're enjoying Javeleon. We'll certainly keep reloading!

NetBeans Hook Loader (equipment)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • 11 Observability Tools You Should Know
  • Testing Level Dynamics: Achieving Confidence From Testing
  • 10 Most Popular Frameworks for Building RESTful APIs
  • A Gentle Introduction to Kubernetes

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: