001 /**
002 * Copyright (C) 2011-2012 Barchart, Inc. <http://www.barchart.com/>
003 *
004 * All rights reserved. Licensed under the OSI BSD License.
005 *
006 * http://www.opensource.org/licenses/bsd-license.php
007 */
008 package com.barchart.util.concurrent;
009
010 /**
011 * An implementation of FutureCallback that does not do any actual computation,
012 * but just serves as a communication proxy between the executor and listeners.
013 *
014 * @author jeremy
015 *
016 * @param <V>
017 * The result type
018 */
019 public class FutureNotifier<V> extends FutureNotifierBase<V, FutureNotifier<V>> {
020
021 public static <P> FutureNotifier<P> success(final P result) {
022 return new FutureNotifier<P>().succeed(result);
023 }
024
025 public static <P> FutureNotifier<P> failure(final Throwable error) {
026 return new FutureNotifier<P>().fail(error);
027 }
028
029 }