public static class ProxyConnectionFactory.ProxyEndPoint extends AttributesMap implements EndPoint
Attributes.Wrapper
Dumpable.DumpableContainer
Constructor and Description |
---|
ProxyEndPoint(EndPoint endp,
java.net.InetSocketAddress remote,
java.net.InetSocketAddress local) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close any backing stream associated with the endpoint
|
int |
fill(java.nio.ByteBuffer buffer)
Fill the passed buffer with data from this endpoint.
|
void |
fillInterested(Callback callback)
Requests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer) would return data or EOF. |
boolean |
flush(java.nio.ByteBuffer... buffer)
Flush data from the passed header/buffer to this endpoint.
|
Connection |
getConnection() |
long |
getCreatedTimeStamp() |
long |
getIdleTimeout()
Get the max idle time in ms.
|
java.net.InetSocketAddress |
getLocalAddress() |
java.net.InetSocketAddress |
getRemoteAddress() |
java.lang.Object |
getTransport() |
boolean |
isFillInterested() |
boolean |
isInputShutdown()
Test if the input is shutdown.
|
boolean |
isOpen() |
boolean |
isOptimizedForDirectBuffers()
Is the endpoint optimized for DirectBuffer usage
|
boolean |
isOutputShutdown()
Test if output is shutdown.
|
void |
onClose()
Callback method invoked when this EndPoint is close.
|
void |
onOpen()
Callback method invoked when this EndPoint is opened.
|
void |
setConnection(Connection connection) |
void |
setIdleTimeout(long idleTimeout)
Set the idle timeout.
|
void |
shutdownOutput()
Shutdown the output.
|
java.lang.String |
toString() |
boolean |
tryFillInterested(Callback callback)
Requests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer) would return data or EOF. |
EndPoint |
unwrap() |
void |
upgrade(Connection newConnection)
Upgrades this EndPoint from the current connection to the given new connection.
|
void |
write(Callback callback,
java.nio.ByteBuffer... buffers)
Writes the given buffers via
EndPoint.flush(ByteBuffer...) and invokes callback methods when either
all the data has been flushed or an error occurs. |
addAll, clearAttributes, dump, dump, getAttribute, getAttributeEntrySet, getAttributeNames, getAttributeNamesCopy, getAttributeNameSet, removeAttribute, setAttribute, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
unwrap
dump, dumpContainer, dumpIterable, dumpMapEntries, dumpObject, dumpObjects, dumpSelf, named
public ProxyEndPoint(EndPoint endp, java.net.InetSocketAddress remote, java.net.InetSocketAddress local)
public EndPoint unwrap()
public void close()
EndPoint
public int fill(java.nio.ByteBuffer buffer) throws java.io.IOException
EndPoint
fill
in interface EndPoint
buffer
- The buffer to fill. The position and limit are modified during the fill. After the
operation, the position is unchanged and the limit is increased to reflect the new data filled.int
value indicating the number of bytes
filled or -1 if EOF is read or the input is shutdown.java.io.IOException
- if the endpoint is closed.public void fillInterested(Callback callback) throws java.nio.channels.ReadPendingException
EndPoint
Requests callback methods to be invoked when a call to EndPoint.fill(ByteBuffer)
would return data or EOF.
fillInterested
in interface EndPoint
callback
- the callback to call when an error occurs or we are readable. The callback may implement the Invocable
interface to
self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.java.nio.channels.ReadPendingException
- if another read operation is concurrent.public boolean flush(java.nio.ByteBuffer... buffer) throws java.io.IOException
EndPoint
flush
in interface EndPoint
buffer
- the buffers to flushjava.io.IOException
- If the endpoint is closed or output is shutdown.public Connection getConnection()
getConnection
in interface EndPoint
Connection
associated with this EndPointEndPoint.setConnection(Connection)
public void setConnection(Connection connection)
setConnection
in interface EndPoint
connection
- the Connection
associated with this EndPointEndPoint.getConnection()
,
EndPoint.upgrade(Connection)
public long getCreatedTimeStamp()
getCreatedTimeStamp
in interface EndPoint
public long getIdleTimeout()
EndPoint
The max idle time is the time the endpoint can be idle before extraordinary handling takes place.
getIdleTimeout
in interface EndPoint
public void setIdleTimeout(long idleTimeout)
EndPoint
setIdleTimeout
in interface EndPoint
idleTimeout
- the idle timeout in MS. Timeout <= 0 implies an infinite timeoutpublic java.net.InetSocketAddress getLocalAddress()
getLocalAddress
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public java.net.InetSocketAddress getRemoteAddress()
getRemoteAddress
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public java.lang.Object getTransport()
getTransport
in interface EndPoint
public boolean isFillInterested()
isFillInterested
in interface EndPoint
EndPoint.fillInterested(Callback)
has been called, but EndPoint.fill(ByteBuffer)
has not yet
been calledpublic boolean isInputShutdown()
EndPoint
EndPoint.fill(ByteBuffer)
. Once the input is shutdown, all calls to
EndPoint.fill(ByteBuffer)
will return -1, until such time as the
end point is close, when they will return EofException
.isInputShutdown
in interface EndPoint
public boolean isOpen()
public boolean isOptimizedForDirectBuffers()
EndPoint
isOptimizedForDirectBuffers
in interface EndPoint
public boolean isOutputShutdown()
EndPoint
EndPoint.shutdownOutput()
or EndPoint.close()
.isOutputShutdown
in interface EndPoint
public void onClose()
EndPoint
Callback method invoked when this EndPoint is close.
onClose
in interface EndPoint
EndPoint.onOpen()
public void onOpen()
EndPoint
Callback method invoked when this EndPoint is opened.
onOpen
in interface EndPoint
EndPoint.onClose()
public void shutdownOutput()
EndPoint
This call indicates that no more data will be sent on this endpoint that that the remote end should read an EOF once all previously sent data has been consumed. Shutdown may be done either at the TCP/IP level, as a protocol exchange (Eg TLS close handshake) or both.
If the endpoint has EndPoint.isInputShutdown()
true, then this call has the same effect
as EndPoint.close()
.
shutdownOutput
in interface EndPoint
public java.lang.String toString()
toString
in class AttributesMap
public boolean tryFillInterested(Callback callback)
EndPoint
Requests callback methods to be invoked when a call to EndPoint.fill(ByteBuffer)
would return data or EOF.
tryFillInterested
in interface EndPoint
callback
- the callback to call when an error occurs or we are readable. The callback may implement the Invocable
interface to
self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.public void upgrade(Connection newConnection)
EndPoint
Upgrades this EndPoint from the current connection to the given new connection.
Closes the current connection, links this EndPoint to the new connection and then opens the new connection.
If the current connection is an instance of Connection.UpgradeFrom
then
a buffer of unconsumed bytes is requested.
If the buffer of unconsumed bytes is non-null and non-empty, then the new
connection is tested: if it is an instance of Connection.UpgradeTo
, then
the unconsumed buffer is passed to the new connection; otherwise, an exception
is thrown since there are unconsumed bytes that cannot be consumed by the new
connection.
public void write(Callback callback, java.nio.ByteBuffer... buffers) throws java.nio.channels.WritePendingException
EndPoint
Writes the given buffers via EndPoint.flush(ByteBuffer...)
and invokes callback methods when either
all the data has been flushed or an error occurs.
write
in interface EndPoint
callback
- the callback to call when an error occurs or the write completed. The callback may implement the Invocable
interface to
self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.buffers
- one or more ByteBuffer
s that will be flushed.java.nio.channels.WritePendingException
- if another write operation is concurrent.Copyright © 1995–2021 Webtide. All rights reserved.