|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.millistream.www.Mdf
public class Mdf
This class represents the connection object between the libmdf client and server
Constructor Summary | |
---|---|
Mdf()
Constructs a new MessageHeader object. |
Method Summary | |
---|---|
boolean |
connect(java.lang.String servers)
Connects to a server specified in the servers string. |
int |
consume(int timeout)
Consumes any bytes from the server (if any). |
void |
disconnect()
Disconnects from the server. |
protected void |
finalize()
|
MessageField |
get_next_field()
Returns the current field in the message and proceed the internal position to the next field in the message. |
MessageHeader |
get_next_message()
Returns the header of the current message in the stream. |
int |
getError()
Gets the internal libmdf error code |
int |
getHeartbeatInterval()
Gets the Heartbeat Interval property. |
int |
getHeartbeatMaxMissed()
Gets Max Missed Heartbeats property. |
java.util.ArrayList<MessageHeader> |
getMessagesAndFields()
Calls get_next_message() + get_next_field()
repeatedly and constructs an ArrayList in order to minimize
the amount of Java to native calls for performance critical and latency
sensitive client applications. |
int |
getNoEncryption()
Gets the status of the Client to Server encryption. |
long |
getReceivedBytes()
Gets the "Number of bytes received from the server" property. |
long |
getSentBytes()
Gets the "Number of bytes sent to the server" property |
int |
getTCPNoDelay()
Gets the status of the TCP Nagle algorithm. |
int |
getTimeDifference()
Gets the Time Difference property. |
int |
getTimeout()
Gets the Connection Timeout property. |
boolean |
send(Message message)
Send the message chain to the server. |
boolean |
setConsumeDataCallback(Callback callback)
Registers a consumeData Callback |
boolean |
setHeartbeatInterval(int value)
Sets the Heartbeat Interval property. |
boolean |
setHeartbeatMaxMissed(int value)
Sets the Max Missed Heartbeats property. |
boolean |
setNoEncryption(int value)
Disable the Client to Server encryption. |
boolean |
setReceivedBytes(long value)
Sets the "Number of bytes received from the server" property. |
boolean |
setSentBytes(long value)
Sets the "Number of bytes sent to the server" property |
boolean |
setStatusChangeCallback(Callback callback)
Registers a statusChange Callback |
boolean |
setTCPNoDelay(int value)
Disable the TCP Nagle algorithm. |
boolean |
setTimeout(int value)
Sets the Connection Timeout property, |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Mdf()
MessageHeader
object. The object is not thread-safe
but different threads can access different objects simultaneously.
Method Detail |
---|
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public MessageHeader get_next_message()
getMessagesAndFields()
method instead.
MessageHeader
public MessageField get_next_field()
getMessagesAndFields()
method instead.
MessageField
public java.util.ArrayList<MessageHeader> getMessagesAndFields()
get_next_message()
+ get_next_field()
repeatedly and constructs an ArrayList
in order to minimize
the amount of Java to native calls for performance critical and latency
sensitive client applications. When this method is used the getFields()
method in the MessageHeader
class can be called in order to get
the ArrayList
of the fields.
consume()
method.MessageHeader
public boolean connect(java.lang.String servers)
"server:port"
where server
can be a host name or a raw IP address (IPv6 must be enclosed in brackets
"[address]", if the first server does not respond in time, the next will
be tried and so on until there is no more servers in the list.
servers
- a comma separated list in the form of "server:port"
public void disconnect()
public int consume(int timeout)
timeout
is the time in seconds to wait for data from the
server, if zero the function will return immediately if there is no data
to consume.
timeout
- time in seconds to wait for data from the server
Callback
public boolean send(Message message)
message
- the message to be sent to the server
Message
public boolean setTimeout(int value)
value
- the number of seconds before determining that a connection attempt has timed out. Valid values are 1-60.
public int getTimeout()
public boolean setHeartbeatInterval(int value)
value
- the number of seconds the connection must be idle before the API sends a hearbeat request to the server. Valid values are 1-86400.
public int getHeartbeatInterval()
public boolean setHeartbeatMaxMissed(int value)
value
- how many outstanding heartbeat requests to allow before the connection is determined to be disconnected. Valid values are 1-100.
public int getHeartbeatMaxMissed()
public boolean setTCPNoDelay(int value)
value
- '1' will disable the Nagle algorithm, '0' will enable it (the default).
public int getTCPNoDelay()
public boolean setNoEncryption(int value)
value
- '1' will disable client to server traffic encryption, '0' will enable it (the default). Once disabled it cannot be enabled again until the connection is closed.
public int getNoEncryption()
public int getTimeDifference()
public boolean setReceivedBytes(long value)
value
- number of bytes, can NOT be negative
public long getReceivedBytes()
public boolean setSentBytes(long value)
value
- number of bytes, can NOT be negative
public long getSentBytes()
public int getError()
public boolean setConsumeDataCallback(Callback callback)
callback
- an implementation of Callback
interface, can be null if the intention is to unset the callback
public boolean setStatusChangeCallback(Callback callback)
callback
- an implementation of Callback
interface, can be set to null if the intention is to unset the callback
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |