diff options
author | Eike Stepper | 2007-12-29 16:08:36 +0000 |
---|---|---|
committer | Eike Stepper | 2007-12-29 16:08:36 +0000 |
commit | 5d26503eb85ee023add2c14ed0e1e6fa618bcbd6 (patch) | |
tree | d27c15db289853454b3c3f0b9efa9674a8e265cc /plugins/org.eclipse.net4j.util | |
parent | e35086970836ae2ceb12158e5d0e3aab5b9a20cc (diff) | |
download | cdo-5d26503eb85ee023add2c14ed0e1e6fa618bcbd6.tar.gz cdo-5d26503eb85ee023add2c14ed0e1e6fa618bcbd6.tar.xz cdo-5d26503eb85ee023add2c14ed0e1e6fa618bcbd6.zip |
[213782] Transaction DeadLock
https://bugs.eclipse.org/bugs/show_bug.cgi?id=213782
Diffstat (limited to 'plugins/org.eclipse.net4j.util')
-rw-r--r-- | plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java | 26 | ||||
-rw-r--r-- | plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/CheckUtil.java | 61 |
2 files changed, 87 insertions, 0 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 0977273685..44f1bf178f 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 @@ -13,6 +13,7 @@ package org.eclipse.net4j.internal.util.lifecycle; import org.eclipse.net4j.internal.util.bundle.OM; import org.eclipse.net4j.internal.util.event.Notifier; import org.eclipse.net4j.internal.util.om.trace.ContextTracer; +import org.eclipse.net4j.util.CheckUtil; import org.eclipse.net4j.util.ReflectUtil; import org.eclipse.net4j.util.lifecycle.ILifecycle; import org.eclipse.net4j.util.lifecycle.ILifecycleEvent; @@ -151,6 +152,31 @@ public class Lifecycle extends Notifier implements ILifecycle.Introspection } } + protected final void checkNull(Object handle, String msg) throws NullPointerException + { + CheckUtil.checkNull(handle, msg); + } + + protected final void checkArg(boolean expr, String msg) throws IllegalArgumentException + { + CheckUtil.checkArg(expr, msg); + } + + protected final void checkArg(Object handle, String handleName) throws IllegalArgumentException + { + CheckUtil.checkArg(handle, handleName); + } + + protected final void checkState(boolean expr, String msg) throws IllegalStateException + { + CheckUtil.checkState(expr, msg); + } + + protected final void checkState(Object handle, String handleName) throws IllegalStateException + { + CheckUtil.checkState(handle, handleName); + } + protected final void deferredActivate() { lifecycleState = ILifecycleState.ACTIVE; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/CheckUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/CheckUtil.java new file mode 100644 index 0000000000..c37a2d92d1 --- /dev/null +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/CheckUtil.java @@ -0,0 +1,61 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.util; + +/** + * @author Eike Stepper + */ +public final class CheckUtil +{ + private CheckUtil() + { + } + + public static void checkNull(Object handle, String msg) throws NullPointerException + { + if (handle == null) + { + throw new NullPointerException(msg); + } + } + + public static void checkArg(boolean expr, String msg) throws IllegalArgumentException + { + if (!expr) + { + throw new IllegalArgumentException(msg); + } + } + + public static void checkArg(Object handle, String handleName) throws IllegalArgumentException + { + if (handle == null) + { + throw new IllegalArgumentException(handleName + " is null"); + } + } + + public static void checkState(boolean expr, String msg) throws IllegalStateException + { + if (!expr) + { + throw new IllegalStateException(msg); + } + } + + public static void checkState(Object handle, String handleName) throws IllegalStateException + { + if (handle == null) + { + throw new IllegalStateException(handleName + " is null"); + } + } +} |