Posts Tagged ‘RedHat’
[DevoxxBE2013] Introducing Vert.x 2.0: Taking Polyglot Application Development to the Next Level
Tim Fox, the visionary project lead for Vert.x at Red Hat, charts the course of this lightweight, high-performance application platform for the JVM. With a storied tenure at JBoss and VMware—where he spearheaded HornetQ messaging and RabbitMQ integrations—Tim unveils Vert.x 2.0’s maturation into an independent powerhouse. His session delves into the revamped module system, Maven/Bintray reusability, and enhanced build tool/IDE synergy, alongside previews of Scala, Clojure support, and Node.js compatibility.
Vert.x 2.0 empowers polyglot, reactive applications, blending asynchronous eventing with synchronous legacy APIs via worker verticles. Tim’s live demos illustrate deploying modules dynamically, underscoring Vert.x’s ecosystem for mobile, web, and enterprise scalability.
Core API Refinements and Asynchronous Foundations
Tim highlights Vert.x’s event-driven core, refined in 2.0 with intuitive APIs for non-JVM languages. He demonstrates verticles—lightweight actors—for handling requests asynchronously, avoiding blocking calls.
This reactive model, Tim explains, scales to thousands of connections, ideal for real-time web apps, contrasting traditional thread-per-request pitfalls.
Module System and Ecosystem Expansion
The new module system, Tim showcases, leverages Maven repositories for seamless dependency management. He deploys a web server via module names, pulling artifacts from Bintray—eliminating manual installations.
This reusability fosters a vibrant ecosystem, with core modules for HTTP, MySQL (via reversed-engineered async drivers), and more, enabling rapid composition.
Build Tool and IDE Integration
Vert.x 2.0’s Maven/Gradle plugins streamline development, as Tim demos: configure a pom.xml, run mvn vertx:run, and launch a cluster. IDE support, via plugins, offers hot-reloading and debugging.
These integrations, Tim notes, lower barriers, allowing developers to iterate swiftly without Vert.x-specific tooling.
Polyglot Horizons: Scala, Clojure, and Node.js
Tim previews Scala/Clojure bindings, enabling functional paradigms on Vert.x’s event bus. Node.js compatibility, via drop-in modules, bridges JavaScript ecosystems, allowing polyglot teams to collaborate seamlessly.
This inclusivity, Tim asserts, broadens Vert.x’s appeal, supporting diverse languages without sacrificing performance.
Worker Verticles for Legacy Compatibility
For synchronous APIs like JDBC, Tim introduces worker verticles—executing on thread pools to prevent blocking. He contrasts with pure async MySQL drivers, offering flexibility for hybrid applications.
This pragmatic bridge, Tim emphasizes, integrates existing Java libraries effortlessly.
Links:
[DevoxxFR2013] Invokedynamic in 45 Minutes: Unlocking Dynamic Language Performance on the JVM
Lecturer
Charles Nutter has spent over a decade as a Java developer and more than six years leading the JRuby project at Red Hat. Co-lead of JRuby, he works to fuse Ruby’s elegance with the JVM’s power while contributing to other JVM languages and educating the community on advanced virtual machine capabilities. A proponent of open standards, he aims to keep the JVM the premier managed runtime through innovations like invokedynamic.
Abstract
Charles Nutter demystifies invokedynamic, the JVM bytecode instruction introduced in Java 7 to optimize dynamic language implementation. He explains its mechanics—bootstrap methods, call sites, and method handles—through progressive examples, culminating in a toy language interpreter. The presentation contrasts invokedynamic with traditional invokevirtual and invokeinterface, benchmarks performance, and illustrates how it enables JRuby and other languages to approach native Java speeds, paving the way for polyglot JVM ecosystems.
The Problem with Traditional Invocation: Static Assumptions in a Dynamic World
Nutter begins with the JVM’s historical bias toward statically-typed languages. The four classic invocation instructions—invokevirtual, invokeinterface, invokestatic, and invokespecial—assume method resolution at class loading or compile time. For dynamic languages like Ruby, Python, or JavaScript, method existence and signatures are determined at runtime, forcing expensive runtime checks or megamorphic call sites.
JRuby, prior to invokedynamic, relied on reflection or generated bytecodes per call, incurring significant overhead. Even interface-based dispatch suffered from inline cache pollution when multiple implementations competed.
Invokedynamic Mechanics: Bootstrap, Call Sites, and Method Handles
Introduced via JSR-292, invokedynamic defers method linking to a user-defined bootstrap method (BSM). The JVM invokes the BSM once per call site, passing a CallSite object, method name, and type. The BSM returns a MethodHandle—a typed, direct reference to a method—installed into the call site.
Nutter demonstrates a simple BSM:
public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type) {
MethodHandle mh = lookup.findStatic(MyClass.class, "target", type);
return new ConstantCallSite(mh);
}
The resulting invokedynamic instruction executes the linked handle directly, bypassing vtable lookups.
Call Site Types and Guarded Invocations
Call sites come in three flavors: ConstantCallSite for immutable linkages, MutableCallSite for dynamic retargeting, and VolatileCallSite for atomic updates. Guarded invocations combine a test (guard) with a target handle:
MethodHandle guard = lookup.findStatic(Guards.class, "isString", MethodType.methodType(boolean.class, Object.class));
MethodHandle target = lookup.findStatic(Handlers.class, "handleString", type);
MethodHandle fallback = lookup.findStatic(Handlers.class, "handleOther", type);
MethodHandle guarded = MethodHandles.guardWithTest(guard, target, fallback);
The JVM inlines the guard, falling back only on failure, enabling polymorphic inline caches.
Building a Toy Language: From Parser to Execution
Nutter constructs a minimal scripting language with arithmetic and print statements. The parser generates invokedynamic instructions with a shared BSM. The BSM resolves operators (+, -, *) to overloaded Java methods based on argument types, caching results per call site.
Execution flows through method handles, achieving near-Java performance. He extends the example to support runtime method missing, emulating Ruby’s method_missing.
Performance Analysis: Benchmarking Invocation Strategies
Nutter presents JMH benchmarks comparing invocation types. invokestatic serves as baseline; invokevirtual adds vtable dispatch; invokeinterface incurs interface check. invokedynamic with ConstantCallSite matches invokestatic, while MutableCallSite aligns with invokevirtual.
Key insight: the JVM’s optimizer treats stable invokedynamic sites as monomorphic, inlining aggressively. JRuby leverages this for core methods, reducing dispatch overhead by 10-100x.
Implications for JVM Languages and Future Evolution
Invokedynamic enables true polyglot JVMs. Nashorn (JavaScript), Dynalink, and Truffle frameworks build upon it. Future enhancements include value types and specialized generics, further reducing boxing.
Nutter concludes that invokedynamic fulfills John Rose’s vision: dynamic dispatch no slower than static, ensuring the JVM’s longevity as a universal runtime.
Links:
[DevoxxBE2013] Java EE 7’s Java API for WebSocket
Arun Gupta, Director of Developer Advocacy at Red Hat, unveils the transformative capabilities of the Java API for WebSocket in Java EE 7. A veteran of Sun Microsystems and Oracle, Arun has championed Java technologies globally, authoring extensive blogs and a best-selling book. His session explores WebSocket’s role in enabling efficient, bidirectional communication, eliminating the need for long polling or AJAX. Through live demonstrations, he illustrates server-side endpoints and client-side integrations, showcasing how this API empowers developers to craft responsive web and rich client applications.
WebSocket, a cornerstone of HTML5, facilitates real-time data exchange over a single TCP connection. Arun highlights its scalability, with GlassFish handling thousands of connections, and introduces tools like Autobahn for compliance testing. This API positions Java developers to build dynamic, scalable systems that complement RESTful architectures.
WebSocket Fundamentals and API Design
Arun introduces WebSocket’s departure from HTTP’s request-response model, leveraging a single, persistent connection. Using annotations like @ServerEndpoint, he demonstrates creating a chat application where messages flow instantly. The client API, accessible from browsers or Java applications, enables seamless integration.
This simplicity, Arun notes, reduces latency, making WebSocket ideal for real-time applications like live updates or collaborative tools.
Server-Side Scalability and Performance
Scalability is a key strength, Arun explains, with WebSocket supporting millions of file descriptors on Linux. He recounts Oracle’s GlassFish tests, achieving robust performance with thousands of connections. The Autobahn test suite, he suggests, validates compliance and load capacity.
Forthcoming WildFly tests, Arun adds, will further benchmark performance, ensuring reliability in production environments.
Complementing REST with WebSocket
Arun clarifies that WebSocket complements JAX-RS, not replaces it. He illustrates a hybrid design: REST for stateless queries, WebSocket for real-time updates. A stock ticker demo shows prices pushed to clients, blending both paradigms.
This synergy, Arun argues, enhances application flexibility, with Java EE 8 discussions exploring further integrations.
Community Engagement and Future Directions
Arun encourages joining Java EE expert groups, noting their transparent processes. Recent community gatherings, he mentions, discussed enhancing WebSocket’s role. He advocates contributing to shape Java EE 8, ensuring it meets developer needs.
This collaborative approach, Arun emphasizes, drives innovation, aligning WebSocket with evolving web standards.
Links:
[DevoxxFR2013] JCP & Adopt a JSR Workshop
Lecturer
Patrick Curran chairs the Java Community Process (JCP), overseeing membership, processes, and Executive Committee. With over 20 years in software, including 15 at Sun, he led Java Conformance Engineering and chaired related councils. Active in W3C and OASIS.
Arun Gupta directs Developer Advocacy at Red Hat, focusing on JBoss Middleware. A Java EE founding member at Sun, he drove global adoption; at Oracle, he launched Java EE 7.
Mike Seghers, an IT consultant since 2001, specializes in Java enterprise web apps using frameworks like Spring, JSF. Experienced in RIA and iOS, he engages developer communities.
Abstract
Patrick Curran, Arun Gupta, and Mike Seghers’s workshop guides joining the Java Community Process (JCP) and participating in Adopt-a-JSR. They explain membership, transparency, and tools for JUG involvement like hackathons. Focusing on Java EE 8, the session analyzes collaboration benefits, demonstrating practical contributions for standard evolution.
Understanding JCP: Membership and Participation Pathways
Curran outlines JCP membership: free for individuals via jcp.org, requiring agreements; paid for corporations/non-profits ($2,000-$5,000). Java User Groups join as associates, nominating representatives.
Adopt-a-JSR encourages JUGs to engage JSRs: review specs, test implementations, provide feedback. This democratizes development, ensuring community input.
Gupta details Java EE 8 focus: HTML5, cloud, modularity. Adopt-a-JSR aids via mailing lists, issue trackers, wikis.
Practical Engagement: Tools and Initiatives for Collaboration
Tools include mailing lists for discussions, JIRA for bugs, GitHub for code. JUGs organize hack days, building samples.
Seghers demos Belgian JUG’s app: uses JSF, EJB, JPA for urban travelers game. Source on GitHub, integrates WebSockets.
This hands-on approach educates, uncovers issues early.
Case Studies: Global Adopt-a-JSR Impact
Examples: London JUG’s multiple JSR contributions; SouJava’s CDI focus; Morocco JUG’s hackathons. Chennai JUG built apps; Egypt JUG presented at conferences.
These illustrate visibility, skill-building, influence on standards.
Broader Implications: Enhancing Transparency and Community
JCP 2.8 mandates open Expert Groups, encouraging participation. Adopt-a-JSR amplifies this, benefiting platforms via diverse input.
Curran urges minimal commitments: feedback, testing. Gupta highlights launch opportunities.
Workshop fosters collaborative ecosystem, strengthening Java’s future.
Links:
[DevoxxBE2012] Raise Your Java EE 6 Productivity Bar with JBoss Forge
Koen Aers, a Red Hat engineer driving Eclipse integration for JBoss Forge, alongside guest Ivan St. Ivanov from SAP, explored boosting Java EE 6 development efficiency. Koen, with a background in jBPM and workflow editors, refreshed on Forge’s role in simplifying complex setups for novices.
Forge, a command-line tool using CDI, incrementally adds features to projects. Commands scaffold entities, UI, and services swiftly.
They demonstrated creating a project, adding persistence with JPA, generating entities like Speaker and Session, and scaffolding JSF views.
For tasks beyond built-ins, plugins extend functionality. Ivan showed developing an Envers plugin for auditing, installing it, and applying to entities.
Integration with IDEs like Eclipse opens Forge’s power graphically.
Their demo built a conference app, adding history views with auditing, showcasing rapid enhancements.
Koen and Ivan emphasized Forge’s elevation of productivity, enabling faster iterations.
Introducing Forge and Basic Workflows
Koen explained Forge’s shell for navigating projects, setting up Maven builds, and adding facets like JPA for persistence.xml configuration.
Commands generate entities with fields, relationships via annotations.
Scaffolding and UI Generation
Scaffolding creates CRUD operations and JSF views from entities, deploying to servers like AS7.
They customized views, adding fields and relations.
Extending with Plugins
Ivan illustrated plugin creation: facets detect capabilities, commands execute actions like adding dependencies.
The Envers plugin audited entities, integrating seamlessly.
IDE Integration and Real-World Application
Eclipse plugins embed Forge consoles, enhancing workflows.
In demo, they audited entities, added history beans, and viewed changes, proving incremental power.
Koen and Ivan’s insights highlighted Forge’s transformative impact on Java EE development.
Links:
[DevoxxFR2012] Drawing a Language: An Exploration of Xtext for Domain-Specific Languages
Lecturer
Jeff Maury is an experienced product manager at Red Hat, specializing in Java technologies for large-scale systems. Previously, as Java Offer Manager at Syspertec, he architected solutions integrating open systems like Java and .NET. Co-founder of SCORT, a firm focused on enterprise system integration, Jeff has leveraged Xtext to develop advanced development tools, providing hands-on insights into DSL ecosystems. An active contributor to Java communities, he shares expertise through conferences and practical implementations.
Abstract
This article analyzes Jeff Maury’s introduction to Xtext, Eclipse’s framework for crafting domain-specific languages (DSLs), structured across theoretical underpinnings, real-world applications, and hands-on development. It dissects Xtext’s grammar definition, model generation, and editor integration, emphasizing its role in bridging business concepts with executable code. Contextualized within the rise of model-driven engineering, the discussion evaluates Xtext’s components—lexer, parser, and scoping—for enabling concise, domain-tailored notations. Through the IzPack editor example, it assesses methodologies for validation, refactoring, and Java interoperability. Implications span productivity gains in specialized tools, reduced cognitive load for non-programmers, and ecosystem extensions via EMF, positioning Xtext as a versatile asset for modern software engineering.
Theoretical Foundations: Components and DSL Challenges
Domain-specific languages address the gap between abstract business requirements and general-purpose programming, allowing experts to articulate solutions in familiar terms. Jeff frames DSLs as targeted notations that encapsulate métier concepts, fostering adoption by broadening accessibility beyond elite coders. Challenges include syntax design for intuitiveness, semantic validation, and tooling for editing—areas where traditional languages falter due to verbosity and rigidity.
Xtext resolves these by generating complete language infrastructures from a declarative grammar. At its core, the grammar file (.xtext) defines rules akin to EBNF, specifying terminals (e.g., keywords, IDs) and non-terminals (e.g., rules for structures). The lexer tokenizes input, while the parser constructs an abstract syntax tree (AST) via ANTLR integration, ensuring robustness against ambiguities.
Model generation leverages Eclipse Modeling Framework (EMF), transforming the grammar into Ecore metamodels—classes representing language elements with attributes, references, and containment hierarchies. Scoping rules dictate name resolution, preventing dangling references, while validation services enforce constraints like type safety. Jeff illustrates with a simple grammar for a configuration DSL:
grammar ConfigDSL;
Config: elements+=Element*;
Element: 'define' name=ID '{'
properties+=Property*
'}';
Property: key=ID '=' value=STRING;
This yields EMF classes: Config (container for Elements), Element (with name and properties), and Property (key-value pairs). Such modularity enables incremental evolution, where grammar tweaks propagate to editors and validators automatically.
Theoretical strengths lie in its declarative paradigm: Developers focus on semantics rather than boilerplate, accelerating prototyping. However, Jeff cautions on over-abstraction—DSLs risk becoming mini-general-purpose languages if scopes broaden, diluting specificity. Integration with Xbase extends expressions with Java-like constructs, blending DSL purity with computational power.
Business Applications: Real-World Deployments and Value Propositions
Beyond academia, Xtext powers production tools, democratizing complex domains. Jeff cites enterprise modeling languages for finance, where DSLs express trading rules sans procedural code, slashing error rates. In automotive, it crafts simulation scripts, aligning engineer notations with executable models.
A compelling case is workflow DSLs in BPM, where Xtext-generated editors visualize processes, integrating with Activiti or jBPM. Business analysts author flows textually, with auto-completion and hyperlinking to assets, enhancing traceability. Healthcare examples include protocol DSLs for patient data flows, ensuring compliance via built-in validators.
Value accrues through reduced onboarding: Non-technical stakeholders contribute via intuitive syntax, while developers embed DSLs in IDEs for seamless handoffs. Jeff notes scalability—Xtext supports incremental parsing for large files, vital in log analysis DSLs processing gigabytes.
Monetization emerges via plugins: Commercial tools like itemis CREATE extend Xtext for automotive standards (e.g., AUTOSAR). Open-source adoptions, such as Sirius for graphical DSLs, amplify reach. Challenges include learning curves for grammar tuning and EMF familiarity, but Jeff advocates starting small—prototype a config DSL before scaling.
In 2025, Xtext remains Eclipse’s cornerstone, with version 2.36 (March 2025) enhancing LSP integration for VS Code, broadening beyond Eclipse. This evolution sustains relevance amid rising polyglot tooling.
Practical Implementation: Building an IzPack Editor with Java Synergies
Hands-on, Jeff demonstrates Xtext’s prowess via an IzPack DSL editor—a packaging tool for Java apps. IzPack traditionally uses XML; the DSL abstracts to human-readable syntax like “install ‘app.jar’ into ‘/opt/app’ with variables {version: ‘1.0’}.”
Grammar evolution: Start with basics (packs, filesets), add cross-references for variables, and validators for conflicts (e.g., duplicate paths). Generated editor features syntax highlighting, outlining, and quick fixes—e.g., auto-importing unresolved types.
EMF integration shines in serialization: Parse DSL to IzPack model, then generate XML or JARs via Java services. Jeff shows a runtime module injecting custom validators:
public class IzPackRuntimeModule extends AbstractIzPackRuntimeModule {
@Override
public Class<? extends IValidator> bindIValidator() {
return IzPackValidator.class;
}
}
Java linkage via Xtend—Xtext’s concise dialect—simplifies services:
def void updateCategory(Element elem, String newCat) {
elem.category = newCat
elem.eAllContents.filter(Element).forEach[ it.category = newCat ]
// Trigger listeners
elem.eSet(elem.eClass.getEStructuralFeature('category'), newCat)
}
This propagates changes, demonstrating EMF’s notification system. Refactoring renames propagate via index, while content assist suggests variables.
Deployment: Export as Eclipse plugin or standalone via Eclipse Theia. Jeff’s GitHub repo (github.com/jeffmaury/izpack-dsl) hosts the example, inviting forks.
Implications: Such editors cut packaging time 70%, per Jeff’s Syspertec experience. For Java devs, Xtext lowers DSL barriers, fostering hybrid tools—textual DSLs driving codegen. In 2025, LSP support enables polyglot editors, aligning with microservices’ domain modeling needs.
Xtext’s trifecta—theory, application, practice—empowers tailored languages, enhancing expressiveness without sacrificing toolability.