Distributed and concurrent implementation of java.util.concurrent.ConcurrentMap and java.util.Map @author Nikita Koksharov @param key @param value
| 66 | * @param <V> value |
| 67 | */ |
| 68 | public class RedissonMap<K, V> extends RedissonExpirable implements RMap<K, V> { |
| 69 | |
| 70 | private final Logger log = LoggerFactory.getLogger(getClass()); |
| 71 | |
| 72 | final RedissonClient redisson; |
| 73 | final MapOptions<K, V> options; |
| 74 | final WriteBehindService writeBehindService; |
| 75 | final MapWriteBehindTask writeBehindTask; |
| 76 | |
| 77 | public RedissonMap(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K, V> options, WriteBehindService writeBehindService) { |
| 78 | super(commandExecutor, name); |
| 79 | this.redisson = redisson; |
| 80 | this.options = options; |
| 81 | if (options != null |
| 82 | && options.getWriteMode() == WriteMode.WRITE_BEHIND |
| 83 | && (options.getWriter() != null || options.getWriterAsync() != null)) { |
| 84 | this.writeBehindService = writeBehindService; |
| 85 | writeBehindTask = writeBehindService.start(getRawName(), options); |
| 86 | } else { |
| 87 | this.writeBehindService = null; |
| 88 | writeBehindTask = null; |
| 89 | } |
| 90 | if (options != null |
| 91 | && options.getWriterRetryAttempts()>1 |
| 92 | && options.getWriterAsync() != null){ |
| 93 | ((RetryableMapWriterAsync<Object, Object>) options.getWriterAsync()).setServiceManager(commandExecutor.getServiceManager()); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | public RedissonMap(Codec codec, CommandAsyncExecutor commandExecutor, String name) { |
| 98 | super(codec, commandExecutor, name); |
| 99 | this.name = name; |
| 100 | this.redisson = null; |
| 101 | this.options = null; |
| 102 | this.writeBehindService = null; |
| 103 | writeBehindTask = null; |
| 104 | } |
| 105 | |
| 106 | public RedissonMap(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K, V> options, WriteBehindService writeBehindService) { |
| 107 | super(codec, commandExecutor, name); |
| 108 | this.redisson = redisson; |
| 109 | this.options = options; |
| 110 | if (options != null |
| 111 | && options.getWriteMode() == WriteMode.WRITE_BEHIND |
| 112 | && (options.getWriter() != null || options.getWriterAsync() != null)) { |
| 113 | this.writeBehindService = writeBehindService; |
| 114 | writeBehindTask = writeBehindService.start(getRawName(), options); |
| 115 | } else { |
| 116 | this.writeBehindService = null; |
| 117 | writeBehindTask = null; |
| 118 | } |
| 119 | if (options != null |
| 120 | && options.getWriterRetryAttempts()>1 |
| 121 | && options.getWriterAsync() != null){ |
| 122 | ((RetryableMapWriterAsync<Object, Object>) options.getWriterAsync()).setServiceManager(commandExecutor.getServiceManager()); |
| 123 | } |
| 124 | } |
| 125 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…