Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6577969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:42:32+00:00 2026-05-25T15:42:32+00:00

If I create a Plugin Project in Eclipse, it creates a default BundleActivator implementation

  • 0

If I create a “Plugin Project” in Eclipse, it creates a default BundleActivator implementation that just sets the BundleContext in an unsynchronized static field.

Since it also creates a public static getter, this doesn’t look Thread-safe, because even if OSGi performs some synchronization when calling the Activator, how do I know that any of my code which would call the getter would also run inside the same synchronization block?

In a “normal” context, both the getters and setters need to be synchronized, or we must use a volatile, to be sure that whatever Thread calls the getter later actually sees the current state of the static field.

If the field was set only once, it would not be a problem, but I understand that bundles can be started and stopped several times during the lifetime of the JVM, and under those conditions, it would be thinkable that a Thread has already a cached version of the field, and would not see a change, due to the lack of synchronization.

I can’t imagine that Eclipse would generate plain wrong code by default, but I can’t see how this would work either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:42:33+00:00Added an answer on May 25, 2026 at 3:42 pm

    I agree that the generated code is incorrect and it doesn’t surprise me at all that Eclipse PDE would generated incorrect code. There is no need for this static field, and in fact in most cases the activator itself is useless.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a database project and I need to create Outlook 2007 plugin
Typically I create a plugin when I have a module that I know I'm
Is it possible to create Selenium tests using the Firefox plugin that use randomly
Is it possible to create Eclipse plugins that auto-discover eachother? I am developing a
I installed Eclipse Helios with the m2eclipse maven plugin. I want to create an
I'm just getting started with a project that combines GWT, Google App Engine and
how to create a good plugin engine for standalone executables created with pyInstaller, py2exe
How do we create a search plugin for Safari? Like this post
I'm looking to create an Intellij IDEA language support plugin for Erlang. The first
I've been trying to create a Windows Media Player plugin in Visual Studio 2008,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.