Skip to content

Commit b4e402d

Browse files
author
Sylvain Lebresne
committed
Merge branch '1.0' into 2.0
Conflicts: driver-core/CHANGELOG.rst
2 parents b7b369f + a4d323a commit b4e402d

File tree

4 files changed

+63
-14
lines changed

4 files changed

+63
-14
lines changed

driver-core/CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ CHANGELOG
4141
first one (JAVA-88).
4242

4343

44+
1.0.5:
45+
------
46+
47+
- [new] OSGi bundle (JAVA-142)
48+
49+
4450
1.0.4:
4551
------
4652

driver-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<version>2.0.0-beta3-SNAPSHOT</version>
2222
</parent>
2323
<artifactId>cassandra-driver-core</artifactId>
24-
<packaging>jar</packaging>
24+
<packaging>bundle</packaging>
2525
<name>DataStax Java Driver for Apache Cassandra - Core</name>
2626
<description>A driver for Apache Cassandra 1.2+ that works exclusively with the Cassandra Query Language version 3 (CQL3) and Cassandra's binary protocol.</description>
2727
<url>https://github.com/datastax/java-driver</url>

driver-examples/stress/src/main/java/com/datastax/driver/stress/Stress.java

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ private static OptionParser defaultParser() {
5656
accepts("ip", "The hosts ip to connect to").withRequiredArg().ofType(String.class).defaultsTo("127.0.0.1");
5757
accepts("report-file", "The name of csv file to use for reporting results").withRequiredArg().ofType(String.class).defaultsTo("last.csv");
5858
accepts("print-delay", "The delay in seconds at which to report on the console").withRequiredArg().ofType(Integer.class).defaultsTo(5);
59+
accepts("compression", "Use compression (SNAPPY)");
60+
accepts("connections-per-host", "The number of connections per hosts (default: based on the number of threads)").withRequiredArg().ofType(Integer.class);
5961
}};
6062
String msg = "Where <generator> can be one of " + generators.keySet() + "\n"
6163
+ "You can get more help on a particular generator with: stress <generator> -h";
@@ -201,24 +203,38 @@ public static void main(String[] args) throws Exception {
201203
boolean async = options.has("async");
202204

203205
int iterations = (requests == -1 ? -1 : requests / concurrency);
206+
207+
final int maxRequestsPerConnection = 128;
208+
int maxConnections = options.has("connections-per-host")
209+
? (Integer)options.valueOf("connections-per-host")
210+
: concurrency / maxRequestsPerConnection + 1;
211+
212+
PoolingOptions pools = new PoolingOptions();
213+
pools.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL, concurrency);
214+
pools.setCoreConnectionsPerHost(HostDistance.LOCAL, maxConnections);
215+
pools.setMaxConnectionsPerHost(HostDistance.LOCAL, maxConnections);
216+
pools.setCoreConnectionsPerHost(HostDistance.REMOTE, maxConnections);
217+
pools.setMaxConnectionsPerHost(HostDistance.REMOTE, maxConnections);
218+
204219
System.out.println("Initializing stress test:");
205-
System.out.println(" request count: " + (requests == -1 ? "unlimited" : requests));
206-
System.out.println(" concurrency: " + concurrency + " (" + iterations + " requests/thread)");
207-
System.out.println(" mode: " + (async ? "asynchronous" : "blocking"));
220+
System.out.println(" request count: " + (requests == -1 ? "unlimited" : requests));
221+
System.out.println(" concurrency: " + concurrency + " (" + iterations + " requests/thread)");
222+
System.out.println(" mode: " + (async ? "asynchronous" : "blocking"));
223+
System.out.println(" per-host connections: " + maxConnections);
224+
System.out.println(" compression: " + options.has("compression"));
225+
226+
SocketOptions socket = new SocketOptions();
227+
socket.setTcpNoDelay(true);
208228

209229
try {
210230
// Create session to hosts
211-
Cluster cluster = new Cluster.Builder().addContactPoints(String.valueOf(options.valueOf("ip"))).build();
212-
213-
final int maxRequestsPerConnection = 128;
214-
int maxConnections = concurrency / maxRequestsPerConnection + 1;
231+
Cluster cluster = new Cluster.Builder()
232+
.addContactPoints(String.valueOf(options.valueOf("ip")))
233+
.withPoolingOptions(pools)
234+
.build();
215235

216-
PoolingOptions pools = cluster.getConfiguration().getPoolingOptions();
217-
pools.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL, concurrency);
218-
pools.setCoreConnectionsPerHost(HostDistance.LOCAL, maxConnections);
219-
pools.setMaxConnectionsPerHost(HostDistance.LOCAL, maxConnections);
220-
pools.setCoreConnectionsPerHost(HostDistance.REMOTE, maxConnections);
221-
pools.setMaxConnectionsPerHost(HostDistance.REMOTE, maxConnections);
236+
if (options.has("compression"))
237+
cluster.getConfiguration().getProtocolOptions().setCompression(ProtocolOptions.Compression.SNAPPY);
222238

223239
Session session = cluster.connect();
224240

pom.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,33 @@
105105
</descriptorRefs>
106106
</configuration>
107107
</plugin>
108+
<plugin>
109+
<groupId>org.apache.felix</groupId>
110+
<artifactId>maven-bundle-plugin</artifactId>
111+
<extensions>true</extensions>
112+
<version>2.4.0</version>
113+
<executions>
114+
<execution>
115+
<id>bundle-manifest</id>
116+
<phase>process-classes</phase>
117+
<goals>
118+
<goal>manifest</goal>
119+
</goals>
120+
</execution>
121+
</executions>
122+
<configuration>
123+
<instructions>
124+
<Bundle-SymbolicName>com.datastax.driver.core</Bundle-SymbolicName>
125+
<Bundle-Version>${project.version}</Bundle-Version>
126+
<_include>-osgi.bnd</_include>
127+
</instructions>
128+
<supportedProjectTypes>
129+
<supportedProjectType>jar</supportedProjectType>
130+
<supportedProjectType>bundle</supportedProjectType>
131+
<supportedProjectType>pom</supportedProjectType>
132+
</supportedProjectTypes>
133+
</configuration>
134+
</plugin>
108135
</plugins>
109136
</build>
110137

0 commit comments

Comments
 (0)