@@ -34,14 +34,16 @@ public class BookListener extends CallbackSynchronizationSupport implements Asyn
|
||||
private boolean done;
|
||||
|
||||
@Override
|
||||
public void onQueryComplete(ResultSetFuture rsf) {
|
||||
public void onQueryComplete(ResultSetFuture resultSetFuture) {
|
||||
|
||||
Row row;
|
||||
|
||||
try {
|
||||
row = rsf.get().one();
|
||||
row = resultSetFuture.get().one();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to get ResultSet from ResultSetFuture", e);
|
||||
}
|
||||
|
||||
book = new Book();
|
||||
book.setIsbn(row.getString("isbn"));
|
||||
book.setTitle(row.getString("title"));
|
||||
@@ -66,5 +68,4 @@ public class BookListener extends CallbackSynchronizationSupport implements Asyn
|
||||
public Book getBook() {
|
||||
return book;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public class ListListener<T> extends CallbackSynchronizationSupport implements Q
|
||||
* Allow instances only using {@link #create()}
|
||||
*/
|
||||
private ListListener() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,6 @@ public class ListOfMapListener extends CallbackSynchronizationSupport implements
|
||||
* Allow instances only using {@link #create()}
|
||||
*/
|
||||
private ListOfMapListener() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,12 +33,11 @@ public class MapListener extends CallbackSynchronizationSupport implements Query
|
||||
/**
|
||||
* Allow instances only using {@link #create()}
|
||||
*/
|
||||
private MapListener(){
|
||||
super();
|
||||
private MapListener() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a new {@link ObjectListener}.
|
||||
* @return a new {@link MapListener}.
|
||||
*/
|
||||
public static MapListener create() {
|
||||
return new MapListener();
|
||||
|
||||
@@ -32,8 +32,7 @@ public class ObjectListener<T> extends CallbackSynchronizationSupport implements
|
||||
/**
|
||||
* Allow instances only using {@link #create()}
|
||||
*/
|
||||
private ObjectListener(){
|
||||
super();
|
||||
private ObjectListener() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,13 +28,12 @@ import com.datastax.driver.core.ResultSetFuture;
|
||||
*/
|
||||
public class QueryListener extends CallbackSynchronizationSupport implements AsynchronousQueryListener {
|
||||
|
||||
private volatile ResultSetFuture rsf;
|
||||
private volatile ResultSetFuture resultSetFuture;
|
||||
|
||||
/**
|
||||
* Allow instances only using {@link #create()}
|
||||
*/
|
||||
private QueryListener() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,11 +46,11 @@ public class QueryListener extends CallbackSynchronizationSupport implements Asy
|
||||
@Override
|
||||
public void onQueryComplete(ResultSetFuture resultSetFuture) {
|
||||
|
||||
this.rsf = resultSetFuture;
|
||||
this.resultSetFuture = resultSetFuture;
|
||||
countDown();
|
||||
}
|
||||
|
||||
public ResultSetFuture getResultSetFuture() {
|
||||
return rsf;
|
||||
return resultSetFuture;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import static org.junit.Assume.*;
|
||||
import static org.springframework.data.cassandra.repository.support.BasicMapId.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CancellationException;
|
||||
|
||||
@@ -206,7 +205,7 @@ public class AsynchronousCassandraTemplateIntegrationTests extends AbstractSprin
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-287
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-287">DATACASS-287</a>
|
||||
*/
|
||||
@Test(timeout = 10000)
|
||||
public void shouldSelectOneAsynchronously() throws Exception {
|
||||
@@ -225,7 +224,7 @@ public class AsynchronousCassandraTemplateIntegrationTests extends AbstractSprin
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-287
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-287">DATACASS-287</a>
|
||||
*/
|
||||
@Test(timeout = 10000)
|
||||
public void shouldSelectOneAsynchronouslyIfObjectIsAbsent() throws Exception {
|
||||
@@ -246,14 +245,13 @@ public class AsynchronousCassandraTemplateIntegrationTests extends AbstractSprin
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuppressWarnings("unused")
|
||||
public static class Person {
|
||||
|
||||
private static final Random RNG = new Random();
|
||||
|
||||
@PrimaryKeyColumn(ordinal = 0, type = PrimaryKeyType.PARTITIONED) String id;
|
||||
@Column String firstname;
|
||||
|
||||
public static final String uuid() {
|
||||
public static String uuid() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user