Return-Path: X-Original-To: apmail-flink-commits-archive@minotaur.apache.org Delivered-To: apmail-flink-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E8F9818B69 for ; Wed, 22 Jul 2015 12:33:13 +0000 (UTC) Received: (qmail 75733 invoked by uid 500); 22 Jul 2015 12:33:10 -0000 Delivered-To: apmail-flink-commits-archive@flink.apache.org Received: (qmail 75697 invoked by uid 500); 22 Jul 2015 12:33:10 -0000 Mailing-List: contact commits-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list commits@flink.apache.org Received: (qmail 75688 invoked by uid 99); 22 Jul 2015 12:33: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; Wed, 22 Jul 2015 12:33:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A117CE0AFA; Wed, 22 Jul 2015 12:33:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aljoscha@apache.org To: commits@flink.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: flink git commit: [FLINK-1658] Rename AbstractEvent to AbstractTaskEvent and AbstractJobEvent Date: Wed, 22 Jul 2015 12:33:10 +0000 (UTC) Repository: flink Updated Branches: refs/heads/master 03320503e -> 13762149d [FLINK-1658] Rename AbstractEvent to AbstractTaskEvent and AbstractJobEvent Delete AbstractEvent in org.apache.flink.runtime.event.job (see comment section in https://issues.apache.org/jira/browse/FLINK-1658) This closes #929 Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/13762149 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/13762149 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/13762149 Branch: refs/heads/master Commit: 13762149d404d51fd8d8106bba8bbe7bfdccbdf2 Parents: 0332050 Author: mjsax Authored: Tue Jul 21 21:54:08 2015 +0200 Committer: Aljoscha Krettek Committed: Wed Jul 22 14:32:28 2015 +0200 ---------------------------------------------------------------------- .../flink/runtime/event/job/AbstractEvent.java | 142 ------------------- 1 file changed, 142 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/13762149/flink-runtime/src/main/java/org/apache/flink/runtime/event/job/AbstractEvent.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/event/job/AbstractEvent.java b/flink-runtime/src/main/java/org/apache/flink/runtime/event/job/AbstractEvent.java deleted file mode 100644 index 70a1317..0000000 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/event/job/AbstractEvent.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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.flink.runtime.event.job; - -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.concurrent.atomic.AtomicLong; - -import org.apache.flink.core.io.IOReadableWritable; -import org.apache.flink.core.memory.DataInputView; -import org.apache.flink.core.memory.DataOutputView; - -/** - * An abstract event is transmitted from the job manager to the - * job client in order to inform the user about the job progress - */ -public abstract class AbstractEvent implements IOReadableWritable, java.io.Serializable { - - private static final long serialVersionUID = 1L; - - /** Static variable that points to the current global sequence number */ - private static final AtomicLong GLOBAL_SEQUENCE_NUMBER = new AtomicLong(0); - - /** Auxiliary object which helps to convert a {@link Date} object to the given string representation. */ - private static final SimpleDateFormat DATA_FORMATTER = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); - - - /** The timestamp of the event. */ - private long timestamp = -1; - - /** The sequence number of the event. */ - private long sequenceNumber = -1; - - // -------------------------------------------------------------------------------------------- - - /** - * Constructs a new abstract event object. This constructor - * is required for the deserialization process and is not - * supposed to be called directly. - */ - public AbstractEvent() {} - /** - * Constructs a new abstract event object. - * - * @param timestamp - * the timestamp of the event. - */ - public AbstractEvent(long timestamp) { - this.timestamp = timestamp; - this.sequenceNumber = GLOBAL_SEQUENCE_NUMBER.incrementAndGet(); - } - - // -------------------------------------------------------------------------------------------- - /** - * Returns the timestamp of the event. - * - * @return the timestamp of the event - */ - public long getTimestamp() { - return this.timestamp; - } - - public String getTimestampString() { - return timestampToString(timestamp); - } - - public long getSequenceNumber() { - return this.sequenceNumber; - } - - // -------------------------------------------------------------------------------------------- - // Serialization - // -------------------------------------------------------------------------------------------- - - @Override - public void read(DataInputView in) throws IOException { - this.timestamp = in.readLong(); - this.sequenceNumber = in.readLong(); - } - - @Override - public void write(DataOutputView out) throws IOException { - out.writeLong(this.timestamp); - out.writeLong(this.sequenceNumber); - } - - // -------------------------------------------------------------------------------------------- - // Utilities - // -------------------------------------------------------------------------------------------- - - @Override - public boolean equals(Object obj) { - if (obj instanceof AbstractEvent) { - final AbstractEvent abstractEvent = (AbstractEvent) obj; - return this.timestamp == abstractEvent.timestamp; - } - else { - return false; - } - } - - @Override - public int hashCode() { - return (int) (this.timestamp ^ (this.timestamp >>> 32)); - } - - @Override - public String toString() { - return String.format("AbstractEvent #%d at %s", sequenceNumber, timestampToString(timestamp)); - } - - // -------------------------------------------------------------------------------------------- - - /** - * Converts the timestamp of an event from its "milliseconds since beginning the epoch" - * representation into a unified string representation. - * - * @param timestamp - * the timestamp in milliseconds since the beginning of "the epoch" - * @return the string unified representation of the timestamp - */ - public static String timestampToString(long timestamp) { - return DATA_FORMATTER.format(new Date(timestamp)); - } -}