Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin committed Oct 7, 2014
2 parents 4f46cbd + 1418b7b commit 029690f
Show file tree
Hide file tree
Showing 45 changed files with 2,962 additions and 1,742 deletions.
4 changes: 4 additions & 0 deletions examples/showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<groupId>org.springside</groupId>
<artifactId>springside-metrics</artifactId>
</dependency>
<dependency>
<groupId>org.springside</groupId>
<artifactId>springside-redis</artifactId>
</dependency>
<!-- SPRINGSIDE end -->

<!-- SPRING basic begin -->
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
package org.springside.examples.showcase.demos.redis;

import org.springside.modules.nosql.redis.JedisTemplate;
import org.springside.modules.nosql.redis.JedisUtils;
import org.springside.modules.nosql.redis.pool.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPoolBuilder;
import org.springside.modules.test.benchmark.BenchmarkTask;
import org.springside.modules.test.benchmark.ConcurrentBenchmark;

import redis.clients.jedis.JedisPool;

/**
* 测试Redis用于计数器时incr()方法的性能.
*
Expand Down Expand Up @@ -39,8 +38,8 @@ public RedisCounterBenchmark() {

@Override
protected void setUp() {
pool = JedisPoolFactory.createJedisPool(JedisUtils.DEFAULT_HOST, JedisUtils.DEFAULT_PORT,
JedisUtils.DEFAULT_TIMEOUT, threadCount);

pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(threadCount).buildPool();
jedisTemplate = new JedisTemplate(pool);

// 重置Counter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import org.springside.modules.mapper.JsonMapper;
import org.springside.modules.nosql.redis.JedisTemplate;
import org.springside.modules.nosql.redis.JedisTemplate.JedisActionNoResult;
import org.springside.modules.nosql.redis.JedisUtils;
import org.springside.modules.nosql.redis.pool.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPoolBuilder;
import org.springside.modules.test.benchmark.BenchmarkTask;
import org.springside.modules.test.benchmark.ConcurrentBenchmark;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

/**
* 测试Redis用于Session管理的setEx()与get()方法性能, 使用JSON格式存储数据.
Expand Down Expand Up @@ -44,8 +44,7 @@ public RedisSessionBenchmark() {

@Override
protected void setUp() {
pool = JedisPoolFactory.createJedisPool(JedisUtils.DEFAULT_HOST, JedisUtils.DEFAULT_PORT,
JedisUtils.DEFAULT_TIMEOUT, threadCount);
pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(threadCount).buildPool();
jedisTemplate = new JedisTemplate(pool);

// 清空数据库
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@
*******************************************************************************/
package org.springside.examples.showcase.demos.redis.elector;

import org.springside.examples.showcase.demos.redis.JedisPoolFactory;
import org.springside.modules.nosql.redis.JedisUtils;
import org.springside.modules.nosql.redis.elector.MasterElector;

import redis.clients.jedis.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPoolBuilder;
import org.springside.modules.nosql.redis.service.elector.MasterElector;

