Return-Path: X-Original-To: apmail-logging-log4j-dev-archive@www.apache.org Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4876518CF4 for ; Sun, 21 Feb 2016 07:39:04 +0000 (UTC) Received: (qmail 22605 invoked by uid 500); 21 Feb 2016 07:39:04 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 22558 invoked by uid 500); 21 Feb 2016 07:39:04 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 22548 invoked by uid 99); 21 Feb 2016 07:39:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Feb 2016 07:39:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id ACE90C36C8 for ; Sun, 21 Feb 2016 07:39:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id pc7JkJsLR_OS for ; Sun, 21 Feb 2016 07:39:02 +0000 (UTC) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 1FCB45FB0F for ; Sun, 21 Feb 2016 07:39:01 +0000 (UTC) Received: by mail-ob0-f178.google.com with SMTP id gc3so140642980obb.3 for ; Sat, 20 Feb 2016 23:39:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=R8gZBRkHVGAuip6pKqT9m84gI2wQCZFLmHWB5jSXFLI=; b=sJ39d1hu5mvrI7pUeYHGFQ+n4fzILCk3mJQZGX+nkUYxKRd4GHUodmp6rNUVSIrWyt 2Cb/q78xXMdnW57GwtZ/6Hg0UHcT4dVpWC/331QFED78zT4cS7DeoJzFTA0pmPCq2lXt JehQ8J/AGmlbDECz6abX4M4Pf5QcAFAyFwnH36ApqwzycTVubOsPzWUijulfiPXzx/yW T8k7+icktZFq7omQCnqhFMGY0FBlBjwHM19LoNGGLfo8Te0nRh2NsBB5DET+nEep9tV8 LaQzAF04FBqcvoMFznl29gmIwCe+WEFlvQRejHGCKLpgUpJ73QIYFHlcIcMZhPnnb5Br Kb3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=R8gZBRkHVGAuip6pKqT9m84gI2wQCZFLmHWB5jSXFLI=; b=eSGFH4ugzYcZd5B0q1QsevqxpYrj1g23hqSYGNpRV39HIm/x/hGCYOsj1Dok5HCEIL PHCEqevSVqDxJscmPQKbnwW+o68KIHIXzSIwOAEaiO7RB8If6SMWnsH6vy0vGFANMZuM WPK5lacULl9gq09ALdDQdJBZnW5looXljv/3nW/p7xHqyG1hqlHuYFwYBtFZKjQ+Bs90 wpsFhWh/C5dsdzrIlIZQ7YidDQ830uH0XW0/D9qbkptjSygqnxLOQX4Q/8MJxethpthp BJwxd0uT0wbCXnjCRJwVukPdr8cFFf14TUoVj8/xnAUSWqcjrpANfISpge0Lw7CaF/WE 4PJw== X-Gm-Message-State: AG10YOQPs986BFHeJ93O4XNLctY9CqXgSr4LUv639hI/ELZH51t4t3vrHkswIzIJDG5qjC3GTIvf5aWtC0hm5w== MIME-Version: 1.0 X-Received: by 10.182.111.137 with SMTP id ii9mr18051927obb.77.1456040340044; Sat, 20 Feb 2016 23:39:00 -0800 (PST) Received: by 10.157.46.42 with HTTP; Sat, 20 Feb 2016 23:38:59 -0800 (PST) In-Reply-To: References: <9370f0a490e14b2cb84f49d414da7e42@git.apache.org> <8f98334481764b438ed96e61aac1fe6d@git.apache.org> Date: Sat, 20 Feb 2016 23:38:59 -0800 Message-ID: Subject: Re: [2/5] logging-log4j2 git commit: LOG4J2-1274 add ByteBufferDestination interface From: Gary Gregory To: Log4J Developers List Content-Type: multipart/alternative; boundary=089e015374d83f40fa052c42cf94 --089e015374d83f40fa052c42cf94 Content-Type: text/plain; charset=UTF-8 On Sat, Feb 20, 2016 at 11:27 PM, Remko Popma wrote: > I'm open to ideas for a better name, but in this case we are draining data > _from_ the specified ByteBuffer into the destination (which can be > anything). > I apologize for not reading the Javadoc, the name is fine, drainFrom() would be lame. Gary > Sent from my iPhone > > On 2016/02/21, at 15:24, Gary Gregory wrote: > > Should we consider renaming drain(ByteBuffer) to drainTo(ByteBuffer) as > there is precedent in the JRE for this naming. > See java.util.concurrent.BlockingQueue.drainTo(Collection) > > Gary > ---------- Forwarded message ---------- > From: > Date: Sat, Feb 20, 2016 at 7:36 PM > Subject: [2/5] logging-log4j2 git commit: LOG4J2-1274 add > ByteBufferDestination interface > To: commits@logging.apache.org > > > LOG4J2-1274 add ByteBufferDestination interface > > > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo > Commit: > http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8ad09137 > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8ad09137 > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8ad09137 > > Branch: refs/heads/master > Commit: 8ad0913756eeb9c285161c5d8bfaab4f638f4d1f > Parents: 5a19927 > Author: rpopma > Authored: Sun Feb 21 12:17:39 2016 +0900 > Committer: rpopma > Committed: Sun Feb 21 12:17:39 2016 +0900 > > ---------------------------------------------------------------------- > .../core/layout/ByteBufferDestination.java | 45 ++++++++++++++++++++ > 1 file changed, 45 insertions(+) > ---------------------------------------------------------------------- > > > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8ad09137/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/ByteBufferDestination.java > ---------------------------------------------------------------------- > diff --git > a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/ByteBufferDestination.java > b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/ByteBufferDestination.java > new file mode 100644 > index 0000000..61ce3ba > --- /dev/null > +++ > b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/ByteBufferDestination.java > @@ -0,0 +1,45 @@ > +/* > + * Licensed to the Apache Software Foundation (ASF) under one or more > + * contributor license agreements. See the NOTICE file distributed with > + * this work for additional information regarding copyright ownership. > + * The ASF licenses this file to You under the Apache license, Version 2.0 > + * (the "License"); you may not use this file except in compliance with > + * the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or > implied. > + * See the license for the specific language governing permissions and > + * limitations under the license. > + */ > +package org.apache.logging.log4j.core.layout; > + > +import java.nio.ByteBuffer; > + > +/** > + * ByteBufferDestination addresses the problem a producer has when the > destination ByteBuffer is not large enough to > + * fit all the data. This interface allows a producer to write arbitrary > amounts of data to a destination. > + * > + * @since 2.6 > + */ > +public interface ByteBufferDestination { > + /** > + * Returns the buffer to write to. > + * > + * @return the buffer to write to > + */ > + ByteBuffer getByteBuffer(); > + > + /** > + * Consumes the buffer content and returns a buffer with more > {@linkplain ByteBuffer#remaining() available} space > + * (which may or may not be the same instance). > + *

