Java 5 PSM for DDS: Revised Submission (out of date)


Published on

Presentation given to the Object Management Group's MARS Task Force in September, 2010 about a proposal to improve the Java API for the OMG's Data Distribution Service (DDS). See also

This presentation is obsoleted by a later one:

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Benefits of “close” instead of factory method:
    Familiar from, javax.jms
    Can’t get it wrong by using wrong factory
  • Write a normal-looking Java class with no DDS dependencies, then use it to pub and sub
  • Decision matrix:
    * Need maximum performance? Want to share type definitions across languages? Generate code.
    * Want maximum convenience? Working mostly in Java? Use this new Representation.
  • Java 5 PSM for DDS: Revised Submission (out of date)

    1. 1. Java 5 PSM for DDS: Revised Submission MARS – Cambridge, MA – September 2010 Presenter: Rick Warren, RTI Submitting POCs:  Rick Warren, RTI:  Angelo Corsaro, PrismTech: document number: mars/2010-09-05
    2. 2. Agenda Specification Overview  Mostly review from last time Specification changes since Minneapolis  Full DDS-XTypes support  Java Type Representation  Other minor changes In depth: Java Type Representation TODO for the next meeting  Review: This will impact many of us; needs to be right Copyright © 2010 RTI - All rights Reserved 2
    3. 3. Goals & Design Principles Improve user experience  standardNamingConvention  Standard containers (e.g. java.util.List)  Standard enumerations  Error conditions reported with exceptions  Serializable, Cloneable value types  Simplified method overloads Improve type safety  Generics Improve performance  Loanable memory  No critical-path memory allocation (unlike IDL PSM) Improve portability  Build apps against standard interfaces; decide at run time which impl to use  Host multiple implementations (or versions) within same JVM  Dynamic loading and unloading  Play nicely with containers, e.g. Java EE and OSGi  Don’t require non-constant static state Copyright © 2010 RTI - All rights Reserved 3
    4. 4. State of the Proposal First revised submission Process moving quickly and efficiently  Submitters have joined  All mandatory requirements satisfied  User vetting process begun  Private conversations with Java power users  Publicly available code repository at  So far, reviewers enthusiastic Still to go:  Review within submission team and with our customers  Review with your own stakeholders!  Next submission will be ready for a vote Copyright © 2010 RTI - All rights Reserved 4
    5. 5. Hello, World import*; Topic<Foo> t = …; DataWriter<Foo> dw = myPub.createDataWriter(t); Foo data = …; dw.write(data); dw.close(); DataReader<Foo> dr = mySub.createDataReader(t); Sample.Iterator<Foo> it = dr.take(); Foo data2 = getData(); it.returnLoan(); dr.close();  OMG package  Typical naming convention  Overloaded methods  Generics for type safety  Close like JMS, I/O stream  Standard collections Copyright © 2010 RTI - All rights Reserved 5
    6. 6. Since Initial Submission: DDS-XTypes Dynamic Language Binding TypeObject for type propagation Built-in data types:  Types: String, KeyedString, Bytes, KeyedBytes  Added overloads to Publisher, Subscriber to create statically type-safe readers and writers of these types New QoS policies Standard annotations Copyright © 2010 RTI - All rights Reserved 6
    7. 7. Since Initial Submission: Java Type Rep’n Publish and subscribe to POJOs without code generation Based on Java reflection More on this later Copyright © 2010 RTI - All rights Reserved 7
    8. 8. Since Initial Submission: Misc. Details Improved static type safety of topic creation Improved static type safety of topic, reader, and writer listeners Improved portability of TypeSupport creation Improved Context loading Miscellaneous alignments with C++ PSM “Hello World” code example Automated generation of binary jar and source zip files Copyright © 2010 RTI - All rights Reserved 8
    9. 9. Java Type Representation: Intro Goal: Write the following code: public class MyPojo /*extends/implements…*/ { private int foo; private Bar[] baz; public void doStuff() { … } } … Topic<MyPojo> t = dp.createTopic( "My Topic", MyPojo.class); Copyright © 2010 RTI - All rights Reserved 9
    10. 10. Java Type Representation: Intro Does not replace, modify existing standard Language Bindings Interoperable at wire level  …with generated or dynamic types  …in Java or any other language Convenience feature for non-real-time Java systems  “Representation” is run-time, reflection-based: no Java source code parsing or code generation  Implication: Reflection slower than compiled generated code  Implication: If other languages are used, type definitions must be “duplicated” Copyright © 2010 RTI - All rights Reserved 10
    11. 11. Java Type Representation: Approach Leverage the knowledge of Java developers Leverage the code they already have Observations:  JRE already provides type definition constructs  Primitive types, strings, lists (sequences), classes (structures), enumerations, annotations  Types to be sent over network already indicate that  …by implementing  …including which fields should not be sent  …with the transient keyword Copyright © 2010 RTI - All rights Reserved 11
    12. 12. Java Type Representation: Approach What this Representation has to do: 1. Define mappings between JRE concepts and DDS concepts  int  Int32 (IDL long)  double  Float64 (IDL double)  java.util.List  Sequence  Serializable class  Structure 2. Allow customizability to support non-Java DDS concepts  e.g. unsigned primitives, narrow vs. wide strings, unions  Mechanism: @SerializeAs annotation Copyright © 2010 RTI - All rights Reserved 12
    13. 13. Java Type Representation: Example Java package com.acme; class Foo implements Serializable { @Key int theInt; transient float theFlt; String theStr; @SerializeAs(UINT_64) BigInteger theUInt; String[] theArr; } IDL module com { module acme { @Extensibility(MUTABLE)str uct Foo { @Key long theInt; string theStr; unsigned long theUInt; sequence<string> theArr; }; }} Copyright © 2010 RTI - All rights Reserved 13
    14. 14. Still TO DO We will ask for a vote at the December meeting Review the PSM with your stakeholders  API  Implementation: Context.createInstance (only non-trivial implementation in the PSM)  Specification document Review the code license, copyrights  (Will want AB, SMC guidance too)  OMG and submitters (RTI, PrismTech) have joint copyright  OMG-standard Java source files have BSD-style license  Does not constrain licenses or biz models of impl’s  Vendors redistributing these files must:  Document license terms  Acknowledge copyright holders Will be further alignment within submission team, including consideration of C++ PSM Copyright © 2010 RTI - All rights Reserved 14
    15. 15. Still TO DO Copy specification into JavaDoc?  Friendly for IDE users  myWriter.setQos| More examples? (non-normative)  e.g. Application code examples  e.g. No-op reference implementation You tell us! Copyright © 2010 RTI - All rights Reserved 15 void setQos(DataWriterQos q) Set the QoS of this DataWriter. The result of subsequent calls to getQos will be equal to the value set by this method.
    16. 16. Summary DDS will have a first-class Java API.  That looks and behaves like a typical Java API.  That performs well.  Soon. Copyright © 2010 RTI - All rights Reserved 16
    17. 17. Q & A Copyright © 2010 RTI - All rights Reserved 17