summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-04 05:35:13 (EDT)
committerEike Stepper2007-08-04 05:35:13 (EDT)
commit3e352f3eeda534bb4b0ce821d921e89a3a2361d8 (patch)
tree2e10c26c0414c89cb54156667e9d332d94e1a9f3
parentde50f02e7eef796fcdf6ea325c27c554f15742e3 (diff)
downloadcdo-3e352f3eeda534bb4b0ce821d921e89a3a2361d8.zip
cdo-3e352f3eeda534bb4b0ce821d921e89a3a2361d8.tar.gz
cdo-3e352f3eeda534bb4b0ce821d921e89a3a2361d8.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java4
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java4
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycleState.java9
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java10
4 files changed, 26 insertions, 1 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java
index 9563e19..2ec7672 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java
@@ -37,6 +37,10 @@ public class Lifecycle extends Notifier implements ILifecycle.Introspection
{
}
+ /**
+ * TODO Look into concurrent if there's something faster than synchronized
+ * (atomic values?)
+ */
public final synchronized void activate() throws Exception
{
if (lifecycleState == ILifecycleState.INACTIVE)
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java
index 677b292..821b575 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java
@@ -22,8 +22,10 @@ public interface ILifecycle
/**
* @author Eike Stepper
*/
- public interface Introspection
+ public interface Introspection extends ILifecycle
{
+ public ILifecycleState getLifecycleState();
+
public boolean isActive();
}
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycleState.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycleState.java
new file mode 100644
index 0000000..dd5444a
--- /dev/null
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycleState.java
@@ -0,0 +1,9 @@
+package org.eclipse.net4j.util.lifecycle;
+
+/**
+ * @author Eike Stepper
+ */
+public enum ILifecycleState
+{
+ ACTIVATING, ACTIVE, DEACTIVATING, INACTIVE
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
index 6725ec7..c0f3e96 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
@@ -36,6 +36,16 @@ public final class LifecycleUtil
{
}
+ public static ILifecycleState getLifecycleState(Object object)
+ {
+ if (object instanceof ILifecycle.Introspection)
+ {
+ return ((ILifecycle.Introspection)object).getLifecycleState();
+ }
+
+ return ILifecycleState.ACTIVE;
+ }
+
public static boolean isActive(Object object)
{
if (object instanceof ILifecycle.Introspection)