Class NettyPlcConnection
java.lang.Object
org.apache.plc4x.java.base.connection.AbstractPlcConnection
org.apache.plc4x.java.base.connection.NettyPlcConnection
- All Implemented Interfaces:
AutoCloseable,PlcConnectionMetadata,PlcConnection
public abstract class NettyPlcConnection extends AbstractPlcConnection
-
Field Summary
Fields Modifier and Type Field Description protected booleanawaitSessionSetupCompleteprotected io.netty.channel.Channelchannelprotected ChannelFactorychannelFactoryprotected booleanconnectedprotected static io.netty.util.TimertimeraHashedWheelTimershall be only instantiated once. -
Constructor Summary
Constructors Modifier Constructor Description protectedNettyPlcConnection(ChannelFactory channelFactory)protectedNettyPlcConnection(ChannelFactory channelFactory, boolean awaitSessionSetupComplete) -
Method Summary
Modifier and Type Method Description voidclose()voidconnect()io.netty.channel.ChannelgetChannel()protected abstract io.netty.channel.ChannelHandlergetChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture)booleanisConnected()Check if the communication channel is active (channel.isActive()) and the driver for a given protocol has finished establishing the connection.CompletableFuture<Void>ping()protected voidsendChannelCreatedEvent()Methods inherited from class org.apache.plc4x.java.base.connection.AbstractPlcConnection
canRead, canSubscribe, canWrite, checkInternal, getMetadata, readRequestBuilder, subscriptionRequestBuilder, unsubscriptionRequestBuilder, writeRequestBuilder
-
Field Details
-
timer
protected static final io.netty.util.Timer timeraHashedWheelTimershall be only instantiated once. -
channelFactory
-
awaitSessionSetupComplete
protected final boolean awaitSessionSetupComplete -
channel
protected io.netty.channel.Channel channel -
connected
protected boolean connected
-
-
Constructor Details
-
Method Details
-
connect
- Throws:
PlcConnectionException
-
ping
- Specified by:
pingin interfacePlcConnection- Overrides:
pingin classAbstractPlcConnection
-
close
- Throws:
PlcConnectionException
-
isConnected
public boolean isConnected()Check if the communication channel is active (channel.isActive()) and the driver for a given protocol has finished establishing the connection. -
getChannel
public io.netty.channel.Channel getChannel() -
getChannelHandler
protected abstract io.netty.channel.ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture) -
sendChannelCreatedEvent
protected void sendChannelCreatedEvent()
-