Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,15 @@
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.core.RefCounted;

public abstract class TransportMessage implements Writeable, RefCounted {

/**
* Constructs a new empty transport message
*/
public TransportMessage() {}
public interface TransportMessage extends Writeable, RefCounted {

@Override
public void incRef() {
default void incRef() {
// noop, override to manage the life-cycle of resources held by a transport message
}

@Override
public boolean tryIncRef() {
default boolean tryIncRef() {
// noop, override to manage the life-cycle of resources held by a transport message
return true;
}
Expand All @@ -38,13 +33,13 @@ public boolean tryIncRef() {
* layer in a manner that might end up nesting too deeply. When in doubt, dispatch any further work onto a separate thread.
*/
@Override
public boolean decRef() {
default boolean decRef() {
// noop, override to manage the life-cycle of resources held by a transport message
return false;
}

@Override
public boolean hasReferences() {
default boolean hasReferences() {
// noop, override to manage the life-cycle of resources held by a transport message
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.io.IOException;
import java.net.InetSocketAddress;

public abstract class TransportRequest extends TransportMessage implements TaskAwareRequest {
public abstract class TransportRequest implements TransportMessage, TaskAwareRequest {

@Nullable // set by the transport service on inbound messages; unset on outbound messages
private InetSocketAddress remoteAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import java.io.IOException;

public abstract class TransportResponse extends TransportMessage {
public abstract class TransportResponse implements TransportMessage {

/**
* Constructs a new empty transport response
Expand Down