Skip to content

Commit 12876e9

Browse files
flolomFrancois Lolom a558367
authored andcommitted
Small refactor the WebSocket connection provider
* clean imports * package visibility for all provider implementation (force instantiation of the connection provider from the Stomp class only) * Subscriber lists are final
1 parent 46170ca commit 12876e9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/src/main/java/ua/naiksoftware/stomp/WebSocketsConnectionProvider.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package ua.naiksoftware.stomp;
22

3-
import android.os.Looper;
43
import android.util.Log;
54

65
import org.java_websocket.WebSocket;
@@ -27,23 +26,25 @@
2726
/**
2827
* Created by naik on 05.05.16.
2928
*/
30-
public class WebSocketsConnectionProvider implements ConnectionProvider {
29+
/* package */ class WebSocketsConnectionProvider implements ConnectionProvider {
3130

3231
private static final String TAG = WebSocketsConnectionProvider.class.getSimpleName();
3332

3433
private final String mUri;
3534
private final Map<String, String> mConnectHttpHeaders;
35+
36+
private final List<Subscriber<? super LifecycleEvent>> mLifecycleSubscribers;
37+
private final List<Subscriber<? super String>> mMessagesSubscribers;
38+
3639
private WebSocketClient mWebSocketClient;
37-
private List<Subscriber<? super LifecycleEvent>> mLifecycleSubscribers;
38-
private List<Subscriber<? super String>> mMessagesSubscribers;
3940
private boolean haveConnection;
4041
private TreeMap<String, String> mServerHandshakeHeaders;
4142

4243
/**
4344
* Support UIR scheme ws://host:port/path
4445
* @param connectHttpHeaders may be null
4546
*/
46-
public WebSocketsConnectionProvider(String uri, Map<String, String> connectHttpHeaders) {
47+
/* package */ WebSocketsConnectionProvider(String uri, Map<String, String> connectHttpHeaders) {
4748
mUri = uri;
4849
mConnectHttpHeaders = connectHttpHeaders != null ? connectHttpHeaders : new HashMap<>();
4950
mLifecycleSubscribers = new ArrayList<>();

0 commit comments

Comments
 (0)