com.parabon.client
Class SimulatorSessionManager

java.lang.Object
  extended by com.parabon.client.SessionManager
      extended by com.parabon.client.RemoteSessionManager
          extended by com.parabon.client.SimulatorSessionManager

public class SimulatorSessionManager
extends RemoteSessionManager

The SimulatorSessionManager is a substitute for a RemoteSessionManager to facilitate local job execution in an environment meant to simulate remote execution. It will accumulate the tasks and elements for dispatch to local engines. Jobs run under Eclipse should call SessionManager.getInstance() to retrieve an instance that will point either to this instance or a RemoteSessionManager depending on the runtime launch preferences.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.parabon.client.RemoteSessionManager
RemoteSessionManager.Establisher, RemoteSessionManager.GenericMessageConsumerTarget, RemoteSessionManager.MessageTransportRunnable
 
Field Summary
static java.lang.String WRITE_XML_STATUS_PROPERTY
           
 
Fields inherited from class com.parabon.client.RemoteSessionManager
actingClientID, CLIENT_SERVLET_PATH, CLIENT_USER_PASSWORD_PROPERTY, CLIENT_USER_USERNAME_PROPERTY, clientID, dataServerURI, DEFAULT_MIN_CONNECTIONS_PER_HOUR, establisher, jobIDMap, lastBarrierMessageID, messageConsumer, messageTranslator, messageTransportRunnable, nextBucketID, nextJobID, reestablishCompletionListeners, REGISTER_URL_PROPERTY, SERVER_TIMEOUT_PROPERTY, SERVER_URL_PROPERTY, sessionID, THREAD_NAME, transport
 
Fields inherited from class com.parabon.client.SessionManager
DEFAULT_SESSION_MANAGER, destroyed, idGenerator, jobs, LOCAL_SESSION_MANAGER, log, pool, REMOTE_SESSION_MANAGER, SESSION_MODE_PROPERTY, SIMULATOR_SESSION_MANAGER, tempListenerList
 
Constructor Summary
SimulatorSessionManager()
           
 
Method Summary
 Job createJob(java.util.Map<java.lang.String,java.lang.String> attributes)
          Create and add a new Job with the given attributes.
 void destroy(int blockMillis)
          Close this session, and release any resources associated with it.
protected  void establishConnection(int blockMillis)
           
protected  java.net.URI getBaseClientURI()
           
 java.net.URI getGlobalDataURI()
           
protected  com.parabon.server.common.MessageManagerInterface getMessageManager()
          Get internal message manager.
protected  java.lang.String getNewJobID()
           
protected  com.parabon.client.SimulatorSessionManager.Persistence getPersistence()
           
protected  java.lang.String getSessionID()
           
 java.util.Set<com.parabon.message.sp.TaskStatusMessage> getTaskStatusMessages(java.lang.String jobId)
           
protected  int initJobID()
          Read the next job id from disk
protected  void initTransport(java.lang.String clientServletUrl, java.lang.String elementServletUrl)
          Initialize Seneca Transport
 void reestablish(com.parabon.util.Listener completionListener)
          Attempt to retrieve the latest list of jobs from the Frontier server, returning immediately without waiting for the operation to complete.
protected  void removeJob(Job job)
          Remove job from job queue.
protected  java.lang.String sendData(com.parabon.io.DataWrapper data)
           
protected  int sendMessage(com.parabon.message.Message m, boolean barrier, com.parabon.util.IntegerSet dependencies)
          Intercept the Message before it is sent and react accordingly.
 java.lang.String toString()
           
 
Methods inherited from class com.parabon.client.RemoteSessionManager
addJob, createJob, createJob, createJob, createManagerWithLoginPrompt, createManagerWithLoginPrompt, createNewJobID, destroy, destroy, flush, getMaxIncomingMessageQueueSize, getMaxOutgoingDataQueueSize, getMaxOutgoingMessageQueueSize, getPassword, getUsername, init, initTransport, initTransport, reestablish, setLog, setMaxIncomingMessageQueueSize, setMaxOutgoingDataQueueSize, setMaxOutgoingMessageQueueSize, submitElement, submitElementBundle
 
