public class StandaloneCheckpointIDCounter extends Object implements CheckpointIDCounter
CheckpointIDCounter
instances for JobManagers running in HighAvailabilityMode.NONE
.
Simple wrapper around an AtomicLong
.
Constructor and Description |
---|
StandaloneCheckpointIDCounter() |
Modifier and Type | Method and Description |
---|---|
long |
get()
Atomically gets the current checkpoint ID.
|
long |
getAndIncrement()
Atomically increments the current checkpoint ID.
|
long |
getLast()
Returns the last checkpoint ID (current - 1).
|
void |
setCount(long newCount)
Sets the current checkpoint ID.
|
void |
shutdown(JobStatus jobStatus)
Shuts the
CheckpointIDCounter service. |
void |
start()
Starts the
CheckpointIDCounter service down. |
public void start() throws Exception
CheckpointIDCounter
CheckpointIDCounter
service down.start
in interface CheckpointIDCounter
Exception
public void shutdown(JobStatus jobStatus) throws Exception
CheckpointIDCounter
CheckpointIDCounter
service.
The job status is forwarded and used to decide whether state should actually be discarded or kept.
shutdown
in interface CheckpointIDCounter
jobStatus
- Job state on shut downException
public long getAndIncrement() throws Exception
CheckpointIDCounter
getAndIncrement
in interface CheckpointIDCounter
Exception
public long get()
CheckpointIDCounter
get
in interface CheckpointIDCounter
public void setCount(long newCount)
CheckpointIDCounter
setCount
in interface CheckpointIDCounter
newCount
- The new IDpublic long getLast()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.