Simplified Handler by removing the context parameter from failed().

This commit is contained in:
Simone Bordet 2012-02-23 23:24:56 +01:00
parent 4bcd7548d9
commit 8f3f34633d
3 changed files with 11 additions and 13 deletions

View File

@ -38,7 +38,7 @@ public class Promise<T> implements Handler<T>, Future<T>
latch.countDown(); latch.countDown();
} }
public void failed(Throwable x, T context) public void failed(Throwable x)
{ {
this.failure = x; this.failure = x;
latch.countDown(); latch.countDown();

View File

@ -140,7 +140,7 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
catch (StreamException x) catch (StreamException x)
{ {
removeStream(stream); removeStream(stream);
handler.failed(x, stream); handler.failed(x);
} }
} }
} }
@ -174,7 +174,7 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
catch (StreamException x) catch (StreamException x)
{ {
logger.info("Could not send reset on stream " + rstInfo.getStreamId(), x); logger.info("Could not send reset on stream " + rstInfo.getStreamId(), x);
handler.failed(x, null); handler.failed(x);
} }
} }
@ -197,7 +197,7 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
} }
catch (StreamException x) catch (StreamException x)
{ {
handler.failed(x, null); handler.failed(x);
} }
} }
@ -222,7 +222,7 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
} }
catch (StreamException x) catch (StreamException x)
{ {
handler.failed(x, pingInfo); handler.failed(x);
} }
} }
@ -250,7 +250,7 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
} }
catch (StreamException x) catch (StreamException x)
{ {
handler.failed(x, null); handler.failed(x);
} }
} }
} }
@ -730,7 +730,7 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
} }
@Override @Override
public void failed(Throwable x, FrameBytes frameBytes) public void failed(Throwable x)
{ {
throw new SPDYException(x); throw new SPDYException(x);
} }

View File

@ -18,8 +18,7 @@ package org.eclipse.jetty.spdy.api;
/** /**
* <p>A callback abstraction that handles completed/failed events of asynchronous operations.</p> * <p>A callback abstraction that handles completed/failed events of asynchronous operations.</p>
* <p>Instances of this class capture a context that is made available on completion * <p>Instances of this class capture a context that is made available on the completion callback.</p>
* and failure callbacks.</p>
* *
* @param <C> the type of the context object * @param <C> the type of the context object
*/ */
@ -29,7 +28,7 @@ public interface Handler<C>
* <p>Callback invoked when the operation completes.</p> * <p>Callback invoked when the operation completes.</p>
* *
* @param context the context * @param context the context
* @see #failed(Throwable, Object) * @see #failed(Throwable)
*/ */
public abstract void completed(C context); public abstract void completed(C context);
@ -37,9 +36,8 @@ public interface Handler<C>
* <p>Callback invoked when the operation fails.</p> * <p>Callback invoked when the operation fails.</p>
* *
* @param x the reason for the operation failure * @param x the reason for the operation failure
* @param context the context
*/ */
public void failed(Throwable x, C context); public void failed(Throwable x);
/** /**
* <p>Empty implementation of {@link Handler}</p> * <p>Empty implementation of {@link Handler}</p>
@ -54,7 +52,7 @@ public interface Handler<C>
} }
@Override @Override
public void failed(Throwable x, C context) public void failed(Throwable x)
{ {
throw new SPDYException(x); throw new SPDYException(x);
} }