Created
December 22, 2013 05:57
-
-
Save devsprint/8078924 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
package net.devsprint.reactive.cassandra; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import rx.Observable; | |
import com.datastax.driver.core.ResultSet; | |
import com.datastax.driver.core.Session; | |
public class AvatarService { | |
private static final String QUERY = "select * avatars"; | |
private static final ExecutorService executorService = Executors | |
.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); | |
private final Session session; | |
public AvatarService(Session session) { | |
this.session = session; | |
} | |
Observable<ResultSet> getAvatars() { | |
return ObservableCassandra | |
.executeAsync(session, QUERY, executorService); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment