Class DefaultJobTable
- java.lang.Object
-
- org.apache.flink.runtime.taskexecutor.DefaultJobTable
-
- All Implemented Interfaces:
AutoCloseable
,JobTable
public final class DefaultJobTable extends Object implements JobTable
Default implementation of theJobTable
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.taskexecutor.JobTable
JobTable.Connection, JobTable.Job, JobTable.JobServices
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static DefaultJobTable
create()
Optional<JobTable.Connection>
getConnection(JobID jobId)
Gets the connection registered under jobId.Optional<JobTable.Connection>
getConnection(ResourceID resourceId)
Gets the connection registered under resourceId.Optional<JobTable.Job>
getJob(JobID jobId)
Gets the job registered under jobId.Collection<JobTable.Job>
getJobs()
Gets all registered jobs.<E extends Exception>
JobTable.JobgetOrCreateJob(JobID jobId, SupplierWithException<? extends JobTable.JobServices,E> jobServicesSupplier)
Gets a registeredJobTable.Job
or creates one if not present.boolean
isEmpty()
Returnstrue
if the job table does not contain any jobs.
-
-
-
Method Detail
-
getOrCreateJob
public <E extends Exception> JobTable.Job getOrCreateJob(JobID jobId, SupplierWithException<? extends JobTable.JobServices,E> jobServicesSupplier) throws E extends Exception
Description copied from interface:JobTable
Gets a registeredJobTable.Job
or creates one if not present.- Specified by:
getOrCreateJob
in interfaceJobTable
- Parameters:
jobId
- jobId identifies the job to getjobServicesSupplier
- jobServicesSupplier create newJobTable.JobServices
if a new job needs to be created- Returns:
- the current job (existing or created) registered under jobId
- Throws:
E
- if the job services could not be createdE extends Exception
-
getJob
public Optional<JobTable.Job> getJob(JobID jobId)
Description copied from interface:JobTable
Gets the job registered under jobId.- Specified by:
getJob
in interfaceJobTable
- Parameters:
jobId
- jobId identifying the job to get- Returns:
- an
Optional
containing theJobTable.Job
registered under jobId, or an emptyOptional
if no job has been registered
-
getConnection
public Optional<JobTable.Connection> getConnection(JobID jobId)
Description copied from interface:JobTable
Gets the connection registered under jobId.- Specified by:
getConnection
in interfaceJobTable
- Parameters:
jobId
- jobId identifying the connection to get- Returns:
- an
Optional
containing theJobTable.Connection
registered under jobId, or an emptyOptional
if no connection has been registered (this could also mean that a job which has not been connected exists)
-
getConnection
public Optional<JobTable.Connection> getConnection(ResourceID resourceId)
Description copied from interface:JobTable
Gets the connection registered under resourceId.- Specified by:
getConnection
in interfaceJobTable
- Parameters:
resourceId
- resourceId identifying the connection to get- Returns:
- an
Optional
containing theJobTable.Connection
registered under resourceId, or an emptyOptional
if no connection has been registered
-
getJobs
public Collection<JobTable.Job> getJobs()
Description copied from interface:JobTable
Gets all registered jobs.
-
isEmpty
public boolean isEmpty()
Description copied from interface:JobTable
Returnstrue
if the job table does not contain any jobs.
-
create
public static DefaultJobTable create()
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-