• New Feature
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • DSO:L1
  • hhuynh
  • Reporter: gbevin
  • February 20, 2007
  • 0
  • Watchers: 0
  • June 26, 2007
  • June 21, 2007

Description

Sometimes it’s necessary to conditionally execute code when Terracotta DSO is active, or when the application is just running on a single node. A typical example of this is the use of WeakHashMap instances which aren’t supported by TC, but are recommended to be used for rebuildable caches in single node situations. Currently, the only way to somewhat detect that TC is active is by simply trying to load a typical TC class. This is however quite ‘hackish’ and doesn’t even guarantee that TC is active, it just indicates that TC is present in the classpath.

Adding a system property that is set when TC is actively sharing roots would make it much easier to conditionally execute code.

Comments

Fiona OShea 2007-02-21

(this comment is only viewable by Terracotta_Internal) Taylor assigning this to PM for Moraga review as it is from a community member

Taylor Gautier 2007-02-23

I think we can achieve this today with Events. The suggestion may still be an easier way of doing it so I will just push this feature out to Noriega.

Fiona OShea 2007-04-06

can be done with Events

Hung Huynh 2007-06-11

JMXHeartBeat test demonstrate the events that DSO server is up or not.

Geert Bevin 2007-06-12

Hung, you misunderstood the issue, it’s not about detecting whether the server is up. It’s about knowing if client code is running inside a bootstrapped Terracotta environment. This is needed since sometimes a different strategy might be adopted or needed when TC has instrumented the client-side code.

Hung Huynh 2007-06-12

I see what you mean now. In addition to the hack you mentioned, the other telltales signs are jvm system properties:

sun.boot.class.path = will contain our bootjar tc.install-root = always has to be set tc.config = might or might not be set

Fiona OShea 2007-06-12

Geert, can you solve the problem using Hung’s solution?

Geert Bevin 2007-06-21

I added tc.active system property that is set to true when the ClassProcessorHelper has finished initializing.

Fiona OShea 2007-06-25

verify fixed in 2.4 branch