public abstract class Connection extends PAPConnection.Abstract implements ServiceThread.Target
PAPConnection.Abstract
Modifier | Constructor and Description |
---|---|
protected |
Connection(LocalEndPoint localEndPoint,
RemoteEndPoint remoteEndPoint)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates.
|
void |
doClose()
Does close.
|
protected abstract void |
doReceive(ByteBuffer buffer)
Do receives.
|
protected abstract void |
doSend(ByteBuffer buffer)
Do sends.
|
Optional<Exception> |
getException()
Gets the exception.
|
LocalEndPoint |
getLocalEndPoint()
Gets the local end point.
|
RemoteEndPoint |
getRemoteEndPoint()
Gets the remote end point.
|
boolean |
isOnMaster()
Asks if the local end point is on a master.
|
boolean |
isOnOutstation()
Asks if the local end point is on an outstation
|
void |
receive(ByteBuffer buffer)
Receives.
|
void |
run() |
void |
send(ByteBuffer buffer)
Sends.
|
close, getName, getThisLogger, isClosed
protected Connection(@Nonnull LocalEndPoint localEndPoint, @Nonnull RemoteEndPoint remoteEndPoint)
localEndPoint
- The local end point.remoteEndPoint
- The remote end point.public void activate()
public void doClose() throws IOException
doClose
in class PAPConnection.Abstract
IOException
- To be logged.@Nonnull @CheckReturnValue public Optional<Exception> getException()
@Nonnull @CheckReturnValue public LocalEndPoint getLocalEndPoint()
@Nonnull @CheckReturnValue public RemoteEndPoint getRemoteEndPoint()
@CheckReturnValue public boolean isOnMaster()
@CheckReturnValue public boolean isOnOutstation()
public final void receive(@Nonnull ByteBuffer buffer) throws IOException
buffer
- A buffer to receive data.IOException
- On I/O exception.public void run() throws Exception
run
in interface ServiceThread.Target
Exception
public final void send(@Nonnull ByteBuffer buffer) throws IOException
buffer
- A buffer containing the data.IOException
- On I/O exception.protected abstract void doReceive(@Nonnull ByteBuffer buffer) throws IOException
buffer
- A buffer to receive data.IOException
- On I/O exception.protected abstract void doSend(@Nonnull ByteBuffer buffer) throws IOException
buffer
- A buffer containing the data.IOException
- On I/O exception.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.