Methods inherited from class com.parabon.client.SessionManager
addElement, addElement, addElement, addElement, getClientDataURI, getInstance, getInstance, getJobDataURI, getJobs, getLog, getTaskDataURI, notifyTaskEventListeners, reestablish
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WRITE_XML_STATUS_PROPERTY

public static final java.lang.String WRITE_XML_STATUS_PROPERTY
See Also:
Constant Field Values
Constructor Detail

SimulatorSessionManager

public SimulatorSessionManager()
                        throws ServerCommunicationException
Throws:
ServerCommunicationException
Method Detail

getGlobalDataURI

public java.net.URI getGlobalDataURI()
                              throws java.net.URISyntaxException
Overrides:
getGlobalDataURI in class RemoteSessionManager
Throws:
java.net.URISyntaxException

getBaseClientURI

protected java.net.URI getBaseClientURI()
                                 throws java.net.URISyntaxException
Overrides:
getBaseClientURI in class RemoteSessionManager
Throws:
java.net.URISyntaxException

createJob

public Job createJob(java.util.Map<java.lang.String,java.lang.String> attributes)
Description copied from class: SessionManager
Create and add a new Job with the given attributes. The given attributes may be modified after createJob returns without affecting the newly-created job.

Overrides:
createJob in class RemoteSessionManager

removeJob

protected void removeJob(Job job)
Remove job from job queue.

Overrides:
removeJob in class RemoteSessionManager

reestablish

public void reestablish(com.parabon.util.Listener completionListener)
Description copied from class: SessionManager
Attempt to retrieve the latest list of jobs from the Frontier server, returning immediately without waiting for the operation to complete. completionListener.alert(nul) will be called when reestablishment is complete.

Overrides:
reestablish in class RemoteSessionManager

destroy

public void destroy(int blockMillis)
Description copied from class: SessionManager
Close this session, and release any resources associated with it. Any further operations on this session manager or any jobs or tasks created through it will result in undefined behaviour.

Blocks at most approximately blockMillis milliseconds (or indefinitely if blockMillis == -1) for destruction to complete successfully; otherwise continues destruction but returns from the method call if possible while destruction continues.

Note that this version of destroy() should not be called from within a listener, as this could create a deadlock situation.

If a relatively short timeout is given, and this routine exits before interactions are complete, threads may continue attempting to complete various interactions in the background. If the application subsequently exits the JVM (e.g. via System.exit()), these interactions may not complete successfully -- for example, messages may not be correctly and complete transferred to the Frontier server, and hence operations initiated with this SessionManager (such as job or task creation or removal) may not occur.

Overrides:
destroy in class RemoteSessionManager

toString

public java.lang.String toString()
Overrides:
toString in class RemoteSessionManager

establishConnection

protected void establishConnection(int blockMillis)
                            throws ServerCommunicationException
Overrides:
establishConnection in class RemoteSessionManager
Throws:
ServerCommunicationException

sendData

protected java.lang.String sendData(com.parabon.io.DataWrapper data)

sendMessage

protected int sendMessage(com.parabon.message.Message m,
                          boolean barrier,
                          com.parabon.util.IntegerSet dependencies)
Intercept the Message before it is sent and react accordingly.

Overrides:
sendMessage in class RemoteSessionManager

initJobID

protected int initJobID()
Read the next job id from disk

Overrides:
initJobID in class RemoteSessionManager

getNewJobID

protected java.lang.String getNewJobID()
Overrides:
getNewJobID in class RemoteSessionManager

getSessionID

protected java.lang.String getSessionID()
Overrides:
getSessionID in class RemoteSessionManager

getTaskStatusMessages

public java.util.Set<com.parabon.message.sp.TaskStatusMessage> getTaskStatusMessages(java.lang.String jobId)

initTransport

protected void initTransport(java.lang.String clientServletUrl,
                             java.lang.String elementServletUrl)
                      throws ServerCommunicationException
Initialize Seneca Transport

Throws:
ServerCommunicationException

getMessageManager

protected com.parabon.server.common.MessageManagerInterface getMessageManager()
Get internal message manager.


getPersistence

protected com.parabon.client.SimulatorSessionManager.Persistence getPersistence()