> + * Called by the producer when buffer becomes too full to write to. > + * > + * @param buf the buffer to drain > + * @return a buffer with more available space (which may or may not > be the same instance) > + */ > + ByteBuffer drain(ByteBuffer buf); > +} > > > > > -- > E-Mail: garydgregory@gmail.com | ggregory@apache.org > Java Persistence with Hibernate, Second Edition > > JUnit in Action, Second Edition > Spring Batch in Action > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > > -- E-Mail: garydgregory@gmail.com | ggregory@apache.org Java Persistence with Hibernate, Second Edition JUnit in Action, Second Edition Spring Batch in Action Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory --089e015374d83f40fa052c42cf94 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On S= at, Feb 20, 2016 at 11:27 PM, Remko Popma <remko.popma@gmail.com&g= t; wrote:
I= 'm open to ideas for a better name, but in this case we are draining da= ta _from_ the specified ByteBuffer into the destination (which can be anyth= ing).=C2=A0

I apologize for= not reading the Javadoc, the name is fine, drainFrom() would be lame.

Gary


Sent from my iPhone

On 2016/02/21, at 15:24, Gary Gregory <garydgregory@gmail.com> wrote:=

Should we con= sider renaming drain(ByteBuffer) to= drainTo(ByteBuffer) as there is pr= ecedent in the JRE for this naming. See=C2=A0java.util.concurrent.BlockingQ= ueue.drainTo(Collection<? super E>)

