Commit ebe24a6c32c7337613176e718d9e818f7fa649c7
1 parent
019d95cf
优化redis连接
Showing
4 changed files
with
9 additions
and
5 deletions
src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java
| ... | ... | @@ -14,7 +14,8 @@ import org.springframework.stereotype.Component; |
| 14 | 14 | import org.springframework.util.ObjectUtils; |
| 15 | 15 | import org.springframework.web.filter.OncePerRequestFilter; |
| 16 | 16 | |
| 17 | -import javax.servlet.*; | |
| 17 | +import javax.servlet.FilterChain; | |
| 18 | +import javax.servlet.ServletException; | |
| 18 | 19 | import javax.servlet.annotation.WebFilter; |
| 19 | 20 | import javax.servlet.http.HttpServletRequest; |
| 20 | 21 | import javax.servlet.http.HttpServletResponse; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java
| ... | ... | @@ -10,6 +10,7 @@ import org.springframework.context.annotation.Bean; |
| 10 | 10 | import org.springframework.context.annotation.Configuration; |
| 11 | 11 | import org.springframework.core.annotation.Order; |
| 12 | 12 | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| 13 | +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | |
| 13 | 14 | import org.springframework.data.redis.core.RedisTemplate; |
| 14 | 15 | import org.springframework.data.redis.listener.PatternTopic; |
| 15 | 16 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| ... | ... | @@ -49,6 +50,9 @@ public class RedisConfig extends CachingConfigurerSupport { |
| 49 | 50 | |
| 50 | 51 | @Bean |
| 51 | 52 | public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { |
| 53 | + LettuceConnectionFactory lettuceConnectionFactory = (LettuceConnectionFactory) redisConnectionFactory; | |
| 54 | + lettuceConnectionFactory.afterPropertiesSet(); | |
| 55 | + | |
| 52 | 56 | RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); |
| 53 | 57 | // 使用fastJson序列化 |
| 54 | 58 | FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); |
| ... | ... | @@ -59,7 +63,7 @@ public class RedisConfig extends CachingConfigurerSupport { |
| 59 | 63 | // key的序列化采用StringRedisSerializer |
| 60 | 64 | redisTemplate.setKeySerializer(new StringRedisSerializer()); |
| 61 | 65 | redisTemplate.setHashKeySerializer(new StringRedisSerializer()); |
| 62 | - redisTemplate.setConnectionFactory(redisConnectionFactory); | |
| 66 | + redisTemplate.setConnectionFactory(lettuceConnectionFactory); | |
| 63 | 67 | return redisTemplate; |
| 64 | 68 | } |
| 65 | 69 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| ... | ... | @@ -983,8 +983,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 983 | 983 | return; |
| 984 | 984 | } |
| 985 | 985 | String addressStr = sdp.getConnection().getAddress(); |
| 986 | - logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}, {}", requesterId, addressStr, port, ssrc, | |
| 987 | - mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP"); | |
| 986 | + logger.info("设备{}请求语音流, 收流地址:{}:{},ssrc:{}, {}, 对讲方式:{}", requesterId, addressStr, port, ssrc, | |
| 987 | + mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP", sdp.getSessionName().getValue()); | |
| 988 | 988 | |
| 989 | 989 | MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem(); |
| 990 | 990 | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, | ... | ... |