Class SocketBase
java.lang.Object
zmq.ZObject
zmq.Own
zmq.SocketBase
- All Implemented Interfaces:
Pipe.IPipeEvents, IPollEvents
- Direct Known Subclasses:
Channel, Client, Dealer, Dish, Gather, Pair, Pull, Push, Radio, Router, Scatter, Server, Stream, XPub, XSub
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprotected Stringprivate AtomicBooleanprivate AtomicBooleanprivate final MultiMap<String, SocketBase.EndpointPipe> private SocketChannelprivate Poller.Handleprivate ThreadLocal<Boolean> private longprivate final IMailboxprivate intprivate SocketBaseprivate final ReentrantLockprivate Pollerprivate booleanprivate Signalerprivate final booleanprivate final ReentrantLockprivate int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSocketBase(Ctx parent, int tid, int sid) protectedSocketBase(Ctx parent, int tid, int sid, boolean threadSafe) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddEndpoint(String addr, Own endpoint, Pipe pipe) private voidattachPipe(Pipe pipe, boolean isLocallyInitiated) private voidattachPipe(Pipe pipe, boolean subscribe2all, boolean isLocallyInitiated) final booleanfinal voidcancel(AtomicBoolean canceled) private voidprivate NetProtocolcheckProtocol(String protocol) final voidclose()final booleanprivate booleanconnectInternal(String addr) final intconnectPeer(String addr) protected voiddestroy()booleandisconnectPeer(int routingId) private voidfinal interrno()private voidfinal voideventAccepted(String addr, SelectableChannel ch) final voideventAcceptFailed(String addr, int errno) final voideventBindFailed(String addr, int errno) final voideventClosed(String addr, SelectableChannel ch) final voideventCloseFailed(String addr, int errno) final voideventConnectDelayed(String addr, int errno) final voideventConnected(String addr, SelectableChannel ch) final voideventConnectRetried(String addr, int interval) final voideventDisconnected(String addr, SelectableChannel ch) final voideventHandshakeFailedAuth(String addr, int errno) final voideventHandshakeFailedNoDetail(String addr, int errno) final voideventHandshakeFailedProtocol(String addr, int errno) final voideventHandshaken(String addr, int zmtpVersion) final voideventHandshakeSucceeded(String addr, int errno) final voideventListening(String addr, SelectableChannel ch) private voidextractFlags(Msg msg) protected Blobfinal SelectableChannelgetFD()(package private) final IMailboxfinal intgetSocketOpt(int option) final ObjectgetSocketOptx(int option) (package private) final booleanhasIn()(package private) final booleanhasOut()final voidfinal voidinEvent()Called by I/O thread when file descriptor is ready for reading.(package private) booleanisActive()private booleanfinal booleanfinal booleanprivate voidprivate voidlock()final booleanRegister the address for a monitor.protected final voidmonitorEvent(ZMQ.Event event) final voidpipeTerminated(Pipe pipe) final intpoll(int interest, int timeout, AtomicBoolean canceled) protected final voidprocessBind(Pipe pipe) private booleanprocessCommands(int timeout, boolean throttle, AtomicBoolean canceled) protected final voidprotected final voidprotected final voidprocessTerm(int linger) final voidreadActivated(Pipe pipe) final Msgrecv(int flags) final Msgrecv(int flags, AtomicBoolean canceled) final booleanfinal booleansend(Msg msg, int flags, AtomicBoolean canceled) final booleansetSocketOpt(int option, Object optval) (package private) final voidstartReaping(Poller poller) (package private) final voidstop()private voidfinal booleantermEndpoint(String addr) toString()private voidunlock()final voidwriteActivated(Pipe pipe) protected abstract voidxattachPipe(Pipe pipe, boolean subscribe2all, boolean isLocallyInitiated) protected booleanxdisconnectPeer(int routingId) protected booleanxhasIn()protected booleanxhasOut()protected voidprotected booleanprotected booleanprotected abstract voidxpipeTerminated(Pipe pipe) protected voidxreadActivated(Pipe pipe) protected Msgxrecv()protected booleanprotected booleanxsetsockopt(int option, Object optval) protected voidxwriteActivated(Pipe pipe) Methods inherited from class Own
incSeqnum, isTerminating, launchChild, processOwn, processSeqnum, processTermAck, processTermReq, registerTermAcks, termChild, terminate, unregisterTermAckMethods inherited from class ZObject
chooseIoThread, connectPending, destroySocket, findEndpoint, getCtx, getTid, pendConnection, processActivateRead, processActivateWrite, processAttach, processCancel, processCommand, processHiccup, processPipeTerm, processPipeTermAck, processPlug, processReap, processReapAck, processReaped, registerEndpoint, sendActivateRead, sendActivateWrite, sendAttach, sendAttach, sendBind, sendBind, sendCancel, sendDone, sendHiccup, sendInprocConnected, sendOwn, sendPipeTerm, sendPipeTermAck, sendPlug, sendPlug, sendReap, sendReapAck, sendReaped, sendStop, sendTerm, sendTermAck, sendTermReq, setTid, unregisterEndpoint, unregisterEndpointsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IPollEvents
acceptEvent, connectEvent, outEvent, timerEvent
-
Field Details
-
endpoints
-
inprocs
-
active
private boolean active -
ctxTerminated
-
isInEventThreadLocal
-
destroyed
-
mailbox
-
pipes
-
poller
-
handle
-
lastTsc
private long lastTsc -
ticks
private int ticks -
rcvmore
private boolean rcvmore -
fileDesc
-
monitorSocket
-
monitorEvents
private int monitorEvents -
connectRid
-
monitorSync
-
threadSafe
private final boolean threadSafe -
threadSafeSync
-
reaperSignaler
-
-
Constructor Details
-
SocketBase
-
SocketBase
-
-
Method Details
-
xattachPipe
-
xpipeTerminated
-
isActive
boolean isActive()- Returns:
- false if object is not a socket.
-
destroy
-
getMailbox
-
stop
final void stop() -
checkProtocol
-
attachPipe
-
attachPipe
-
setSocketOpt
-
getSocketOpt
public final int getSocketOpt(int option) -
getSocketOptx
-
bind
-
connect
-
connectPeer
-
connectInternal
-
disconnectPeer
public boolean disconnectPeer(int routingId) -
addEndpoint
-
termEndpoint
-
send
-
send
-
recv
-
recv
-
join
-
leave
-
cancel
-
poll
-
close
public final void close() -
hasIn
final boolean hasIn() -
hasOut
final boolean hasOut() -
startReaping
-
isInEvent
private boolean isInEvent() -
processCommands
-
processStop
protected final void processStop()- Overrides:
processStopin classZObject
-
processBind
- Overrides:
processBindin classZObject
-
processTerm
protected final void processTerm(int linger) - Overrides:
processTermin classOwn
-
processDestroy
protected final void processDestroy()- Overrides:
processDestroyin classOwn
-
xsetsockopt
-
xhasOut
protected boolean xhasOut() -
xsend
-
xhasIn
protected boolean xhasIn() -
xrecv
-
getCredential
-
xreadActivated
-
xwriteActivated
-
xhiccuped
-
xjoin
-
xleave
-
xdisconnectPeer
protected boolean xdisconnectPeer(int routingId) -
enterInEvent
private void enterInEvent() -
leaveInEvent
private void leaveInEvent() -
inEvent
public final void inEvent()Description copied from interface:IPollEventsCalled by I/O thread when file descriptor is ready for reading.- Specified by:
inEventin interfaceIPollEvents
-
checkDestroy
private void checkDestroy() -
readActivated
- Specified by:
readActivatedin interfacePipe.IPipeEvents
-
writeActivated
- Specified by:
writeActivatedin interfacePipe.IPipeEvents
-
hiccuped
- Specified by:
hiccupedin interfacePipe.IPipeEvents
-
pipeTerminated
- Specified by:
pipeTerminatedin interfacePipe.IPipeEvents
-
extractFlags
-
monitor
Register the address for a monitor. It must be a inproc PAIR.- Parameters:
addr- or null for unregister.events- an event mask to monitor.- Returns:
- true if creation succeeded.
- Throws:
IllegalStateException- if a previous monitor was already registered.
-
eventHandshaken
-
eventConnected
-
eventConnectDelayed
-
eventConnectRetried
-
eventListening
-
eventBindFailed
-
eventAccepted
-
eventAcceptFailed
-
eventClosed
-
eventCloseFailed
-
eventDisconnected
-
eventHandshakeFailedNoDetail
-
eventHandshakeFailedProtocol
-
eventHandshakeFailedAuth
-
eventHandshakeSucceeded
-
event
-
monitorEvent
-
stopMonitor
private void stopMonitor() -
toString
-
getFD
-
typeString
-
errno
public final int errno() -
lock
private void lock() -
unlock
private void unlock()
-