public class PigServerFactoryBean extends java.lang.Object implements org.springframework.beans.factory.FactoryBean<PigServerFactory>, org.springframework.beans.factory.BeanNameAware
PigServer
instance. Note that since PigServer is not thread-safe and the Pig API does not
provide some type of factory, the factory bean returns an instance of ObjectFactory
(which handles the creation of PigServer
instances)
instead of the raw PigServer
object which cannot be reused.
Note that the caller needs to handle the object clean-up, specifically calling PigServer.shutdown()
.
In general, to avoid leaks it is recommended to use the PigTemplate
.Constructor and Description |
---|
PigServerFactoryBean() |
Modifier and Type | Method and Description |
---|---|
protected org.apache.pig.PigServer |
createPigInstance() |
PigServerFactory |
getObject() |
java.lang.Class<?> |
getObjectType() |
boolean |
isSingleton() |
void |
setBeanName(java.lang.String name) |
void |
setJobName(java.lang.String jobName)
Sets the job name.
|
void |
setJobPriority(java.lang.String jobPriority)
Sets the job priority.
|
void |
setParallelism(java.lang.Integer parallelism)
Sets the parallelism.
|
void |
setPathsToSkip(java.util.Collection<java.lang.String> pathToSkip)
Sets the paths to skip.
|
void |
setPigContext(org.apache.pig.impl.PigContext pigContext)
Sets the
PigContext to use. |
void |
setScripts(java.util.Collection<PigScript> scripts)
Sets the scripts to execute at startup.
|
void |
setUser(java.lang.String user)
Sets the user impersonation (optional) for executing Pig jobs.
|
void |
setValidateEachStatement(java.lang.Boolean validateEachStatement)
Indicates whether each statement should be validated or not.
|
public PigServerFactory getObject() throws java.lang.Exception
getObject
in interface org.springframework.beans.factory.FactoryBean<PigServerFactory>
java.lang.Exception
public java.lang.Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<PigServerFactory>
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean<PigServerFactory>
protected org.apache.pig.PigServer createPigInstance() throws java.lang.Exception
java.lang.Exception
public void setBeanName(java.lang.String name)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public void setPigContext(org.apache.pig.impl.PigContext pigContext)
PigContext
to use.pigContext
- The pigContext to set.public void setPathsToSkip(java.util.Collection<java.lang.String> pathToSkip)
pathToSkip
- The pathToSkip to set.public void setScripts(java.util.Collection<PigScript> scripts)
scripts
- The scripts to set.public void setParallelism(java.lang.Integer parallelism)
parallelism
- The parallelism to set.public void setJobName(java.lang.String jobName)
jobName
- The jobName to set.public void setJobPriority(java.lang.String jobPriority)
jobPriority
- The jobPriority to set.public void setValidateEachStatement(java.lang.Boolean validateEachStatement)
validateEachStatement
- whether to validate each statement or not.public void setUser(java.lang.String user)
user
- user/group information