Created
October 7, 2014 12:49
-
-
Save ktoso/9f27fdb3921857b0f2e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (C) 2014 Typesafe Inc. <http://www.typesafe.com> | |
*/ | |
package akka.stream.javadsl.japi; | |
import akka.stream.javadsl.MaterializedDrain; | |
import org.reactivestreams.Subscriber; | |
import java.util.concurrent.Future; | |
public class JavaPain { | |
{ | |
Materialized materialized = new Materialized(); | |
DrainWithTheKey<Object, Subscriber<Long>> drainKey = new DrainWithTheKey<Object, Subscriber<Long>>(); | |
Subscriber<Long> drainFor = materialized.getDrainFor(drainKey); | |
Future<String> future1 = materialized.getDrainFor(new DrainWithTheKey<Object, Future<String>>()); | |
FoldDrain<String, Future<String>> foldDrain = new FoldDrain<String, Future<String>>(); | |
Future<String> future2 = materialized.getDrainFor(foldDrain); | |
} | |
} | |
class FoldDrain<U, In> extends DrainWithTheKey<In, Future<In>> { } | |
class DrainWithTheKey<A, Type> { | |
public Type value() { return null; } | |
} | |
class Materialized { | |
public <T> T getDrainFor(DrainWithTheKey<Object, T> drainKey) { return drainKey.value(); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment