Skip to content

Commit

Permalink
RedissonMultiLock implementation. #376
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita committed Jan 21, 2016
1 parent 1865c05 commit 2143f1e
Show file tree
Hide file tree
Showing 16 changed files with 761 additions and 109 deletions.
24 changes: 24 additions & 0 deletions src/main/java/org/redisson/Config.java
Expand Up @@ -24,6 +24,8 @@
import org.redisson.client.codec.Codec;
import org.redisson.codec.JsonJacksonCodec;

import io.netty.channel.EventLoopGroup;

/**
* Redisson configuration
*
Expand Down Expand Up @@ -54,11 +56,14 @@ public class Config {

private boolean useLinuxNativeEpoll;

private EventLoopGroup eventLoopGroup;

public Config() {
}

public Config(Config oldConf) {
setUseLinuxNativeEpoll(oldConf.isUseLinuxNativeEpoll());
setEventLoopGroup(oldConf.getEventLoopGroup());

if (oldConf.getCodec() == null) {
// use it by default
Expand All @@ -67,6 +72,7 @@ public Config(Config oldConf) {

setThreads(oldConf.getThreads());
setCodec(oldConf.getCodec());
setEventLoopGroup(oldConf.getEventLoopGroup());
if (oldConf.getSingleServerConfig() != null) {
setSingleServerConfig(new SingleServerConfig(oldConf.getSingleServerConfig()));
}
Expand Down Expand Up @@ -339,6 +345,24 @@ public boolean isUseLinuxNativeEpoll() {
return useLinuxNativeEpoll;
}

/**
* Use defined eventLoopGroup instance.
* Thus several Redisson instances can use one eventLoopGroup instance.
* <p/>
* Only {@link io.netty.channel.epoll.EpollEventLoopGroup} or
* {@link io.netty.channel.nio.NioEventLoopGroup} can be used.
*
* @param eventLoopGroup
* @return
*/
public Config setEventLoopGroup(EventLoopGroup eventLoopGroup) {
this.eventLoopGroup = eventLoopGroup;
return this;
}
public EventLoopGroup getEventLoopGroup() {
return eventLoopGroup;
}

/**
* Read config object stored in JSON format from <code>String</code>
*
Expand Down

0 comments on commit 2143f1e

Please sign in to comment.