Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2013-09-26 08:06:10 +0000
committerGreg Wilkins2013-09-26 08:06:10 +0000
commit643b6c3c77c792677655f67fc0216873765ead48 (patch)
tree8d11ad88e5319b6175db5cf50c6cba539dc7aa94
parenta50054c74bc3c7e32730a91b78718c14dc6216bd (diff)
downloadorg.eclipse.jetty.project-643b6c3c77c792677655f67fc0216873765ead48.tar.gz
org.eclipse.jetty.project-643b6c3c77c792677655f67fc0216873765ead48.tar.xz
org.eclipse.jetty.project-643b6c3c77c792677655f67fc0216873765ead48.zip
removed ExecutorCallback
-rw-r--r--jetty-io/src/main/java/org/eclipse/jetty/io/EndPoint.java2
-rw-r--r--jetty-util/src/main/java/org/eclipse/jetty/util/ExecutorCallback.java134
2 files changed, 0 insertions, 136 deletions
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/EndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/EndPoint.java
index ff416b8301..c6ab8baed6 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/EndPoint.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/EndPoint.java
@@ -26,11 +26,9 @@ import java.nio.channels.ReadPendingException;
import java.nio.channels.WritePendingException;
import org.eclipse.jetty.util.Callback;
-import org.eclipse.jetty.util.ExecutorCallback;
import org.eclipse.jetty.util.FutureCallback;
-
/**
*
* A transport EndPoint
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ExecutorCallback.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ExecutorCallback.java
deleted file mode 100644
index 338064079b..0000000000
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/ExecutorCallback.java
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
-// ------------------------------------------------------------------------
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// and Apache License v2.0 which accompanies this distribution.
-//
-// The Eclipse Public License is available at
-// http://www.eclipse.org/legal/epl-v10.html
-//
-// The Apache License v2.0 is available at
-// http://www.opensource.org/licenses/apache2.0.php
-//
-// You may elect to redistribute this code under either of these licenses.
-// ========================================================================
-//
-
-package org.eclipse.jetty.util;
-
-import java.util.concurrent.Executor;
-
-public abstract class ExecutorCallback implements Callback
-{
- private final ForkInvoker<Void> _invoker;
- private final Executor _executor;
- private final Runnable _onComplete=new Runnable()
- {
- @Override
- public void run()
- {
- onCompleted();
- }
- };
-
- public ExecutorCallback(Executor executor)
- {
- this(executor, 4);
- }
-
- public ExecutorCallback(Executor executor, int maxRecursion)
- {
- _executor = executor;
- _invoker = maxRecursion>0?new ExecutorCallbackInvoker(maxRecursion):null;
- if (_executor==null)
- throw new IllegalArgumentException();
- }
-
- @Override
- public void succeeded()
- {
- // Should we execute?
- if (_invoker==null)
- {
- _executor.execute(_onComplete);
- }
- else if (alwaysDispatchCompletion())
- {
- _invoker.fork(null);
- }
- else
- {
- _invoker.invoke(null);
- }
- }
-
- protected abstract void onCompleted();
-
- @Override
- public void failed(final Throwable x)
- {
- // Always execute failure
- Runnable runnable = new Runnable()
- {
- @Override
- public void run()
- {
- onFailed(x);
- }
-
- @Override
- public String toString()
- {
- return String.format("ExecutorCallback@%x{%s}", hashCode(), x);
- }
- };
-
- if (_executor == null)
- new Thread(runnable).start();
- else
- _executor.execute(runnable);
- }
-
- protected void onFailed(Throwable x)
- {
- }
-
- protected boolean alwaysDispatchCompletion()
- {
- return _executor != null;
- }
-
- @Override
- public String toString()
- {
- return String.format("%s@%x", getClass(), hashCode());
- }
-
- private class ExecutorCallbackInvoker extends ForkInvoker<Void> implements Runnable
- {
- private ExecutorCallbackInvoker(int maxInvocations)
- {
- super(maxInvocations);
- }
-
- @Override
- public void fork(Void arg)
- {
- _executor.execute(this);
- }
-
- @Override
- public void call(Void arg)
- {
- onCompleted();
- }
-
- @Override
- public void run()
- {
- onCompleted();
- }
- }
-}

Back to the top