You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@samza.apache.org by GitBox <gi...@apache.org> on 2019/03/07 07:04:41 UTC

[GitHub] [samza] mynameborat commented on a change in pull request #938: SAMZA-1531: Support run.id in standalone for batch processing.

mynameborat commented on a change in pull request #938: SAMZA-1531: Support run.id in standalone for batch processing.
URL: https://github.com/apache/samza/pull/938#discussion_r262818100
 
 

 ##########
 File path: samza-core/src/main/java/org/apache/samza/coordinator/DistributedReadWriteLock.java
 ##########
 @@ -0,0 +1,70 @@
+/*
+ * 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.samza.coordinator;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+
+/**
+ * Lock to acquire read access or write access
+ * At any point in time, only one processor can hold the lock
+ * The processor that has acquired the lock, holds it until it does `unlock` explicitly
+ * The first processor to acquire the lock should be given a WRITE access
+ * All other subsequent requests should acquire only READ access
+ */
+public interface DistributedReadWriteLock {
+
+  /**
+   * Try to acquire lock: returns the type of access lock was acquired for
+   * @param timeout Duration of lock acquiring timeout.
+   * @param unit Time Unit of the timeout defined above.
+   * @return AccessType.READ if lock is acquired for read, AcessType.WRITE if acquired for write and AccessType.NONE if not acquired
 
 Review comment:
   What is the scenario where you fail to acquire the lock but not timeout?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services