public abstract class DatagramBasedTransport<U extends Endpoint,L extends Endpoint> extends ChannelTransportImpl<U> implements TransportListener<L>, ChannelListener<L>
| 修飾子とタイプ | クラスと説明 |
|---|---|
protected static class |
DatagramBasedTransport.DatagramChannel<E extends Endpoint> |
| 修飾子とタイプ | フィールドと説明 |
|---|---|
static byte |
CH_CLOSE_CMD |
static byte |
CH_NEW_ACK_CMD |
static byte |
CH_NEW_CMD |
static byte |
CH_NEW_NACK_CMD |
chListenersByUpper, supportsDuplexdefaultAppId, isActive, isBaseTransport, listenersByUpper, lowerTrans, peer, peerId, transId, transIdPath, uppersDEFAULT_APP_ID| 修飾子 | コンストラクタと説明 |
|---|---|
protected |
DatagramBasedTransport(Peer peer,
TransportId transId,
Transport<?> lowerTrans,
boolean supportsDuplex) |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
protected void |
_onReceive(ReceivedMessage rmsg) |
protected abstract NestedMessage |
_preReceive(ReceivedMessage rmsg)
サブクラスで受信時のロジックを埋めるための用いるメソッド。
|
protected void |
_send(ObjectId sender,
ObjectId receiver,
int channelNo,
U dst,
Object msg) |
protected void |
closeCh(boolean isDirect,
ChannelImpl<U> ch)
channelのclose処理を行う。
|
protected DatagramBasedTransport.DatagramChannel<U> |
getAcceptCh(PeerId creator,
int channelNo) |
protected DatagramBasedTransport.DatagramChannel<U> |
getClientCh(int channelNo) |
protected abstract void |
lowerSend(U dst,
NestedMessage nmsg)
サブクラスで下位層の送信処理を実装するために用いるメソッド。
|
protected DatagramBasedTransport.DatagramChannel<U> |
newAcceptChIfAbsent(PeerId creator,
ObjectId localObjId,
ObjectId remoteObjId,
int channelNo,
U dst) |
Channel<U> |
newChannel(ObjectId sender,
ObjectId receiver,
U dst,
boolean isDuplex,
int timeout)
Create a new channel with isDuplex and timeout.
|
boolean |
onAccepting(Channel<L> channel)
Channelが通信相手によって、生成された際に呼び出されるメソッド。
|
void |
onClosed(Channel<L> channel)
Channelが通信相手によって、closeされた際に呼び出されるメソッド。
|
void |
onFailure(Channel<L> channel,
Exception cause)
Channelが予期せぬ例外によって、切断された際に呼び出されるメソッド。
|
void |
onReceive(Channel<L> lowerCh)
Channelがメッセージを受信した際に呼び出されるメソッド。
|
void |
onReceive(Transport<L> lowerTrans,
ReceivedMessage rmsg)
Transportオブジェクトがメッセージを受信した際に呼び出されるメソッド。
|
protected void |
raiseUpperListener(NestedMessage nmsg) |
void |
send(ObjectId sender,
ObjectId receiver,
U dst,
Object msg)
Send a message from a local object to a remote object.
|
protected abstract boolean |
useReceiverThread(int numProc)
ここでの受信処理をスレッドを使って並行化させるかどうかを判断する。
|
fin, getChannelListener, getChannelListener, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, setChannelListener, setChannelListener, supportsDuplex, toString0checkActive, getBaseTransport, getDefaultAppId, getListener, getListener, getLowerTransport, getLowerTransports, getMTU, getPeer, getPeerId, getTransportId, getTransportIdPath, getUppers, hasStableLocator, isUp, send, send, send, send, send, send, send, setBaseTransport, setDefaultAppId, setListener, setListener, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetEndpointgetBaseTransport, getListener, getListener, getLowerTransport, getLowerTransports, getMTU, getPeer, getPeerId, getTransportId, getTransportIdPath, hasStableLocator, isUp, send, send, send, send, send, send, send, setListener, setListenerpublic static final byte CH_NEW_CMD
public static final byte CH_NEW_ACK_CMD
public static final byte CH_NEW_NACK_CMD
public static final byte CH_CLOSE_CMD
protected DatagramBasedTransport(Peer peer, TransportId transId, Transport<?> lowerTrans, boolean supportsDuplex) throws IdConflictException
public Channel<U> newChannel(ObjectId sender, ObjectId receiver, U dst, boolean isDuplex, int timeout) throws ProtocolUnsupportedException, IOException
ChannelTransportnewChannel インタフェース内 ChannelTransport<U extends Endpoint>newChannel クラス内 ChannelTransportImpl<U extends Endpoint>sender - object ID of the sender.receiver - object ID of the receiver.dst - the endpoint of the destination to create channel.isDuplex - whether the connection is duplex or not.timeout - the timeout length.ProtocolUnsupportedException - an exception thrown when the protocol is not supported.IOException - an exception when thrown when an I/O error occurred.protected DatagramBasedTransport.DatagramChannel<U> getClientCh(int channelNo)
protected DatagramBasedTransport.DatagramChannel<U> getAcceptCh(PeerId creator, int channelNo)
protected DatagramBasedTransport.DatagramChannel<U> newAcceptChIfAbsent(PeerId creator, ObjectId localObjId, ObjectId remoteObjId, int channelNo, U dst)
protected void closeCh(boolean isDirect,
ChannelImpl<U> ch)
isDirect - こちら側のtransportがchannelのcloseを指示した場合はtrue、
それ以外はfalseをセットする。ch - channelオブジェクトprotected abstract void lowerSend(U dst, NestedMessage nmsg) throws ProtocolUnsupportedException, IOException
dst - 送信先nmsg - NestedMessageProtocolUnsupportedException - プロトコルミスマッチ等の例外が出た場合IOException - I/O関係の例外が出た場合protected void _send(ObjectId sender, ObjectId receiver, int channelNo, U dst, Object msg) throws ProtocolUnsupportedException, IOException
public void send(ObjectId sender, ObjectId receiver, U dst, Object msg) throws ProtocolUnsupportedException, IOException
Transportreceiver on
the peer with destination dst.
This type of send is used when the sender and the receiver have different ObjectId, which means
upper layer exchanges the message using Transport.send インタフェース内 Transport<U extends Endpoint>sender - The ObjectId of the sender.receiver - The ObjectId of the receiver.dst - The Destination of the peer.msg - The message itself.ProtocolUnsupportedException - Raises if the 'dst' peer does not handle the protocol.IOException - Raises if I/O-related exceptions occured.protected abstract NestedMessage _preReceive(ReceivedMessage rmsg)
rmsg - ReceivedMessageprotected abstract boolean useReceiverThread(int numProc)
numProc - procedureの数protected void raiseUpperListener(NestedMessage nmsg)
protected void _onReceive(ReceivedMessage rmsg)
public void onReceive(Transport<L> lowerTrans, ReceivedMessage rmsg)
TransportListeneronReceive インタフェース内 TransportListener<L extends Endpoint>lowerTrans - Transportオブジェクトrmsg - ReceivedMessageオブジェクトpublic boolean onAccepting(Channel<L> channel)
ChannelListeneronAccepting インタフェース内 ChannelListener<L extends Endpoint>channel - Channelオブジェクトpublic void onClosed(Channel<L> channel)
ChannelListeneronClosed インタフェース内 ChannelListener<L extends Endpoint>channel - Channelオブジェクトpublic void onFailure(Channel<L> channel, Exception cause)
ChannelListeneronFailure インタフェース内 ChannelListener<L extends Endpoint>channel - Channelオブジェクトcause - Channelが切断された原因となる例外public void onReceive(Channel<L> lowerCh)
ChannelListeneronReceive インタフェース内 ChannelListener<L extends Endpoint>lowerCh - ChannelオブジェクトCopyright © 2017. All rights reserved.