Top Description Fields Constructors Methods
org.glassfish.grizzly

public Class ReadResult<K, L>

extends Object
implements Result, Cacheable
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.Cacheable, org.glassfish.grizzly.Result, org.glassfish.grizzly.Copyable
Known Direct Subclasses
org.glassfish.grizzly.asyncqueue.RecordReadResult
Type Parameters
<K>
type of the message
<L>
type of the address
Imports
org.glassfish.grizzly.utils.Holder

Result of read operation, returned by Readable.
Author
Alexey Stashok

Field Summary

Modifier and TypeField and Description
private static final ThreadCache.CachedTypeIndex<ReadResult<K, L>>
private Connection<L>
connection

Connection, from which data were read.

private boolean
private K
message

message data

private int
readSize

Number of bytes read.

private Holder<L>
srcAddressHolder

Source address.

Constructor Summary

AccessConstructor and Description
protected
protected
ReadResult(final Connection<L> connection)

protected
ReadResult(final Connection<L> connection, final K message, final L srcAddress, final int readSize)

Method Summary

Modifier and TypeMethod and Description
private void
public Object
public static <K, L> ReadResult<K, L>
create(Connection<L> connection)

public static <K, L> ReadResult<K, L>
create(Connection<L> connection, K message, L srcAddress, int readSize)

public final Connection<L>

Returns:

the Connection data were read from.
getConnection
()

Implements org.glassfish.grizzly.Result.getConnection.

Get the Connection data were read from.

public final K

Returns:

the message, which was read.
getMessage
()

Get the message, which was read.

public final int

Returns:

the number of bytes, which were read.
getReadSize
()

Get the number of bytes, which were read.

public final L

Returns:

the source address, the message was read from.
getSrcAddress
()

Get the source address, the message was read from.

public final Holder<L>

Returns:

the source address, the message was read from.
getSrcAddressHolder
()

Get the source address, the message was read from.

public void
protected void
protected void
set(final Connection<L>
the connection the data was read from
connection
,
final K
the message which was read
message
,
final L
the source address the message was read from
srcAddress
,
final int
number of bytes which were read
readSize
)

One method to set all the WriteResult properties.

public final void
setMessage(K
the message, which was read.
message
)

Set the message, which was read.

public final void
setReadSize(int
the number of bytes, which were read.
readSize
)

Set the number of bytes, which were read.

public final void
setSrcAddress(L
the source address, the message was read from.
srcAddress
)

Set the source address, the message was read from.

public final void
setSrcAddressHolder(Holder<L>
the source address, the message was read from.
srcAddressHolder
)

Set the source address, the message was read from.

private static <K, L> ReadResult<K, L>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CACHE_IDXback to summary
private static final ThreadCache.CachedTypeIndex<ReadResult<K, L>> CACHE_IDX
connectionback to summary
private Connection<L> connection

Connection, from which data were read.

isRecycledback to summary
private boolean isRecycled
messageback to summary
private K message

message data

readSizeback to summary
private int readSize

Number of bytes read.

srcAddressHolderback to summary
private Holder<L> srcAddressHolder

Source address.

Constructor Detail

ReadResultback to summary
protected ReadResult()
ReadResultback to summary
protected ReadResult(final Connection<L> connection)
ReadResultback to summary
protected ReadResult(final Connection<L> connection, final K message, final L srcAddress, final int readSize)

Method Detail

checkRecycledback to summary
private void checkRecycled()
copyback to summary
public Object copy()

Implements org.glassfish.grizzly.Copyable.copy.

Annotations
@Override
createback to summary
public static <K, L> ReadResult<K, L> create(Connection<L> connection)
createback to summary
public static <K, L> ReadResult<K, L> create(Connection<L> connection, K message, L srcAddress, int readSize)
getConnectionback to summary
public final Connection<L> getConnection()

Implements org.glassfish.grizzly.Result.getConnection.

Get the Connection data were read from.

Returns:Connection<L>

the Connection data were read from.

Annotations
@Override
getMessageback to summary
public final K getMessage()

Get the message, which was read.

Returns:K

the message, which was read.

getReadSizeback to summary
public final int getReadSize()

Get the number of bytes, which were read.

Returns:int

the number of bytes, which were read.

getSrcAddressback to summary
public final L getSrcAddress()

Get the source address, the message was read from.

Returns:L

the source address, the message was read from.

getSrcAddressHolderback to summary
public final Holder<L> getSrcAddressHolder()

Get the source address, the message was read from.

Returns:Holder<L>

the source address, the message was read from.

recycleback to summary
public void recycle()

Implements org.glassfish.grizzly.Cacheable.recycle.

Annotations
@Override
resetback to summary
protected void reset()
setback to summary
protected void set(final Connection<L> connection, final K message, final L srcAddress, final int readSize)

One method to set all the WriteResult properties.

Parameters
connection:Connection<L>

the connection the data was read from

message:K

the message which was read

srcAddress:L

the source address the message was read from

readSize:int

number of bytes which were read

setMessageback to summary
public final void setMessage(K message)

Set the message, which was read.

Parameters
message:K

the message, which was read.

setReadSizeback to summary
public final void setReadSize(int readSize)

Set the number of bytes, which were read.

Parameters
readSize:int

the number of bytes, which were read.

setSrcAddressback to summary
public final void setSrcAddress(L srcAddress)

Set the source address, the message was read from.

Parameters
srcAddress:L

the source address, the message was read from.

setSrcAddressHolderback to summary
public final void setSrcAddressHolder(Holder<L> srcAddressHolder)

Set the source address, the message was read from.

Parameters
srcAddressHolder:Holder<L>

the source address, the message was read from.

takeFromCacheback to summary
private static <K, L> ReadResult<K, L> takeFromCache()
Annotations
@SuppressWarnings:unchecked