Top Description Fields Constructors Methods
org.glassfish.grizzly

public Class WriteResult<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.RecordWriteResult
Type Parameters
<K>
type of the message
<L>
type of the address
Imports
org.glassfish.grizzly.utils.Holder

Result of write operation, returned by Writeable.
Author
Alexey Stashok

Field Summary

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

Connection, from which data were read.

private Holder<L>
dstAddressHolder

Destination address.

private boolean
private K
message

message data

private long
writtenSize

Number of bytes written.

Constructor Summary

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

private
WriteResult(Connection<L> connection, K message, L dstAddress, long writeSize)

Method Summary

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

public static <K, L> WriteResult<K, L>
create(final Connection<L> connection, final K message, final L dstAddress, final long writeSize)

protected Holder<L>
createAddrHolder(final L dstAddress)

Create an address holder.

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 L

Returns:

the destination address, the message was written to.
getDstAddress
()

Get the destination address, the message was written to.

public final Holder<L>

Returns:

the destination address, the message was written to.
getDstAddressHolder
()

Get the destination address, the message was written to.

public final K

Returns:

the message, which was read.
getMessage
()

Get the message, which was read.

public final long

Returns:

the number of bytes, which were written.
getWrittenSize
()

Get the number of bytes, which were written.

public void
protected void
protected void
set(final Connection<L> connection, final K message, final L dstAddress, final long writtenSize)

One method to set all the WriteResult properties.

public final void
setDstAddress(final L
the destination address, the message was written to.
dstAddress
)

Set the destination address, the message was written to.

public final void
setDstAddressHolder(final Holder<L>
the destination address, the message was written to.
dstAddressHolder
)

Set the destination address, the message was written to.

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

Set the message, which was read.

public final void
setWrittenSize(long
the number of bytes, which were written.
writeSize
)

Set the number of bytes, which were written.

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

Field Detail

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

Connection, from which data were read.

dstAddressHolderback to summary
private Holder<L> dstAddressHolder

Destination address.

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

message data

writtenSizeback to summary
private long writtenSize

Number of bytes written.

Constructor Detail

WriteResultback to summary
protected WriteResult()
WriteResultback to summary
private WriteResult(final Connection<L> connection)
WriteResultback to summary
private WriteResult(Connection<L> connection, K message, L dstAddress, long writeSize)

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> WriteResult<K, L> create(Connection<L> connection)
createback to summary
public static <K, L> WriteResult<K, L> create(final Connection<L> connection, final K message, final L dstAddress, final long writeSize)
createAddrHolderback to summary
protected Holder<L> createAddrHolder(final L dstAddress)

Create an address holder.

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
getDstAddressback to summary
public final L getDstAddress()

Get the destination address, the message was written to.

Returns:L

the destination address, the message was written to.

getDstAddressHolderback to summary
public final Holder<L> getDstAddressHolder()

Get the destination address, the message was written to.

Returns:Holder<L>

the destination address, the message was written to.

getMessageback to summary
public final K getMessage()

Get the message, which was read.

Returns:K

the message, which was read.

getWrittenSizeback to summary
public final long getWrittenSize()

Get the number of bytes, which were written.

Returns:long

the number of bytes, which were written.

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 dstAddress, final long writtenSize)

One method to set all the WriteResult properties.

setDstAddressback to summary
public final void setDstAddress(final L dstAddress)

Set the destination address, the message was written to.

Parameters
dstAddress:L

the destination address, the message was written to.

setDstAddressHolderback to summary
public final void setDstAddressHolder(final Holder<L> dstAddressHolder)

Set the destination address, the message was written to.

Parameters
dstAddressHolder:Holder<L>

the destination address, the message was written to.

setMessageback to summary
public final void setMessage(K message)

Set the message, which was read.

Parameters
message:K

the message, which was read.

setWrittenSizeback to summary
public final void setWrittenSize(long writeSize)

Set the number of bytes, which were written.

Parameters
writeSize:long

the number of bytes, which were written.

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