Removing WriteResult class
This commit is contained in:
parent
e308f843db
commit
ca1c3db642
|
@ -1,67 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2012 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.websocket.api;
|
||||
|
||||
/**
|
||||
* The result of asynchronously sending a web socket message. A WriteResult is either OK indicating there was no problem, or is not OK in which case there was a
|
||||
* problem and it carries an exception to indicate what the problem was.
|
||||
*/
|
||||
public class WriteResult
|
||||
{
|
||||
private Throwable exception;
|
||||
|
||||
/**
|
||||
* Construct a WriteResult signifying a successful send carrying an no exception.
|
||||
*/
|
||||
public WriteResult()
|
||||
{
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a WriteResult carrying an exception.
|
||||
*
|
||||
* @param exception
|
||||
* the exception causing a send failure.
|
||||
*/
|
||||
public WriteResult(Throwable exception)
|
||||
{
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* The problem sending the message.
|
||||
*
|
||||
* @return the problem.
|
||||
*/
|
||||
public Throwable getException()
|
||||
{
|
||||
return this.exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this result is ok or not.
|
||||
*
|
||||
* @return whether the send was successful or not.
|
||||
*/
|
||||
public boolean isOK()
|
||||
{
|
||||
return (exception == null);
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2012 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.websocket.common.io;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
import org.eclipse.jetty.websocket.api.WriteResult;
|
||||
|
||||
public class WriteResultFailedFuture extends FutureTask<WriteResult> implements Future<WriteResult>
|
||||
{
|
||||
private static class FailedRunner implements Callable<WriteResult>
|
||||
{
|
||||
private Throwable error;
|
||||
|
||||
public FailedRunner(Throwable error)
|
||||
{
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WriteResult call() throws Exception
|
||||
{
|
||||
return new WriteResult(this.error);
|
||||
}
|
||||
}
|
||||
|
||||
public WriteResultFailedFuture(Throwable error)
|
||||
{
|
||||
super(new FailedRunner(error));
|
||||
run();
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2012 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.websocket.common.io;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
import org.eclipse.jetty.websocket.api.WriteResult;
|
||||
|
||||
public class WriteResultFinishedFuture extends FutureTask<WriteResult> implements Future<WriteResult>
|
||||
{
|
||||
public static Future<WriteResult> INSTANCE;
|
||||
|
||||
static
|
||||
{
|
||||
Callable<WriteResult> callable = new Callable<WriteResult>()
|
||||
{
|
||||
@Override
|
||||
public WriteResult call() throws Exception
|
||||
{
|
||||
return new WriteResult();
|
||||
}
|
||||
};
|
||||
|
||||
WriteResultFinishedFuture fut = new WriteResultFinishedFuture(callable);
|
||||
fut.run();
|
||||
|
||||
INSTANCE = fut;
|
||||
}
|
||||
|
||||
public WriteResultFinishedFuture(Callable<WriteResult> callable)
|
||||
{
|
||||
super(callable);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2012 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.websocket.common.io;
|
||||
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.FuturePromise;
|
||||
import org.eclipse.jetty.websocket.api.WriteResult;
|
||||
|
||||
public class WriteResultFuture extends FuturePromise<WriteResult> implements Callback
|
||||
{
|
||||
@Override
|
||||
public void succeeded()
|
||||
{
|
||||
succeeded(new WriteResult());
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2012 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.websocket.server.helper;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
import org.eclipse.jetty.websocket.api.WriteResult;
|
||||
|
||||
public class FinishedFuture extends FutureTask<WriteResult> implements Future<WriteResult>
|
||||
{
|
||||
public static Future<WriteResult> INSTANCE;
|
||||
|
||||
static
|
||||
{
|
||||
Callable<WriteResult> callable = new Callable<WriteResult>()
|
||||
{
|
||||
@Override
|
||||
public WriteResult call() throws Exception
|
||||
{
|
||||
return new WriteResult();
|
||||
}
|
||||
};
|
||||
|
||||
FinishedFuture fut = new FinishedFuture(callable);
|
||||
fut.run();
|
||||
|
||||
INSTANCE = fut;
|
||||
}
|
||||
|
||||
public FinishedFuture(Callable<WriteResult> callable)
|
||||
{
|
||||
super(callable);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue