package org.glassfish.grizzly;
import org.glassfish.grizzly.asyncqueue.MessageCloner;
import org.glassfish.grizzly.asyncqueue.WritableMessage;
import org.glassfish.grizzly.impl.FutureImpl;
import org.glassfish.grizzly.utils.Futures;
@SuppressWarnings("deprecation")
public abstract class AbstractWriter<L> implements Writer<L> {
@Override
public final GrizzlyFuture<WriteResult<WritableMessage, L>> write(
final Connection<L> connection,
final WritableMessage message) {
return write(connection, null, message);
}
@Override
@SuppressWarnings("unchecked")
public final void write(
final Connection<L> connection,
final WritableMessage message,
final CompletionHandler<WriteResult<WritableMessage, L>> completionHandler) {
write(connection, null, message, completionHandler, (MessageCloner) null);
}
@Override
@SuppressWarnings("unchecked")
public final GrizzlyFuture<WriteResult<WritableMessage, L>> write(
final Connection<L> connection,
final L dstAddress, final WritableMessage message) {
final FutureImpl<WriteResult<WritableMessage, L>> future =
Futures.createSafeFuture();
write(connection, dstAddress, message,
Futures.toCompletionHandler(future), (MessageCloner) null);
return future;
}
@Override
@SuppressWarnings("unchecked")
public final void write(
final Connection<L> connection,
final L dstAddress, final WritableMessage message,
final CompletionHandler<WriteResult<WritableMessage, L>> completionHandler) {
write(connection, dstAddress, message, completionHandler, (MessageCloner) null);
}
}