Package com.couchbase.lite.internal.core
Class C4Socket
- java.lang.Object
-
- com.couchbase.lite.internal.core.C4NativePeer
-
- com.couchbase.lite.internal.core.C4Socket
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
AbstractCBLWebSocket
,MessageSocket
public abstract class C4Socket extends C4NativePeer
The process for closing one of these is complicated. No matter what happens, though, it always ends like this: Java calls C4Socket.closed (in the JNI, this turns into a call to c4socket_closed, which actually frees the native object). Presuming that the C has a non-null C4SocketFactory reference and that it contains a non-null socket_dispose reference, the C invokes it, producing the call to C4Socket.disposeI think that this entire class should be re-architected to use a single-threaded executor. Incoming messages should be enqueued as tasks on the executor. That would allow the removal of all of the synchronization and assure that tasks were processed in order.
Note that state transitions come from 3 places. Neither of the two subclasses, MessageSocket nor AbstractCBLWebSocket, allow inbound connections. For both, though shutdown is multiphase.
- Core: core request open and can request close
- Remote: this is a connection to a remote service. It can request shutdown
- Client: the client code can close the connection. It expects never to hear from it again
-
-
Field Summary
Fields Modifier and Type Field Description static int
NO_FRAMING
static int
WEB_SOCKET_CLIENT_FRAMING
static int
WEB_SOCKET_SERVER_FRAMING
-
-
-
Field Detail
-
WEB_SOCKET_CLIENT_FRAMING
public static final int WEB_SOCKET_CLIENT_FRAMING
- See Also:
- Constant Field Values
-
NO_FRAMING
public static final int NO_FRAMING
- See Also:
- Constant Field Values
-
WEB_SOCKET_SERVER_FRAMING
public static final int WEB_SOCKET_SERVER_FRAMING
- See Also:
- Constant Field Values
-
-