Package org.gearman.common
Class GearmanJobServerSession
- java.lang.Object
-
- org.gearman.common.GearmanJobServerSession
-
- All Implemented Interfaces:
GearmanIOEventListener
,GearmanSessionEventHandler
public class GearmanJobServerSession extends Object implements GearmanSessionEventHandler, GearmanIOEventListener
-
-
Constructor Summary
Constructors Constructor Description GearmanJobServerSession(GearmanJobServerConnection conn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeSession()
void
driveSessionIO()
boolean
equals(Object that)
GearmanJobServerConnection
getConnection()
int
getNumberOfActiveTasks()
SelectionKey
getSelectionKey()
void
handleGearmanIOEvent(GearmanPacket event)
The method to be called when an event has occurred.void
handleSessionEvent(GearmanSessionEvent event)
int
hashCode()
void
initSession(Selector sel, GearmanSessionEventHandler handler)
boolean
isInitialized()
boolean
sessionHasDataToWrite()
void
submitTask(GearmanTask task)
String
toString()
void
waitForTasksToComplete()
void
waitForTasksToComplete(long timeout, TimeUnit unit)
-
-
-
Constructor Detail
-
GearmanJobServerSession
public GearmanJobServerSession(GearmanJobServerConnection conn) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
-
Method Detail
-
initSession
public void initSession(Selector sel, GearmanSessionEventHandler handler) throws IllegalStateException, IOException
- Throws:
IllegalStateException
IOException
-
getConnection
public GearmanJobServerConnection getConnection()
-
getSelectionKey
public SelectionKey getSelectionKey()
-
isInitialized
public boolean isInitialized()
-
waitForTasksToComplete
public void waitForTasksToComplete() throws IllegalStateException, InterruptedException
-
waitForTasksToComplete
public void waitForTasksToComplete(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException, IllegalStateException
-
closeSession
public void closeSession()
-
submitTask
public void submitTask(GearmanTask task) throws IllegalStateException
- Throws:
IllegalStateException
-
handleGearmanIOEvent
public void handleGearmanIOEvent(GearmanPacket event) throws IllegalArgumentException
Description copied from interface:GearmanIOEventListener
The method to be called when an event has occurred.- Specified by:
handleGearmanIOEvent
in interfaceGearmanIOEventListener
- Parameters:
event
- The fired event.- Throws:
IllegalArgumentException
-
driveSessionIO
public void driveSessionIO() throws IOException, GearmanException, IllegalStateException
-
handleSessionEvent
public void handleSessionEvent(GearmanSessionEvent event) throws IllegalArgumentException, IllegalStateException
- Specified by:
handleSessionEvent
in interfaceGearmanSessionEventHandler
- Throws:
IllegalArgumentException
IllegalStateException
-
getNumberOfActiveTasks
public int getNumberOfActiveTasks() throws IllegalStateException
- Throws:
IllegalStateException
-
sessionHasDataToWrite
public boolean sessionHasDataToWrite()
-
-