summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-30 06:35:22 (EDT)
committerEike Stepper2007-07-30 06:35:22 (EDT)
commitbb0903db03a1255c245e287cd03fe6350a599be7 (patch)
treef22c930973bc468ae6e839f8c6f9fa93542fc998
parentfc95a6dc48c81f403d9b3b34c9a298adbb1df8d1 (diff)
downloadcdo-bb0903db03a1255c245e287cd03fe6350a599be7.zip
cdo-bb0903db03a1255c245e287cd03fe6350a599be7.tar.gz
cdo-bb0903db03a1255c245e287cd03fe6350a599be7.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/MonitorTest.java13
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/MON.java7
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/NullMonitor.java81
3 files changed, 77 insertions, 24 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/MonitorTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/MonitorTest.java
index d957e53..3940701 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/MonitorTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/MonitorTest.java
@@ -68,14 +68,7 @@ public class MonitorTest extends AbstractOMTest
public void testUnjoinedNotStarted() throws Exception
{
- try
- {
- readClasses(CLASSES, FIELDS, true, false);
- fail("MonitorAlreadyBegunException expected");
- }
- catch (MonitorAlreadyBegunException ex)
- {
- }
+ readClasses(CLASSES, FIELDS, true, false);
}
public void testNotForked() throws Exception
@@ -84,6 +77,10 @@ public class MonitorTest extends AbstractOMTest
try
{
readClasses(CLASSES, FIELDS, false, false);
+ fail("MonitorAlreadyBegunException expected");
+ }
+ catch (MonitorAlreadyBegunException ex)
+ {
}
finally
{
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/MON.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/MON.java
index 6354e6f..abbb147 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/MON.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/MON.java
@@ -71,7 +71,7 @@ public final class MON
Monitor current = CURRENT.get();
if (current == null)
{
- return new NullMonitor();
+ return NullMonitor.INSTANCE;
}
if (current.hasBegun())
@@ -85,11 +85,6 @@ public final class MON
static void checkMonitor(Monitor monitor) throws MonitorException
{
- if (monitor instanceof NullMonitor)
- {
- return;
- }
-
Monitor current = CURRENT.get();
if (current != monitor)
{
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/NullMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/NullMonitor.java
index 786877b..19024b2 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/NullMonitor.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/NullMonitor.java
@@ -10,29 +10,90 @@
**************************************************************************/
package org.eclipse.net4j.internal.util.om.monitor;
+import org.eclipse.net4j.util.om.monitor.OMMonitor;
+import org.eclipse.net4j.util.om.monitor.OMSubMonitor;
+
/**
* @author Eike Stepper
*/
-public class NullMonitor extends Monitor
+public class NullMonitor implements OMMonitor, OMSubMonitor
{
- public NullMonitor()
+ public static final NullMonitor INSTANCE = new NullMonitor();
+
+ private NullMonitor()
+ {
+ }
+
+ public void join()
+ {
+ }
+
+ public void join(String msg)
+ {
+ }
+
+ public OMSubMonitor fork()
+ {
+ return this;
+ }
+
+ public void fork(int workFromParent, Runnable runnable, String msg)
+ {
+ }
+
+ public void fork(int workFromParent, Runnable runnable)
+ {
+ }
+
+ public OMSubMonitor fork(int workFromParent)
+ {
+ return this;
+ }
+
+ public void fork(Runnable runnable, String msg)
+ {
+ }
+
+ public void fork(Runnable runnable)
+ {
+ }
+
+ public String getTask()
+ {
+ return null;
+ }
+
+ public int getTotalWork()
+ {
+ return 0;
+ }
+
+ public boolean hasBegun()
+ {
+ return true;
+ }
+
+ public void message(String msg)
+ {
+ }
+
+ public void setTask(String task)
+ {
+ }
+
+ public void worked()
{
- super(null, 0);
}
- private NullMonitor(NullMonitor parent, int workFromParent)
+ public void worked(int work, String msg)
{
- super(parent, workFromParent);
}
- @Override
- protected Monitor subMonitor(int workFromParent)
+ public void worked(int work)
{
- return new NullMonitor(this, workFromParent);
}
- @Override
- protected void checkWork(int work)
+ public void worked(String msg)
{
}
}