Make Stress compiles within eclipse

patch by Benjamin Lerer; reviewed by Jake Luciani for CASSANDRA-10807
This commit is contained in:
Benjamin Lerer 2015-12-14 10:17:50 +01:00
parent dff2214595
commit 9b30d6572f
4 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,5 @@
2.1.13
* Make Stress compiles within eclipse (CASSANDRA-10807)
* Cassandra Daemon should print JVM arguments (CASSANDRA-10764)
* Allow cancellation of index summary redistribution (CASSANDRA-8805)
* Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)

View File

@ -31,13 +31,13 @@ public abstract class Generator<T>
public final String name;
public final AbstractType<T> type;
public final Class<T> clazz;
public final Class<?> clazz;
final long salt;
final Distribution identityDistribution;
final Distribution sizeDistribution;
public final Distribution clusteringDistribution;
public Generator(AbstractType<T> type, GeneratorConfig config, String name, Class<T> clazz)
public Generator(AbstractType<T> type, GeneratorConfig config, String name, Class<?> clazz)
{
this.type = type;
this.name = name;

View File

@ -26,16 +26,17 @@ import java.util.List;
import org.apache.cassandra.db.marshal.ListType;
public class Lists extends Generator<List>
public class Lists<T> extends Generator<List<T>>
{
final Generator valueType;
final Object[] buffer;
final Generator<T> valueType;
final T[] buffer;
public Lists(String name, Generator valueType, GeneratorConfig config)
@SuppressWarnings("unchecked")
public Lists(String name, Generator<T> valueType, GeneratorConfig config)
{
super(ListType.getInstance(valueType.type, true), config, name, List.class);
this.valueType = valueType;
buffer = new Object[(int) sizeDistribution.maxValue()];
buffer = (T[]) new Object[(int) sizeDistribution.maxValue()];
}
public void setSeed(long seed)
@ -45,7 +46,7 @@ public class Lists extends Generator<List>
}
@Override
public List generate()
public List<T> generate()
{
int size = (int) sizeDistribution.next();
for (int i = 0 ; i < size ; i++)

View File

@ -26,11 +26,11 @@ import java.util.Set;
import org.apache.cassandra.db.marshal.SetType;
public class Sets extends Generator<Set>
public class Sets<T> extends Generator<Set<T>>
{
final Generator valueType;
final Generator<T> valueType;
public Sets(String name, Generator valueType, GeneratorConfig config)
public Sets(String name, Generator<T> valueType, GeneratorConfig config)
{
super(SetType.getInstance(valueType.type, true), config, name, Set.class);
this.valueType = valueType;
@ -43,9 +43,9 @@ public class Sets extends Generator<Set>
}
@Override
public Set generate()
public Set<T> generate()
{
final Set set = new HashSet();
final Set<T> set = new HashSet<T>();
int size = (int) sizeDistribution.next();
for (int i = 0 ; i < size ; i++)
set.add(valueType.generate());