Tabnine Logo
ServiceRegistry.setCurrentJob
Code IndexAdd Tabnine to your IDE (free)

How to use
setCurrentJob
method
in
org.opencastproject.serviceregistry.api.ServiceRegistry

Best Java code snippets using org.opencastproject.serviceregistry.api.ServiceRegistry.setCurrentJob (Showing top 3 results out of 315)

origin: opencast/opencast

/**
 * {@inheritDoc}
 *
 * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
 *      javax.servlet.FilterChain)
 */
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
    ServletException {
 HttpServletRequest httpRequest = (HttpServletRequest) request;
 HttpServletResponse httpResponse = (HttpServletResponse) response;
 try {
  setCurrentJob(httpRequest, httpResponse);
  chain.doFilter(httpRequest, httpResponse);
 } finally {
  serviceRegistry.setCurrentJob(null);
 }
}
origin: opencast/opencast

/**
 * Sets the current job on the new thread
 *
 * @param httpRequest
 *          the HTTP request
 * @param httpResponse
 *          the HTTP response
 * @throws IOException
 *           if the error response was not able to be sent
 */
private void setCurrentJob(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException {
 String currentJobId = httpRequest.getHeader(CURRENT_JOB_HEADER);
 try {
  if (StringUtils.isNotBlank(currentJobId)) {
   Job currentJob = serviceRegistry.getJob(Long.parseLong(currentJobId));
   serviceRegistry.setCurrentJob(currentJob);
  }
 } catch (Exception e) {
  logger.error("Unable to set the current job {}: {}", currentJobId, e);
  httpResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
      "Was not able to set the current job id {} to the service registry" + currentJobId);
 }
}
origin: opencast/opencast

@Override
public Void call() throws Exception {
 final SecurityService securityService = getSecurityService();
 final ServiceRegistry serviceRegistry = getServiceRegistry();
 final Job jobBeforeProcessing = serviceRegistry.getJob(jobId);
 if (currentJobId.isSome())
  serviceRegistry.setCurrentJob(serviceRegistry.getJob(currentJobId.get()));
 final Organization organization = getOrganizationDirectoryService()
     .getOrganization(jobBeforeProcessing.getOrganization());
 securityService.setOrganization(organization);
 final User user = getUserDirectoryService().loadUser(jobBeforeProcessing.getCreator());
 securityService.setUser(user);
 try {
  final String payload = process(jobBeforeProcessing);
  handleSuccessfulProcessing(payload);
 } catch (Throwable t) {
  handleFailedProcessing(t);
 } finally {
  serviceRegistry.setCurrentJob(null);
  securityService.setUser(null);
  securityService.setOrganization(null);
 }
 return null;
}
org.opencastproject.serviceregistry.apiServiceRegistrysetCurrentJob

Javadoc

Sets the current running job

Popular methods of ServiceRegistry

  • createJob
    Create and store a new job. If enqueueImmediately is true, the job will be in the Status#QUEUED stat
  • getCurrentJob
    Gets the current running job
  • getJob
    Gets a receipt by its ID, or null if not found
  • count
    Count the number of jobs that match the specified parameters.
  • getHostRegistrations
    Finds all host registrations, including offline hosts and those in maintenance mode.
  • getMaxLoadOnNode
    Returns the maximum load that can be handled by a given node. Note that this load is *not* 1-to-1 eq
  • getOwnLoad
    Gets the load value for the current host (ie, the host this service registry lives on
  • getServiceRegistrationsByLoad
    Finds the service registrations for this kind of job, ordered by load (lightest to heaviest).
  • incident
    Return a facility to record job incidents.
  • updateJob
    Update the job in the database
  • countByHost
    Count the number of jobs in this Status on this host
  • countByOperation
    Count the number of jobs running the given operation in this Status.
  • countByHost,
  • countByOperation,
  • countOfAbnormalServices,
  • disableHost,
  • enableHost,
  • getActiveJobs,
  • getChildJobs,
  • getCurrentHostLoads,
  • getJobs

Popular in Java

  • Reading from database using SQL prepared statement
  • getExternalFilesDir (Context)
  • addToBackStack (FragmentTransaction)
  • startActivity (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Table (org.hibernate.mapping)
    A relational table
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now