@ThreadSafe public final class JobContext extends Object implements Closeable
JobContext for interacting with job service.
NOTE: The context maintains a pool of job master clients that is already thread-safe.
Synchronizing JobContext methods could lead to deadlock: thread A attempts to acquire a
client when there are no clients left in the pool and blocks holding a lock on the
JobContext, when thread B attempts to release a client it owns it is unable to do so,
because thread A holds the lock on JobContext.
| Modifier and Type | Method and Description |
|---|---|
JobMasterClient |
acquireMasterClient()
Acquires a job master client from the job master client pool.
|
alluxio.resource.CloseableResource<JobMasterClient> |
acquireMasterClientResource()
Acquires a job master client from the job master client pool.
|
void |
close()
Closes all the resources associated with the context.
|
static JobContext |
create(alluxio.conf.AlluxioConfiguration alluxioConf)
Creates a job context.
|
InetSocketAddress |
getJobMasterAddress() |
void |
releaseMasterClient(JobMasterClient masterClient)
Releases a job master client into the job master client pool.
|
public static JobContext create(alluxio.conf.AlluxioConfiguration alluxioConf)
alluxioConf - Alluxio configurationpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic InetSocketAddress getJobMasterAddress() throws alluxio.exception.status.UnavailableException
alluxio.exception.status.UnavailableException - if the master address cannot be determinedpublic JobMasterClient acquireMasterClient()
public void releaseMasterClient(JobMasterClient masterClient)
masterClient - a job master client to releasepublic alluxio.resource.CloseableResource<JobMasterClient> acquireMasterClientResource()
Closeable.Copyright © 2019. All Rights Reserved.