クラス AbstractConnectionFactory
java.lang.ObjectSE
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
- 実装されているすべてのインターフェース:
Aware
、BeanFactoryAware
、BeanNameAware
、InitializingBean
、ApplicationContextAware
、ApplicationEventPublisherAware
、Lifecycle
、ComponentSourceAware
、ExpressionCapable
、ConnectionFactory
、NamedComponent
、ManageableLifecycle
public abstract class AbstractConnectionFactory
extends IntegrationObjectSupport
implements ConnectionFactory, ApplicationEventPublisherAware
すべての接続ファクトリの基本クラス。
- 導入:
- 2.0
- 作成者:
- Gary Russell, Artem Bilan, Christian Tzolov, Ngoc Nhan
フィールドのサマリー
フィールド修飾子と型フィールド説明protected final MapSE
<StringSE, TcpConnectionSupport> protected final LockSE
protected static final int
protected final LockSE
クラス org.springframework.integration.context.IntegrationObjectSupport から継承されたフィールド
EXPRESSION_PARSER, logger
コンストラクターの概要
コンストラクターメソッドのサマリー
修飾子と型メソッド説明protected void
addConnection
(TcpConnectionSupport connection) protected void
boolean
closeConnection
(StringSE connectionId) 指定された接続 ID の接続を閉じます。protected void
delayRead
(SelectorSE selector, long now, SelectionKeySE key) protected void
doAccept
(SelectorSE selector, ServerSocketChannelSE server, long now) protected BlockingQueueSE
<org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory.PendingIO> Deserializer
<?> getHost()
protected ObjectSE
(現在)開いているTcpConnection
接続 ID のリストを返します。たとえば、開いているすべての接続へのブロードキャスト操作を許可します。int
getPort()
protected long
送信者のリストを返します。Serializer
<?> int
int
int
int
int
protected IntegerSE
protected ExecutorSE
taskExecutor を作成します (提供されていない場合)。protected TcpSocketSupport
protected void
閉じられた接続を削除して this.connections をクリーンアップします。protected boolean
isActive()
boolean
boolean
boolean
boolean
boolean
protected void
onInit()
サブクラスは、初期化ロジック用にこれを実装できます。protected void
processNioSelections
(int selectionCount, SelectorSE selector, ServerSocketChannelSE server, MapSE<SocketChannelSE, TcpNioConnection> connectionMap) 期限切れの接続をタイムアウトし、selectionCount > 0
の場合は、選択された鍵を処理します。void
registerListener
(TcpListener listenerToRegister) ペイロードが入力データから変換された後、メッセージを受信するために TcpListener を登録します。void
registerSender
(TcpSender senderToRegister) TcpSender を登録します。サーバーソケットの場合、接続情報を提供するために使用されるため、送信者は受信メッセージに返信するために使用できます。protected void
setActive
(boolean active) void
setApplicationEventPublisher
(ApplicationEventPublisher applicationEventPublisher) void
setDeserializer
(Deserializer<?> deserializer) void
ホストを設定します。ファクトリを停止する必要があります。void
setInterceptorFactoryChain
(TcpConnectionInterceptorFactoryChain interceptorFactoryChain) void
setLeaveOpen
(boolean leaveOpen) true の場合、このファクトリによって作成されたソケットが再利用されます。void
setLookupHost
(boolean lookupHost) true の場合、リモート IP アドレスで DNS 逆ルックアップが行われます。void
setMapper
(TcpMessageMapper mapper) void
setNioHarvestInterval
(int nioHarvestInterval) soTimeout が 0 の場合に閉じられた NIO 接続をクリーンアップする頻度。void
setPort
(int port) ポートを設定します。ファクトリを停止する必要があります。void
setReadDelay
(long readDelay) 前の試行がスレッド不足のために失敗した後、読み取りを再試行するまでの遅延(ミリ秒)。void
setSerializer
(Serializer<?> serializer) void
setSingleUse
(boolean singleUse) true の場合、このファクトリによって作成されたソケットが 1 回使用されます。protected void
setSocketAttributes
(SocketSE socket) ソケットのソケット属性を設定します。void
setSoKeepAlive
(boolean soKeepAlive) void
setSoLinger
(int soLinger) void
setSoReceiveBufferSize
(int soReceiveBufferSize) void
setSoSendBufferSize
(int soSendBufferSize) void
setSoTcpNoDelay
(boolean soTcpNoDelay) void
setSoTimeout
(int soTimeout) void
setSoTrafficClass
(int soTrafficClass) void
setSslHandshakeTimeout
(int sslHandshakeTimeout) SSL ハンドシェイクデータを待機するときに使用されるハンドシェイクタイムアウトを設定します。NIO を使用する場合、SSL 接続にのみ適用されます。void
setTaskExecutor
(ExecutorSE taskExecutor) void
setTcpSocketSupport
(TcpSocketSupport tcpSocketSupport) void
start()
void
stop()
サーバーの停止。toString()
boolean
unregisterSender
(TcpSender sender) TcpSender の登録を解除します。protected TcpConnectionSupport
wrapConnection
(TcpConnectionSupport connectionArg) クラス org.springframework.integration.context.IntegrationObjectSupport から継承されたメソッド
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getComponentType, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler
クラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, wait, waitSE, waitSE
インターフェース org.springframework.integration.ip.tcp.connection.ConnectionFactory から継承されたメソッド
getConnection
フィールドの詳細
DEFAULT_REPLY_TIMEOUT
protected static final int DEFAULT_REPLY_TIMEOUT- 関連事項:
lifecycleMonitor
connections
connectionsMonitor
コンストラクターの詳細
AbstractConnectionFactory
public AbstractConnectionFactory(int port) AbstractConnectionFactory
メソッドの詳細
setApplicationEventPublisher
- 次で指定:
- インターフェース
ApplicationEventPublisherAware
のsetApplicationEventPublisher
getApplicationEventPublisher
setSocketAttributes
ソケットのソケット属性を設定します。- パラメーター:
socket
- ソケット。- 例外:
SocketExceptionSE
- SocketException。
getSoTimeout
public int getSoTimeout()- 戻り値:
- soTimeout
setSoTimeout
public void setSoTimeout(int soTimeout) - パラメーター:
soTimeout
- 設定する soTimeout(ミリ秒単位)
getSoReceiveBufferSize
public int getSoReceiveBufferSize()- 戻り値:
- soReceiveBufferSize
setSoReceiveBufferSize
public void setSoReceiveBufferSize(int soReceiveBufferSize) - パラメーター:
soReceiveBufferSize
- 設定する soReceiveBufferSize
getSoSendBufferSize
public int getSoSendBufferSize()- 戻り値:
- soSendBufferSize
setSoSendBufferSize
public void setSoSendBufferSize(int soSendBufferSize) - パラメーター:
soSendBufferSize
- 設定する soSendBufferSize
isSoTcpNoDelay
public boolean isSoTcpNoDelay()- 戻り値:
- soTcpNoDelay
setSoTcpNoDelay
public void setSoTcpNoDelay(boolean soTcpNoDelay) - パラメーター:
soTcpNoDelay
- 設定する soTcpNoDelay
getSoLinger
public int getSoLinger()- 戻り値:
- soLinger
setSoLinger
public void setSoLinger(int soLinger) - パラメーター:
soLinger
- 設定する soLinger
isSoKeepAlive
public boolean isSoKeepAlive()- 戻り値:
- soKeepAlive
setSoKeepAlive
public void setSoKeepAlive(boolean soKeepAlive) - パラメーター:
soKeepAlive
- 設定する soKeepAlive
getSoTrafficClass
public int getSoTrafficClass()- 戻り値:
- soTrafficClass
setSoTrafficClass
public void setSoTrafficClass(int soTrafficClass) - パラメーター:
soTrafficClass
- 設定する soTrafficClass
setHost
getHost
- 戻り値:
- ザホスト
setPort
public void setPort(int port) ポートを設定します。ファクトリを停止する必要があります。- パラメーター:
port
- ポート。- 導入:
- 5.0
getPort
public int getPort()- 戻り値:
- 港
getListener
- 戻り値:
- リスナー
getSender
getSenders
getSerializer
- 戻り値:
- シリアライザー
getDeserializer
- 戻り値:
- デシリアライザー
getMapper
- 戻り値:
- マッパー
registerListener
ペイロードが入力データから変換された後、メッセージを受信するために TcpListener を登録します。- パラメーター:
listenerToRegister
- TcpListener。
registerSender
TcpSender を登録します。サーバーソケットの場合、接続情報を提供するために使用されるため、送信者は受信メッセージに返信するために使用できます。- パラメーター:
senderToRegister
- 送り主
unregisterSender
TcpSender の登録を解除します。- パラメーター:
sender
- 送り主。- 戻り値:
- 送信者が登録されている場合は true。
setTaskExecutor
- パラメーター:
taskExecutor
- 設定する taskExecutor
setDeserializer
- パラメーター:
deserializer
- 設定するデシリアライザー
setSerializer
- パラメーター:
serializer
- 設定するシリアライザー
setMapper
- パラメーター:
mapper
- 設定するマッパー。デフォルトはTcpMessageMapper
です
isSingleUse
public boolean isSingleUse()- 戻り値:
- singleUse
setSingleUse
public void setSingleUse(boolean singleUse) true の場合、このファクトリによって作成されたソケットが 1 回使用されます。- パラメーター:
singleUse
- 設定する singleUse。
setLeaveOpen
public void setLeaveOpen(boolean leaveOpen) true の場合、このファクトリによって作成されたソケットが再利用されます。setSingleUse(boolean)
の逆。- パラメーター:
leaveOpen
- 設定する keepOpen。- 導入:
- 5.0
setInterceptorFactoryChain
public void setInterceptorFactoryChain(TcpConnectionInterceptorFactoryChain interceptorFactoryChain) setLookupHost
public void setLookupHost(boolean lookupHost) true の場合、リモート IP アドレスで DNS 逆引き参照が行われます。デフォルト false: すべての環境 (例: Docker コンテナー) が信頼できる DNS 解決を実行するわけではありません。- パラメーター:
lookupHost
- 設定する lookupHost
isLookupHost
public boolean isLookupHost()- 戻り値:
- lookupHost
setNioHarvestInterval
public void setNioHarvestInterval(int nioHarvestInterval) soTimeout が 0 の場合、閉じられた NIO 接続をクリーンアップする頻度。クリーンアッププロセスはタイムアウト処理の一部として実行されるため、soTimeout > 0
の場合は無視されます。デフォルトは 2000 ミリ秒です。- パラメーター:
nioHarvestInterval
- ミリ秒単位の間隔。
setSslHandshakeTimeout
public void setSslHandshakeTimeout(int sslHandshakeTimeout) SSL ハンドシェイクデータを待機するときに使用されるハンドシェイクタイムアウトを設定します。NIO を使用する場合、SSL 接続にのみ適用されます。- パラメーター:
sslHandshakeTimeout
- タイムアウト。- 導入:
- 4.3.6
getSslHandshakeTimeout
getDelayedReads
protected BlockingQueueSE<org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory.PendingIO> getDelayedReads()getReadDelay
protected long getReadDelay()setReadDelay
public void setReadDelay(long readDelay) スレッドが不十分なために前回の試行が失敗した後、読み取りを再試行するまでの遅延(ミリ秒単位)。デフォルトは 100。- パラメーター:
readDelay
- readDelay を設定します。
getLifecycleMonitor
onInit
protected void onInit()クラスからコピーされた説明:IntegrationObjectSupport
サブクラスは、初期化ロジック用にこれを実装できます。- オーバーライド:
- クラス
IntegrationObjectSupport
のonInit
start
public void start()- 次で指定:
- インターフェース
Lifecycle
のstart
- 次で指定:
- インターフェース
ManageableLifecycle
のstart
getTaskExecutor
stop
public void stop()サーバーの停止。- 次で指定:
- インターフェース
Lifecycle
のstop
- 次で指定:
- インターフェース
ManageableLifecycle
のstop
wrapConnection
processNioSelections
protected void processNioSelections(int selectionCount, SelectorSE selector, @Nullable ServerSocketChannelSE server, MapSE<SocketChannelSE, TcpNioConnection> connectionMap) 期限切れの接続をタイムアウトし、selectionCount > 0
の場合は、選択された鍵を処理します。connections フィールドおよび connections パラメーターから閉じた接続を削除します。- パラメーター:
selectionCount
- IO イベントの数。0 の場合、おそらくクローズによって起こされました。selector
- セレクタ。server
- サーバーソケットチャネル。connectionMap
- 接続のマップ。
delayRead
doAccept
- パラメーター:
selector
- セレクタ。server
- サーバーソケットチャネル。now
- 現在の時刻。
addConnection
harvestClosedConnections
protected void harvestClosedConnections()閉じられた接続を削除して this.connections をクリーンアップします。isRunning
public boolean isRunning()- 次で指定:
- インターフェース
Lifecycle
のisRunning
- 次で指定:
- インターフェース
ManageableLifecycle
のisRunning
isActive
protected boolean isActive()- 戻り値:
- アクティブ
setActive
protected void setActive(boolean active) - パラメーター:
active
- 設定するアクティブ
checkActive
protected void checkActive()getTcpSocketSupport
setTcpSocketSupport
getOpenConnectionIds
(現在)開いているTcpConnection
接続 ID のリストを返します。たとえば、開いているすべての接続へのブロードキャスト操作を許可します。- 戻り値:
- 接続 ID のリスト。
closeConnection
指定された接続 ID の接続を閉じます。- パラメーター:
connectionId
- 接続 ID。- 戻り値:
- 接続が閉じられた場合は true。
toString
- オーバーライド:
- クラス
IntegrationObjectSupport
のtoString