• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Last night OSGi saved my life
 

Last night OSGi saved my life

on

  • 473 views

This session is a real story , it tells how OSGi saved an heavy project (more thean 5000 days one) and will give you some concrete feedbacks (Design Patterns or Anti Patterns). The project targets a ...

This session is a real story , it tells how OSGi saved an heavy project (more thean 5000 days one) and will give you some concrete feedbacks (Design Patterns or Anti Patterns). The project targets a small device (HHP 9900 Dolphin) running Windows Mobile 6.1, it's a very constrained environment : - small process size - 128Mb of RAM available for the whole system - I/O very slow And moreover no recent JVM available in this context, IBM 9 1.4 is the most stable found... Refactoring the previous architecture using eRCP/Spring and much libraries to a plain OSGi one .... For which result: - reduced memory footprint - reduced I/O access and for user experience, a nice & robust application

Statistics

Views

Total Views
473
Views on SlideShare
473
Embed Views
0

Actions

Likes
0
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Last night OSGi saved my life Last night OSGi saved my life Presentation Transcript

    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&APowered by These slides are powered by Open Source softwares : Debian GNU Linux Beamer LaTeX mode LaTeX Emacs J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ACourse menu... 1 Context 2 Last night OSGi saved my application 3 Back to the Future 4 Lessons learned 5 Q&A J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&ASummary I 1 Context the application Original architecture J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&ABusiness context packets delivery, tracking of each parcel shipped, reducing costs , while optimizing employees delivery schedule, customers constesting with improved parcels tracking, J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&AApplication features 1 packets tracking, 2 scanning packets with Doplhins barcodes reader, 3 Geolocation with GPS Dolphins module, 4 GPRS 5 synchronization with central (up/down streams), J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&ABusiness constraints The application must ensure to manage the following constraints : quick to optimize productivity of employees (handling scanning of numerous packets in a small time), robust, the only application visible to end users on the handheld device (a kiosk shadowing the Operating System and all other applications)... network aware while synchronizing data from the master node and while sending data to this node. in fact this application is part from a larger group of applications and synchronization between layers is one the key objectives. J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&ATechnical constraints Customers bought the handheld devices (7000 ! ! !) : 1 HHP Dolphin 9900, 2 powered by a Windows 6.1 Mobile Edition, J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&ATechnical constraints - II Digression about Windows Mobile : not clearly designed to power Java applications, cant manage (use as an addresses space) more than 128Mb of RAM, cant manage properly processus heavier than 32Mb... J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&AInitial architecture : overview Figure: Initial architecture J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&AInitial architecture in a few numbers 100 , as the number of bundles on the client side, 200, as the number of bundles on the server side, 100000 lines of code, 40 as the number of libraries embedded on client side (all Spring stu and more) J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&ADevelopment infrastructure 1 development on Windows under Eclipse generating JDK 1.5 bytecode, 2 retro translation of this bytecode for the handheld device part from the project to be compatible with JRE 1.4. part from the whole project code is common to handheld and station ... for these 2 parts, dierent constraints (hardware, OS, JRE ..) J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&AInitial architecture : summary Using such architecture on the HHP device resulted in : heavyweight application, failures in dierent applications features (memory intensive ones inducing GC errors) , modularity concerns because of the number of runtime dependencies, OSGi enrolled in the long list from technologies but not implemented in the good way... Spring-DM entropy resulted in a bootsrapping phase for the application not fully mastered (numerous hacks in this portion of code). Problems with the customers..... J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application the application Back to the Future Original architecture Lessons learned Q&AAnd Zorro comes to the rescue Next section explains how OSGi saved the application.... J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Re-engineering the application Back to the Future OSGi & shells Lessons learned Q&ASummary I 2 Last night OSGi saved my application Re-engineering the application OSGi & shells J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Re-engineering the application Back to the Future OSGi & shells Lessons learned Q&AStrategy Key points , strategy used to redesign the application : mastering dependencies & reducing volume of byte code loaded reduce I/O as much as possible, use as much as possible OSGi features, dont rely on isolated technologies but use well known & standard technologies J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Re-engineering the application Back to the Future OSGi & shells Lessons learned Q&AStrategy in action Main steps for this re-engineering : 1 cut Spring dependencies (done - success), 2 cut eRCP dependencies (and drop JFace from code) (done easily), 3 master code injection (done - success but temporary solution), 4 introduce Dependencies Service (done in certain infrastructure bundles), 5 refactor applications to use standard OSGi services everywhere (not implemented yet) J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Re-engineering the application Back to the Future OSGi & shells Lessons learned Q&ANew architecture used Fully based on OSGi...Uses major OSGi services.. Figure: Current architecture J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Re-engineering the application Back to the Future OSGi & shells Lessons learned Q&ANew architecture used... Major OSGi services used into the application Log Service, CongAdmin Service, Service Component References aka Declarative Services, J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Re-engineering the application Back to the Future OSGi & shells Lessons learned Q&AFirst results Fact Before After Scanning several packages in a row failure after 200 scans no problem after 800 scans. Memory footprint after bootstrap 70Mb 11Mb Startup time for the application 2 minutes more than 1 minute Bootstrap hack with thread before stating injection fully controlled J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Re-engineering the application Back to the Future OSGi & shells Lessons learned Q&AOne shell to rule them all.. Surf-Ng is developed on Windows and runs on the handheld device... Equinox is used on the Windows machines inside Eclipse, Felix runs the application on the handheld device Equinox is quite heavyweight, using Felix and Equinox is a good way to conform to plain standard OSGi J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Re-engineering the application Back to the Future OSGi & shells Lessons learned Q&ATesting inside OSGi runtimes Testing inside OSGi context ? one reex : use commands.. of course its the natural way but how to deal with 2 shells ? no standard API for commands yet (until the upcoming r4.3), double the number of classes with the same feature developed into 2 contexts ? testing only made into the Felix context for major bundles... J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ASummary I 3 Back to the Future J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&AWhats next Doctor ? Next releases will add : GPS, localization of the current employee relies on low level API as oered by HHP, same case as barcode reader handling in the current architecture.. a bundle will isolate handling of the dialog with the .dll using JNI or JNA. GPRS, for larger bandwidth same implication in the architecture (no problem) improve customers relationship enabling Colipost to send new commands to employees in a real time mode UPnP maybe... Use Service Component References in the whole application. J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&AUPnP usage What about UPnp in this business context ? devices have to be deployed into sub centralized environments (local agencies), how to nd the 2 special PCs storing congurations to be used by the application deployed on the devices ? rst attempts made with JSLP JSLP does not work into the J9 custom JVM... JSLP is not maintained anymore and provides alpha stages releases OSGi provides integrated UPnp services UPnp uses the same kind of approach than SLP J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&AGeneralize Declarative Services usage Declarative Services is used but : not used in all bundles (too much to refactor the whole bundles set), reserved to technical infrastructure bundles, eciency and impact on architecture highlighted now remove the current aw of the architecture with the boot sequence being quite fragile enable a better OSGi shell independance while removing the dependencies related to run levels conguration. J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ASummary I 4 Lessons learned J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 1 :Use OSGi native injection Dependencies Service turns out to be : powerful (dynamic and not static as Spring Core), easy to use (fun with BndTools), much more ecient than Spring on an embedded context XML verbosity (impact on I/O), Objects tree managed, does not grab hundred of unused dependencies ... J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 2 : avoid using PDE to develop not suited for OSGi development (mainly oriented to old Eclipse plugin architecture), huge refactoring to migrate all MANIFEST.MF les to proper OSGi style (easy but boring with BndTools when you have 300 plugins to migrate), use BndTools instead ... fast, elegant, powerful (thanks to bnd & Peter ! !) nice Eclipse integration J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 3 : modularity has a cost Dierent technical concerns are not evaluated as they should be when dealing with OSGi. XML serialization, Web Services consuming or scheduler are good samples... all raise problems of Class loading & instantiations through dierent bundles small infrastructure solution required... J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 3 : continued Dont use the classic whiteboard pattern, I avoid to create polling objects when possible, I like the fact of forcing bundles (& developers) to export part from their objects J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 4 : modularity is the key OSGi services do a great job when implementations may change... 1 we faced dierent problems with libraries incompatible with our Virtual Machine 2 having code relying on special implementations would have been a disaster , with OSGi who cares ? J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 5 : when hardware & software matters this item is not OSGi centric but : beware of the JVM to be used, beware of side eects for hardware which does not provide PC emulator, use documented & open systems whenever you can .. J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 6 : handling tests Many bundles are tested using Command classes its the most natural way to test code into an OSGi runtime, very easy to code and deploy (a few lines of code only required) no standard way to test into our 2 dierent runtimes until the upcoming OSGi r4.3 release ! ! ! Equinox as integrated into Eclipse on development machines, Felix on Dolphin device, Equinox is too heavy for our environment.. J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 7 : Declarative Services eciency Its one of the major surprises... quite no impact on I/O and global performance, far more ecient than Spring XML injection, no coupling with annotation during runtime phase, only constraint is to have a JDK 1.6 inside Eclipse.. more powerful than Spring injection with the dynamic aspect (Spring does static injection ..), J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 8 : Debuging OSGi conicts What can you do when your bundles seem to deploy but the application does not work ? use the Felix Web Console bundle, this bundle requires to embed a small Jetty server to deliver this webapp, not usable on any environment (we dont have a JRE 1.5+ with a complete NIO stack on our J9 JVM) any Linux/Windows machine may oer the infrastructure to deliver this kind of diagnostics . J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 9 : Beware of evidence This item is not OSGi specic but beware as any Java veteran programmer on such context (such hardware) all that you know may be false : standard classes may not be included in your JVM, standard algorithms may be unsuitable for your context, reusing general libraries may be the worth choice.. J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ALesson 10 : Modularity is the key - revisited A good OSGi usage enables applications to benet of the following aspects : no need of complex infrastructure (Spring D-M), high degree of freedom oered by contexts where developpers master the underlying architecture (no hidden monster), extreme eciency , very quick team adoption, best architectural approach , please refer to B.Meyer objects introduction , how to design a microcosm without deep knowledge of the relations between entities (what they oer & what they require). J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&ASummary I 5 Q&A J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life
    • Context Last night OSGi saved my application Back to the Future Lessons learned Q&AQuestions ? Its up to you .. Thanks for your attention.. Apologize for my bad english spoken... J.MOLIÈRE - jerome@javaxpert.com Last night OSGi saved my life