coherence-community / oracle-bedrock

Oracle Bedrock
Other
55 stars 31 forks source link

Introduce the ability for a JavaVirtualMachine to be configured using a JavaApplicationSchema #134

Closed brianoliver closed 9 years ago

brianoliver commented 10 years ago

In some situations it would be good to be able to configure a running JavaVirtualMachine using the settings/options etc defined by a JavaApplicationSchema.

For example: You have a JavaApplicationSchema that contains a set of System Properties you'd like set for the current JavaVirtualMachine. Instead of having to set them manually and revert them, it would be great to simply tell the JavaVirtualMachine to do this for you.

For example:

// define a coherence schema (containing various system properties) CoherenceClusterMemberSchema schema = new CoherenceClusterMemberSchema();

// tell the JVM to use a specific schema to configure itself // (like override system properties / environment variables etc, perform schema-specific initialization). JavaVirtualMachine.use(schema);

// now just use Coherence as per usual NamedCache cache = CacheFactory.getCache("dist-example");

Importantly this allows developers can avoid setting/unsetting system properties for Coherence-based tests, especially to join as a cluster member and/or use extend.

In order to support swapping schemas in a test (like we do with Push Replication), and/or support using multiple schemas, we'd offer the concept of a "RecoveryPoint".

For example:

// tell the JVM to use a specific schema to configure itself // (and return a point from which we can recover) RecoveryPoint recoveryPoint = JavaVirtualMachine.use(schema);

... do some stuff ...

JavaVirtualMachine.revertTo(recoveryPoint);

The recovery point could then clean up the settings / configuration etc, used by / put in place by the schema, including any schema specific clean up. The RecoveryPoint would thus hold all of the state necessary for recovery and avoid us keeping static state lying around. If a developer doesn't care about recovering / changing schemas, there's no cost.

brianoliver commented 9 years ago

@brianoliver said: This is essentially a duplicate of #80

brianoliver commented 8 years ago

This issue was imported from JIRA ORACLETOOLS-134

brianoliver commented 10 years ago

Reported by @brianoliver

brianoliver commented 9 years ago

Marked as duplicate by @brianoliver on Monday, December 1st 2014, 9:27:54 am