パッケージ org.piax.gtrans.impl
クラス DatagramBasedTransport<U extends Endpoint,L extends Endpoint>
java.lang.Object
org.piax.gtrans.impl.TransportImpl<E>
org.piax.gtrans.impl.ChannelTransportImpl<U>
org.piax.gtrans.impl.DatagramBasedTransport<U,L>
- すべての実装されたインタフェース:
Closeable,AutoCloseable,ChannelListener<L>,ChannelTransport<U>,Transport<U>,TransportListener<L>
- 直系の既知のサブクラス:
BaseDatagramTransport,ChannelAddOnTransport,HandoverTransport
public abstract class DatagramBasedTransport<U extends Endpoint,L extends Endpoint> extends ChannelTransportImpl<U> implements TransportListener<L>, ChannelListener<L>
Channel通信機能を提供しない下位のTransportまたはRawTransportを使って、
通常のChannelを使ったTransportの機能を作るためのテンプレートクラス
-
ネストされたクラスの概要
ネストされたクラス 修飾子とタイプ クラス 説明 protected static classDatagramBasedTransport.DatagramChannel<E extends Endpoint> -
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 static byteCH_CLOSE_CMDstatic byteCH_NEW_ACK_CMDstatic byteCH_NEW_CMDstatic byteCH_NEW_NACK_CMDクラスから継承されたフィールド org.piax.gtrans.impl.TransportImpl
defaultAppId, isActive, isBaseTransport, listenersByUpper, lowerTrans, peer, peerId, transId, transIdPath, uppers -
コンストラクタの概要
コンストラクタ 修飾子 コンストラクタ 説明 protectedDatagramBasedTransport(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, TransOptions opts)protected voidcloseCh(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 voidlowerSend(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)booleanonAccepting(Channel<L> channel)voidonClosed(Channel<L> channel)voidonFailure(Channel<L> channel, Exception cause)voidonReceive(Channel<L> lowerCh)voidonReceive(Transport<L> lowerTrans, ReceivedMessage rmsg)protected voidraiseUpperListener(NestedMessage nmsg)voidsend(ObjectId sender, ObjectId receiver, U dst, Object msg, TransOptions opts)protected abstract booleanuseReceiverThread(int numProc)ここでの受信処理をスレッドを使って並行化させるかどうかを判断する。クラスから継承されたメソッド org.piax.gtrans.impl.ChannelTransportImpl
fin, getChannelListener, getChannelListener, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, newChannel, setChannelListener, setChannelListener, supportsDuplex, toString0クラスから継承されたメソッド org.piax.gtrans.impl.TransportImpl
checkActive, 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, toStringクラスから継承されたメソッド java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitインタフェースから継承されたメソッド org.piax.gtrans.Transport
close, getBaseTransport, getListener, getListener, getLowerTransport, getLowerTransports, getMTU, getPeer, getPeerId, getTransportId, getTransportIdPath, hasStableLocator, isUp, send, send, send, send, send, send, send, sendAsync, sendAsync, sendAsync, sendAsync, sendAsync, sendAsync, setListener, setListener
-
フィールド詳細
-
CH_NEW_CMD
public static final byte CH_NEW_CMD- 関連項目:
- 定数フィールド値
-
CH_NEW_ACK_CMD
public static final byte CH_NEW_ACK_CMD- 関連項目:
- 定数フィールド値
-
CH_NEW_NACK_CMD
public static final byte CH_NEW_NACK_CMD- 関連項目:
- 定数フィールド値
-
CH_CLOSE_CMD
public static final byte CH_CLOSE_CMD- 関連項目:
- 定数フィールド値
-
-
コンストラクタの詳細
-
DatagramBasedTransport
protected DatagramBasedTransport(Peer peer, TransportId transId, Transport<?> lowerTrans, boolean supportsDuplex) throws IdConflictException
-
-
メソッドの詳細
-
newChannel
public Channel<U> newChannel(ObjectId sender, ObjectId receiver, U dst, boolean isDuplex, int timeout) throws ProtocolUnsupportedException, IOException- 定義:
newChannelインタフェース内ChannelTransport<U extends Endpoint>- 定義:
newChannelクラス内ChannelTransportImpl<U extends Endpoint>- 例外:
ProtocolUnsupportedExceptionIOException
-
getClientCh
-
getAcceptCh
-
newAcceptChIfAbsent
-
closeCh
channelのclose処理を行う。 こちら側のtransportがchannelのcloseを指示した場合は、isDirectをtrueにする。 相手側のtransportがchannelのcloseを行った場合(制御メッセージが送られる)はfalseにする。- パラメータ:
isDirect- こちら側のtransportがchannelのcloseを指示した場合はtrue、 それ以外はfalseをセットする。ch- channelオブジェクト
-
lowerSend
protected abstract void lowerSend(U dst, NestedMessage nmsg) throws ProtocolUnsupportedException, IOExceptionサブクラスで下位層の送信処理を実装するために用いるメソッド。- パラメータ:
dst- 送信先nmsg- NestedMessage- 例外:
ProtocolUnsupportedException- プロトコルミスマッチ等の例外が出た場合IOException- I/O関係の例外が出た場合
-
_send
protected void _send(ObjectId sender, ObjectId receiver, int channelNo, U dst, Object msg, TransOptions opts) throws ProtocolUnsupportedException, IOException -
send
public void send(ObjectId sender, ObjectId receiver, U dst, Object msg, TransOptions opts) throws ProtocolUnsupportedException, IOException- 定義:
sendインタフェース内Transport<U extends Endpoint>- 定義:
sendクラス内TransportImpl<U extends Endpoint>- 例外:
ProtocolUnsupportedExceptionIOException
-
_preReceive
サブクラスで受信時のロジックを埋めるための用いるメソッド。- パラメータ:
rmsg- ReceivedMessage- 戻り値:
- 以降の処理に渡す NestedMessage、処理をここで止める場合はnullを返す
-
useReceiverThread
protected abstract boolean useReceiverThread(int numProc)ここでの受信処理をスレッドを使って並行化させるかどうかを判断する。 通常は、処理数が2以上の場合はスレッド化が望ましい。 下位の処理をすぐにreturnさせたい場合は、処理数が1の時でもtrueを返すよう実装する。- パラメータ:
numProc- procedureの数- 戻り値:
- スレッド化する場合true
-
raiseUpperListener
-
_onReceive
-
onReceive
- 定義:
onReceiveインタフェース内TransportListener<U extends Endpoint>
-
onAccepting
- 定義:
onAcceptingインタフェース内ChannelListener<U extends Endpoint>
-
onClosed
- 定義:
onClosedインタフェース内ChannelListener<U extends Endpoint>
-
onFailure
- 定義:
onFailureインタフェース内ChannelListener<U extends Endpoint>
-
onReceive
- 定義:
onReceiveインタフェース内ChannelListener<U extends Endpoint>
-