Gary
<= div class=3D"gmail_quote">---------- Forwarded message ----------
From: = <rpopma@apache.org>
Da= te: Sat, Feb 20, 2016 at 7:36 PM
Subject: [2/5] logging-log4j2 git commi= t: LOG4J2-1274 add ByteBufferDestination interface
To: commits@logging.apache.org


LOG4J2-1274 add ByteBufferDestination interface


Project:
http://git-wip-us.apache.org/repo= s/asf/logging-log4j2/repo
Commit: http://git-wip-us.apach= e.org/repos/asf/logging-log4j2/commit/8ad09137
Tree: http://git-wip-us.apache.or= g/repos/asf/logging-log4j2/tree/8ad09137
Diff: http://git-wip-us.apache.or= g/repos/asf/logging-log4j2/diff/8ad09137

Branch: refs/heads/master
Commit: 8ad0913756eeb9c285161c5d8bfaab4f638f4d1f
Parents: 5a19927
Author: rpopma <r= popma@apache.org>
Authored: Sun Feb 21 12:17:39 2016 +0900
Committer: rpopma <rpopma@apache.org>
Committed: Sun Feb 21 12:17:39 2016 +0900

----------------------------------------------------------------------
=C2=A0.../core/layout/ByteBufferDestination.java=C2=A0 =C2=A0 =C2=A0 | 45 += +++++++++++++++++++
=C2=A01 file changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.a= pache.org/repos/asf/logging-log4j2/blob/8ad09137/log4j-core/src/main/java/o= rg/apache/logging/log4j/core/layout/ByteBufferDestination.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/= ByteBufferDestination.java b/log4j-core/src/main/java/org/apache/logging/lo= g4j/core/layout/ByteBufferDestination.java
new file mode 100644
index 0000000..61ce3ba
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/ByteBuf= ferDestination.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0=
+ * (the "License"); you may not use this file except in complian= ce with
+ * the License. You may obtain a copy of the License at
+ *
+ *=C2=A0 =C2=A0 =C2=A0 http://www.apache.org/licenses/LIC= ENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BA= SIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.layout;
+
+import java.nio.ByteBuffer;
+
+/**
+ * ByteBufferDestination addresses the problem a producer has when the des= tination ByteBuffer is not large enough to
+ * fit all the data. This interface allows a producer to write arbitrary a= mounts of data to a destination.
+ *
+ * @since 2.6
+ */
+public interface ByteBufferDestination {
+=C2=A0 =C2=A0 /**
+=C2=A0 =C2=A0 =C2=A0* Returns the buffer to write to.
+=C2=A0 =C2=A0 =C2=A0*
+=C2=A0 =C2=A0 =C2=A0* @return the buffer to write to
+=C2=A0 =C2=A0 =C2=A0*/
+=C2=A0 =C2=A0 ByteBuffer getByteBuffer();
+
+=C2=A0 =C2=A0 /**
+=C2=A0 =C2=A0 =C2=A0* Consumes the buffer content and returns a buffer wit= h more {@linkplain ByteBuffer#remaining() available} space
+=C2=A0 =C2=A0 =C2=A0* (which may or may not be the same instance).
+=C2=A0 =C2=A0 =C2=A0* <p>
+=C2=A0 =C2=A0 =C2=A0* Called by the producer when buffer becomes too full = to write to.
+=C2=A0 =C2=A0 =C2=A0*
+=C2=A0 =C2=A0 =C2=A0* @param buf the buffer to drain
+=C2=A0 =C2=A0 =C2=A0* @return a buffer with more available space (which ma= y or may not be the same instance)
+=C2=A0 =C2=A0 =C2=A0*/
+=C2=A0 =C2=A0 ByteBuffer drain(ByteBuffer buf);
+}




--



--
--089e015374d83f40fa052c42cf94--