to get rid of "magic" time constants

This commit is contained in:
igor-suhorukov
2018-03-08 21:30:45 +03:00
committed by Juergen Hoeller
parent ed7684d2b2
commit 407ecf7334
7 changed files with 16 additions and 11 deletions

View File

@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
@@ -87,7 +88,7 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
@Nullable
private TaskScheduler taskScheduler;
private long receiptTimeLimit = 15 * 1000;
private long receiptTimeLimit = TimeUnit.SECONDS.toMillis(15);
private volatile boolean autoReceiptEnabled;

View File

@@ -17,6 +17,7 @@
package org.springframework.messaging.simp.stomp;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.springframework.lang.Nullable;
import org.springframework.messaging.converter.MessageConverter;
@@ -48,7 +49,7 @@ public abstract class StompClientSupport {
private long[] defaultHeartbeat = new long[] {10000, 10000};
private long receiptTimeLimit = 15 * 1000;
private long receiptTimeLimit = TimeUnit.SECONDS.toMillis(15);
/**

View File

@@ -17,6 +17,7 @@
package org.springframework.messaging.simp.user;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.Nullable;
@@ -56,7 +57,7 @@ public class UserRegistryMessageHandler implements MessageHandler, ApplicationLi
@Nullable
private volatile ScheduledFuture<?> scheduledFuture;
private long registryExpirationPeriod = 20 * 1000;
private long registryExpirationPeriod = TimeUnit.SECONDS.toMillis(20);
/**