public interface Connection
Title: Service Event Fabric Core
Description: Defines a network connection.
Copyright: Copyright (c) 2009
Company: StreamScape Technologies
Modifier and Type | Method and Description |
---|---|
void |
close(boolean isNormal)
Closes the connection.
|
java.lang.String |
getAcceptorName()
Returns a name of acceptor associated with the connection.
|
Address |
getAddress()
Returns an address of the connection.
|
boolean |
isOpened()
Checks if the connection is opened.
|
void |
open(boolean isOutgoing)
Opens the connection.
|
void |
publish(byte[] packet)
Sends the specified packet in the 'publish-subscribe asynchronous' mode.
|
byte[] |
publishRequest(byte[] packet)
Sends the specified packet the in the 'publish-subscribe synchronous' mode.
|
void |
send(byte[] packet)
Sends the specified packet in the 'peer-to-peer asynchronous' mode.
|
void |
sendReply(long requestId,
boolean status,
java.nio.ByteBuffer packet)
Sends the specified packet as reply on a request with the specified id.
|
byte[] |
sendRequest(byte[] packet,
long timeout)
Sends the specified packet in the 'peer-to-peer synchronous' mode.
|
void |
setPacketHandler(PacketHandler packetHandler)
Sets the packet handler associated with the connection.
|
Address getAddress()
java.lang.String getAcceptorName()
null
if the connection associates with no acceptors.void setPacketHandler(PacketHandler packetHandler)
packetHandler
- the packet handler to be set.boolean isOpened()
true
if the connection is opened, false
otherwise.void open(boolean isOutgoing) throws FabricException
isOutgoing
- checks if the connection is the outgoing one.FabricException
- if some error occurs during an opening.void close(boolean isNormal)
isNormal
- indicates if the connection is being closed in normal way.void send(byte[] packet) throws FabricException
packet
- the packet to be sent.FabricException
- if some error occurs during a sending.byte[] sendRequest(byte[] packet, long timeout) throws FabricException, java.util.concurrent.TimeoutException
packet
- the packet to be sent.timeout
- the waiting time for reply (in milliseconds).null
if the timeout expired.FabricException
- if some error occurs during a sending.java.util.concurrent.TimeoutException
- if the specified waiting time has expired.void publish(byte[] packet) throws FabricException
packet
- the packet to be sent.FabricException
- if some error occurs during a sending.byte[] publishRequest(byte[] packet) throws FabricException
packet
- the packet to be sent.null if the packet handling is completed successfully, non-null
reply if some error occurs during a handling.
FabricException
- if some error occurs during a sending.void sendReply(long requestId, boolean status, java.nio.ByteBuffer packet) throws FabricException
requestId
- the id of the replied request.status
- the flag indicating if the request was processed successfully.packet
- the packet to be sent.FabricException
- if some error occurs during a sending.Copyright © 2015-2024 StreamScape Technologies. All rights reserved.