From dbaafdd04e026b566d93471e34f00dbe38c09df9 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 28 Oct 2016 15:11:03 +0200 Subject: [PATCH] MessageChannel declares send(Message) as default method Issue: SPR-14854 --- .../org/springframework/messaging/MessageChannel.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/MessageChannel.java b/spring-messaging/src/main/java/org/springframework/messaging/MessageChannel.java index f64ff0bf49..9069468b11 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/MessageChannel.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/MessageChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,12 +22,13 @@ package org.springframework.messaging; * @author Mark Fisher * @since 4.0 */ +@FunctionalInterface public interface MessageChannel { /** * Constant for sending a message without a prescribed timeout. */ - public static final long INDEFINITE_TIMEOUT = -1; + long INDEFINITE_TIMEOUT = -1; /** @@ -40,7 +41,9 @@ public interface MessageChannel { * @param message the message to send * @return whether or not the message was sent */ - boolean send(Message message); + default boolean send(Message message) { + return send(message, INDEFINITE_TIMEOUT); + } /** * Send a message, blocking until either the message is accepted or the