Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Enterprise Java Puzzlers

213 views

Published on

Supporting slides for the "Enterprise Java Puzzlers" talk

Published in: Software
  • Be the first to comment

Enterprise Java Puzzlers

  1. 1. “Enterprise” java puzzlers Based on a true story 2017
  2. 2. Sequential Insanity
  3. 3. Hibernate 4 -> 5 upgrade: what happens? @Id @SequenceGenerator(sequenceName = ”MY_SEQ", name = "someKeySequence") @GeneratedValue(generator = "someKeySequence", strategy = GenerationType.AUTO) @Column(name = ”MY_KEY") public Long getId() { return id; } Does not compileB Cannot read EntityDWorks just fineA Session fails to initializeC OtherE
  4. 4. Changes to the default optimization policy @Target({ TYPE, METHOD, FIELD }) @Retention(RUNTIME) public @interface SequenceGenerator { /** * (Optional) The amount to increment by when allocating * sequence numbers from the sequence. */ int allocationSize() default 50; /** * Optimizer which uses a pool of values, storing the next low value of the * range in the database. * <p/> * Note that this optimizer works essentially the same as the * {@link org.hibernate.id.enhanced.HiLoOptimizer} except that here the bucket ranges are actually * encoded into the database structures. * <p/> * Note if you prefer that the database value be interpreted as the bottom end of our current range, * then use the {@link PooledLoOptimizer} strategy * * @author Steve Ebersole * * @see PooledLoOptimizer */ public class PooledOptimizer extends AbstractOptimizer implements InitialValueAwareOptimizer {
  5. 5. “Enterprise” java puzzlers Based on a true story 2017
  6. 6. Load Imbalancer
  7. 7. CXF + F5 – will this work? Will forward to Node1B Something otherD Will work fineA Will forward to Node2C Soap web service CXF Node1 Node2 Big IP Health check - ?wsdl
  8. 8. Where is the puzzle? Service developersB Something elseD Big IPA CXFC Node1 Node2 Big IP Health check - ?wsdl Logs are full of errors! But only for service with many operations. Upgraded to CXF 3.X.X Who is to blame?
  9. 9. Where is the puzzle? Service developersB Something elseD F5A CXFC Node1 Node2 Big IP Health check - ?wsdl Logs are full of errors! But only for service with big wsdl. Upgraded to CXF 3.X.X Who is to blame?
  10. 10. What's the fix?
  11. 11. “Enterprise” java puzzlers Based on a true story 2017
  12. 12. Bundle-Name: MyService bundle Bundle-SymbolicName: com.sample.myservice Bundle-Version: 1.0.0 Import-Package: org.apache.commons.logging;version="1.0.4" Export-Package: com.sample.myservice.api;version="1.0.0" OSGI – пощади мозги
  13. 13. What happens at runtime? Our Bundle Import-Package: my.service.provider;version=“5.0.1" Bundle 1 Export-Package: my.service.provider;version=“5.0.3" Bundle 2 Export-Package: my.service.provider;version=“5.0.2" import my.service.provider.Service … Service service = … Fails - Package uses conflictB Can not load 2 bundles of same packageD Just worksA Fails sometimes with Class not foundC Will always use bundle 1E Will always use bundle 2F AppConfig.java Version.java ExceptionMapper.java NonSingletonSpringResourceFactory.java CheckInService.java EnhancedProfileService.java LocalDateBuilder.java ActionsResource.java CommunicationPreferencesResource.java CompanyInfoResource.java EnhancedProfileResource.java GuestEngagementResource.java AppConfig.java Version.java ExceptionMapper.java NonSingletonSpringResourceFactory.java CheckInService.java EnhancedProfileService.java LocalDateBuilder.java ActionsResource.java CommunicationPreferencesResource.java CompanyInfoResource.java EnhancedProfileResource.java GuestEngagementResource.java GuestPreferencesResource.java HeartbeatFeedbackResource.java HotelCommentsResource.java MemberAwareResource.java PersonalInfoResource.java PreviousAmenitiesResource.java ReservationsResource.java StayHistoryResource.java BookingResource.java Service.java
  14. 14. What happens at runtime? Our Bundle Import-Package: my.service.provider;version=“5.0.1" Bundle 1 Export-Package: my.service.provider;version=“5.0.3" Bundle 2 Export-Package: my.service.provider;version=“5.0.2" import my.service.provider.Service … Service service = … Fails - Package uses conflictB Can not load 2 bundles of same packageD Just worksA Fails sometimes with Class not foundC Will always use bundle 1E Will always use bundle 2F AppConfig.java Version.java ExceptionMapper.java NonSingletonSpringResourceFactory.java CheckInService.java EnhancedProfileService.java LocalDateBuilder.java ActionsResource.java CommunicationPreferencesResource.java CompanyInfoResource.java EnhancedProfileResource.java GuestEngagementResource.java AppConfig.java Version.java ExceptionMapper.java NonSingletonSpringResourceFactory.java CheckInService.java EnhancedProfileService.java LocalDateBuilder.java ActionsResource.java CommunicationPreferencesResource.java CompanyInfoResource.java EnhancedProfileResource.java GuestEngagementResource.java GuestPreferencesResource.java HeartbeatFeedbackResource.java HotelCommentsResource.java MemberAwareResource.java PersonalInfoResource.java PreviousAmenitiesResource.java ReservationsResource.java StayHistoryResource.java BookingResource.java Service.java
  15. 15. “Enterprise” java puzzlers Based on a true story 2017
  16. 16. Innocent Transactions
  17. 17. Innocent Transactions
  18. 18. What if broker goes down? Speed up ~3xB Service responds with random usersD Global catastropheA Slowdown ~3xC Something elseE
  19. 19. What if broker goes down? Speed up ~3xB Service responds with random usersD Global catastropheA Slowdown ~3xC Something elseE
  20. 20. Stuck!
  21. 21. Innocent Transactions
  22. 22. Unless we prevent this
  23. 23. THANK YOU! 2017

×