public class MasterElectorDemo {

public static void main(String[] args) throws Exception {

JedisPool pool = JedisPoolFactory.createJedisPool(JedisUtils.DEFAULT_HOST, JedisUtils.DEFAULT_PORT,
JedisUtils.DEFAULT_TIMEOUT, 1);
JedisPool pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(1).buildPool();
try {
MasterElector masterElector = new MasterElector(pool, 5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import org.springside.examples.showcase.demos.redis.JedisPoolFactory;
import org.springside.modules.nosql.redis.JedisUtils;
import org.springside.modules.nosql.redis.scheduler.AdvancedJobConsumer;
import org.springside.modules.nosql.redis.scheduler.SimpleJobConsumer;
import org.springside.modules.nosql.redis.pool.JedisPoolBuilder;
import org.springside.modules.nosql.redis.service.scheduler.AdvancedJobConsumer;
import org.springside.modules.nosql.redis.service.scheduler.SimpleJobConsumer;
import org.springside.modules.test.benchmark.ConcurrentBenchmark;
import org.springside.modules.utils.Threads;

Expand Down Expand Up @@ -41,8 +40,7 @@ public static void main(String[] args) throws Exception {
batchSize = Integer.parseInt(System.getProperty("batchsize",
String.valueOf(AdvancedJobConsumer.DEFAULT_BATCH_SIZE)));

pool = JedisPoolFactory.createJedisPool(JedisUtils.DEFAULT_HOST, JedisUtils.DEFAULT_PORT,
JedisUtils.DEFAULT_TIMEOUT, threadCount);
pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(threadCount).buildPool();

ExecutorService threadPool = Executors.newFixedThreadPool(threadCount);
for (int i = 0; i < threadCount; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import org.springside.examples.showcase.demos.redis.JedisPoolFactory;
import org.springside.modules.nosql.redis.JedisUtils;
import org.springside.modules.nosql.redis.scheduler.AdvancedJobConsumer;
import org.springside.modules.nosql.redis.scheduler.SimpleJobConsumer;
import org.springside.modules.nosql.redis.pool.JedisPoolBuilder;
import org.springside.modules.nosql.redis.service.scheduler.AdvancedJobConsumer;
import org.springside.modules.nosql.redis.service.scheduler.SimpleJobConsumer;
import org.springside.modules.test.benchmark.ConcurrentBenchmark;
import org.springside.modules.utils.Threads;

Expand All @@ -32,8 +31,7 @@ public static void main(String[] args) throws Exception {
threadCount = Integer.parseInt(System.getProperty(ConcurrentBenchmark.THREAD_COUNT_NAME,
String.valueOf(THREAD_COUNT)));

pool = JedisPoolFactory.createJedisPool(JedisUtils.DEFAULT_HOST, JedisUtils.DEFAULT_PORT,
JedisUtils.DEFAULT_TIMEOUT, threadCount);
pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(threadCount).buildPool();

ExecutorService threadPool = Executors.newFixedThreadPool(threadCount);
for (int i = 0; i < threadCount; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

import org.springside.examples.showcase.demos.redis.JedisPoolFactory;
import org.springside.modules.nosql.redis.JedisUtils;
import org.springside.modules.nosql.redis.scheduler.SimpleJobConsumer;
import org.springside.modules.nosql.redis.pool.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPoolBuilder;
import org.springside.modules.nosql.redis.service.scheduler.SimpleJobConsumer;
import org.springside.modules.test.benchmark.ConcurrentBenchmark;

import redis.clients.jedis.JedisPool;

import com.google.common.util.concurrent.RateLimiter;

/**
Expand Down Expand Up @@ -49,8 +47,7 @@ public static void main(String[] args) throws Exception {
threadCount = Integer.parseInt(System.getProperty(ConcurrentBenchmark.THREAD_COUNT_NAME,
String.valueOf(THREAD_COUNT)));

pool = JedisPoolFactory.createJedisPool(JedisUtils.DEFAULT_HOST, JedisUtils.DEFAULT_PORT,
JedisUtils.DEFAULT_TIMEOUT, threadCount);
pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(threadCount).buildPool();

ExecutorService threadPool = Executors.newFixedThreadPool(threadCount);
for (int i = 0; i < threadCount; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import org.springside.examples.showcase.demos.redis.JedisPoolFactory;
import org.springside.modules.nosql.redis.JedisUtils;
import org.springside.modules.nosql.redis.scheduler.JobDispatcher;
import org.springside.modules.nosql.redis.scheduler.JobStatistics;

import redis.clients.jedis.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPoolBuilder;
import org.springside.modules.nosql.redis.service.scheduler.JobDispatcher;
import org.springside.modules.nosql.redis.service.scheduler.JobStatistics;

/**
* 运行JobDispatcher,每秒将Job从"job:ss:scheduled" sorted set 发布到"job:ss:ready" list.
Expand All @@ -31,8 +29,7 @@ public class ReliableJobDispatcherDemo {

public static void main(String[] args) throws Exception {

JedisPool pool = JedisPoolFactory.createJedisPool(JedisUtils.DEFAULT_HOST, JedisUtils.DEFAULT_PORT,
JedisUtils.DEFAULT_TIMEOUT, 1);
JedisPool pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(1).buildPool();
try {
JobDispatcher dispatcher = new JobDispatcher("ss", pool);
dispatcher.setReliable(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import org.springside.examples.showcase.demos.redis.JedisPoolFactory;
import org.springside.modules.nosql.redis.JedisUtils;
import org.springside.modules.nosql.redis.scheduler.JobDispatcher;
import org.springside.modules.nosql.redis.scheduler.JobStatistics;

import redis.clients.jedis.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPoolBuilder;
import org.springside.modules.nosql.redis.service.scheduler.JobDispatcher;
import org.springside.modules.nosql.redis.service.scheduler.JobStatistics;

/**
* 运行JobDispatcher,每秒将Job从"job:ss:scheduled" sorted set 发布到"job:ss:ready" list.
Expand All @@ -31,8 +29,7 @@ public class SimpleJobDispatcherDemo {

public static void main(String[] args) throws Exception {

JedisPool pool = JedisPoolFactory.createJedisPool(JedisUtils.DEFAULT_HOST, JedisUtils.DEFAULT_PORT,
JedisUtils.DEFAULT_TIMEOUT, 1);
JedisPool pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(1).buildPool();
try {
JobDispatcher dispatcher = new JobDispatcher("ss", pool);
JobStatistics statistics = new JobStatistics("ss", pool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

import org.springside.examples.showcase.demos.redis.JedisPoolFactory;
import org.springside.examples.showcase.demos.redis.job.dispatcher.SimpleJobDispatcherDemo;
import org.springside.modules.nosql.redis.JedisUtils;
import org.springside.modules.nosql.redis.scheduler.JobProducer;
import org.springside.modules.nosql.redis.pool.JedisPool;
import org.springside.modules.nosql.redis.pool.JedisPoolBuilder;
import org.springside.modules.nosql.redis.service.scheduler.JobProducer;
import org.springside.modules.test.benchmark.BenchmarkTask;
import org.springside.modules.test.benchmark.ConcurrentBenchmark;

import redis.clients.jedis.JedisPool;

/**
* 运行JobProducer产生新的Job。
*
Expand Down Expand Up @@ -49,8 +47,7 @@ public JobProducerDemo() {

@Override
protected void setUp() {
pool = JedisPoolFactory.createJedisPool(JedisUtils.DEFAULT_HOST, JedisUtils.DEFAULT_PORT,
JedisUtils.DEFAULT_TIMEOUT, threadCount);
pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(threadCount).buildPool();
jobProducer = new JobProducer("ss", pool);
}

Expand Down
17 changes: 0 additions & 17 deletions modules/extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,6 @@
<optional>true</optional>
</dependency>

<!-- NOSQL -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<optional>true</optional>
</dependency>

<!-- freemarker -->
<dependency>
<groupId>org.freemarker</groupId>
Expand Down Expand Up @@ -109,11 +97,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.lordofthejars</groupId>
<artifactId>nosqlunit-redis</artifactId>
</dependency>

<!-- Mail -->
<dependency>
<groupId>com.icegreen</groupId>
Expand Down
Loading

0 comments on commit 029690f

Please sign in to comment.