org.zeromq.jzmq.sockets
Class SocketBuilder

java.lang.Object
  extended by org.zeromq.jzmq.sockets.SocketBuilder
All Implemented Interfaces:
Bindable, Connectable
Direct Known Subclasses:
PubSocketBuilder, PullSocketBuilder, PushSocketBuilder, SubSocketBuilder

public abstract class SocketBuilder
extends Object
implements Bindable, Connectable

SocketBuilder


Constructor Summary
SocketBuilder(ManagedContext context, SocketType socketType)
           
 
Method Summary
abstract  Socket bind(String url)
           
abstract  Socket connect(String url)
          Connect to a url
 String getIdentity()
          Return the identity of the socket
 long getLinger()
          Returns the linger period in millis
 long getRecvHWM()
          Returns the recv high water mark
 long getSendHWM()
           
 SocketType getSocketType()
          Returns the underlying socket type
 long getSwap()
          Return the swap size in bytes
 SocketBuilder withIdentity(String identity)
          Set the socket identity of the specified socket.
 SocketBuilder withLinger(long lingerMS)
          Set the linger period for the specified socket.
 SocketBuilder withReceiveHWM(long receiveHWM)
          The RECVHWM option shall set the high water mark (HWM) for inbound messages on the specified socket.
 SocketBuilder withSendHWM(long sendHWM)
           
 SocketBuilder withSwap(long swapSize)
          The swap option shall set the disk offload (swap) size for the specified socket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketBuilder

public SocketBuilder(ManagedContext context,
                     SocketType socketType)
Method Detail

getSocketType

public SocketType getSocketType()
Returns the underlying socket type

Returns:
socket type

withLinger

public SocketBuilder withLinger(long lingerMS)
Set the linger period for the specified socket. The linger period determines how long pending which have yet to sent to a peer shall linger in memory after a socket is closed.

Parameters:
lingerMS - the linger period in millis
Returns:
builder object

getLinger

public long getLinger()
Returns the linger period in millis

Returns:
linger period

withIdentity

public SocketBuilder withIdentity(String identity)
Set the socket identity of the specified socket. Socket identity determines if existing 0MQ infrastructure (message queues, forwarding devices) shall be identified with a specific application and persist across multiple runs of the application. If the socket has no identity, each run of the application is completely independent of other runs. The identity can only be between 0 and 256 bytes long exclusive.

Parameters:
identity - the identity
Returns:
builder object

getIdentity

public String getIdentity()
Return the identity of the socket

Returns:
the identity

withSwap

public SocketBuilder withSwap(long swapSize)
The swap option shall set the disk offload (swap) size for the specified socket. A socket which has a positive value may exceed it's high water mark; in the case of outstanding messages, they shall be offloaded to storage on disk.

Parameters:
swapSize - swap in bytes
Returns:
builder object

getSwap

public long getSwap()
Return the swap size in bytes

Returns:
the swap size

withSendHWM

public SocketBuilder withSendHWM(long sendHWM)

getSendHWM

public long getSendHWM()

withReceiveHWM

public SocketBuilder withReceiveHWM(long receiveHWM)
The RECVHWM option shall set the high water mark (HWM) for inbound messages on the specified socket. The HWM is a hard limit on the maximum number of outstanding 0MQ shall queue in memory for any single peer that the specified socket is communicating with. If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages. Refer to the individual socket descriptions in zmq_socket(3) for details on the exact action taken for each socket type.

Parameters:
receiveHWM - recv high water mark
Returns:
builder object

getRecvHWM

public long getRecvHWM()
Returns the recv high water mark

Returns:
recv high water mark

connect

public abstract Socket connect(String url)
                        throws Exception
Description copied from interface: Connectable
Connect to a url

Specified by:
connect in interface Connectable
Parameters:
url - the url to connect to
Returns:
the socket
Throws:
Exception

bind

public abstract Socket bind(String url)
                     throws Exception
Specified by:
bind in interface Bindable
Throws:
Exception


Copyright © 2013. All Rights Reserved.