Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.search
Class SearchServiceManager

java.lang.Object
  extended by com.jivesoftware.base.search.SearchServiceManager

public class SearchServiceManager
extends java.lang.Object

A SearchServiceManager is responsible for requesting remote JVMs that are offering specific services to run any requested task. This class uses a WorkManager to locate the servers offering the requested service.


Constructor Summary
SearchServiceManager()
           
 
Method Summary
static void doClusterTask(java.lang.String serviceName, ServiceInvocation task)
          Executes the requested task in all servers that are providing the specified service.
static InvocationResult getResult(java.lang.String serviceName, ServiceInvocation task)
          Executes the requested task in only one server that is providing the specified service.
static InvocationResult getResult(java.lang.String serviceName, ServiceInvocation task, commonj.work.WorkManager pinnedWorkManager)
          Executes the requested task in the requested remoted JVM.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchServiceManager

public SearchServiceManager()
Method Detail

getResult

public static InvocationResult getResult(java.lang.String serviceName,
                                         ServiceInvocation task)
                                  throws commonj.work.WorkException,
                                         java.lang.InterruptedException
Executes the requested task in only one server that is providing the specified service. The server to run the task will be selected by the WorkManager using a round-robin or some other algorithm. This method will not return until the task has finished its execution in the remote server.

An InvocationResult will be returned after the task has been executed in the remote JVM. If an error occured in the remote JVM then an InvocationResult will also be returned. Note that InvocationResult.getResult() will throw an exception if there was an error executing the task in the remote server. Otherwise, the result of the task is returned.

When no servers were found providing the requested service then a WorkException will be thrown by this method.

Parameters:
serviceName - the service offered by the server that will run the task.
task - the task to execute in a remote server.
Returns:
the result of the task that was executed remotely.
Throws:
commonj.work.WorkException - if there is no server providing the requested service
java.lang.InterruptedException - if there was an error waiting for the task to finish.

getResult

public static InvocationResult getResult(java.lang.String serviceName,
                                         ServiceInvocation task,
                                         commonj.work.WorkManager pinnedWorkManager)
                                  throws java.lang.InterruptedException,
                                         commonj.work.WorkException
Executes the requested task in the requested remoted JVM. However, if the remote JVM is no longer available then the task will be executed by any cluster member that provides the requested service.

The preferred remote JVM should be obtained from a previous getResult(String, com.jivesoftware.base.search.task.ServiceInvocation) execution.

Parameters:
serviceName - the service offered by the server that will run the task.
task - the task to execute in a remote server.
pinnedWorkManager - the preferred remote JVM.
Returns:
the result of the task that was executed remotely.
Throws:
commonj.work.WorkException - if there is no server providing the requested service
java.lang.InterruptedException - if there was an error waiting for the task to finish.

doClusterTask

public static void doClusterTask(java.lang.String serviceName,
                                 ServiceInvocation task)
Executes the requested task in all servers that are providing the specified service. This method will return immediately since the execution is asynchronous.

Parameters:
serviceName - the service offered by the server that will run the task.
task - the task to execute in a remote server.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.