From dev-return-69468-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Mon May 7 17:23:13 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 86CE3180648 for ; Mon, 7 May 2018 17:23:12 +0200 (CEST) Received: (qmail 6650 invoked by uid 500); 7 May 2018 15:23:11 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 6635 invoked by uid 99); 7 May 2018 15:23:10 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 May 2018 15:23:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B2B6EE09F4; Mon, 7 May 2018 15:23:10 +0000 (UTC) From: rakeshadr To: dev@zookeeper.apache.org Reply-To: dev@zookeeper.apache.org References: In-Reply-To: Subject: [GitHub] zookeeper pull request #377: [ZOOKEEPER-2901] TTL Nodes don't work with Serv... Content-Type: text/plain Message-Id: <20180507152310.B2B6EE09F4@git1-us-west.apache.org> Date: Mon, 7 May 2018 15:23:10 +0000 (UTC) Github user rakeshadr commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/377#discussion_r186427922 --- Diff: src/java/main/org/apache/zookeeper/server/OldEphemeralType.java --- @@ -0,0 +1,74 @@ +/** + * 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.zookeeper.server; + +/** + * See https://issues.apache.org/jira/browse/ZOOKEEPER-2901 + * + * version 3.5.3 introduced bugs associated with how TTL nodes were implemented. version 3.5.4 + * fixes the problems but makes TTL nodes created in 3.5.3 invalid. OldEphemeralType is a copy + * of the old - bad - implementation that is provided as a workaround. {@link EphemeralType#TTL_3_5_3_EMULATION_PROPERTY} + * can be used to emulate support of the badly specified TTL nodes. + */ +public enum OldEphemeralType { + /** + * Not ephemeral + */ + VOID, + /** + * Standard, pre-3.5.x EPHEMERAL + */ + NORMAL, + /** + * Container node + */ + CONTAINER, + /** + * TTL node + */ + TTL; + + public static final long CONTAINER_EPHEMERAL_OWNER = Long.MIN_VALUE; + public static final long MAX_TTL = 0x0fffffffffffffffL; + public static final long TTL_MASK = 0x8000000000000000L; + + public static OldEphemeralType get(long ephemeralOwner) { --- End diff -- +1, I like @anmolnar's idea of keeping `EphemeralTypeEmulate353` class name as this class is a 3.5.3 specific item. `Old` may create confusions later if we couldn't remove it in 3.5.5 or so, right? Better I would suggest to rename it as we are creating newly:-) ---