Tabnine Logo
A_CmsReportThread
Code IndexAdd Tabnine to your IDE (free)

How to use
A_CmsReportThread
in
org.opencms.report

Best Java code snippets using org.opencms.report.A_CmsReportThread (Showing top 20 results out of 315)

origin: org.opencms/opencms-core

/**
 * @see org.opencms.report.A_CmsReportThread#getReportUpdate()
 */
@Override
public String getReportUpdate() {
  switch (m_phase) {
    case 1:
      return m_deleteThread.getReportUpdate();
    case 2:
      String content;
      if (m_reportContent != null) {
        content = m_reportContent;
        m_reportContent = null;
      } else {
        content = "";
      }
      return content + m_importThread.getReportUpdate();
    default:
      // noop
  }
  return "";
}
origin: org.opencms/opencms-core

/**
 * Returns true if this thread is already "doomed" to be deleted.<p>
 *
 * A OpenCms deamon Thread (the "Grim Reaper") will collect all
 * doomed Threads, i.e. threads that are not longer active for some
 * time.<p>
 *
 * @return true if this thread is already "doomed" to be deleted
 */
public synchronized boolean isDoomed() {
  if (isAlive()) {
    // as long as the Thread is still active it is never doomed
    return false;
  }
  if (m_doomed) {
    // not longer active, and already doomed, so rest in peace...
    return true;
  }
  // condemn the Thread to be collected by the grim reaper next time
  m_starttime = getRuntime();
  m_doomed = true;
  return false;
}
origin: org.opencms/opencms-core

/**
 * Returns a list of all errors that occurred during the report.<p>
 *
 * @return an error list that occurred during the report
 */
public List<Object> getErrors() {
  if (getReport() != null) {
    return getReport().getErrors();
  } else {
    return null;
  }
}
origin: org.opencms/opencms-solr

CmsUUID key = (CmsUUID)i.next();
A_CmsReportThread thread = (A_CmsReportThread)m_threads.get(key);
if (thread.isDoomed()) {
  doomed.add(key);
  if (LOG.isDebugEnabled()) {
    LOG.debug(Messages.get().getBundle().key(
      Messages.LOG_THREADSTORE_DOOMED_2,
      thread.getName(),
      thread.getUUID()));
    if (thread != null) {
      if (CmsStringUtil.isEmptyOrWhitespaceOnly(thread.getReportUpdate())) {
            thread.getName(),
            thread.getUUID()));
        thread.interrupt();
origin: org.opencms/opencms-solr

m_deleteThread.start();
try {
  m_deleteThread.join();
} catch (InterruptedException e) {
m_reportContent = m_deleteThread.getReportUpdate();
if (LOG.isDebugEnabled()) {
  LOG.debug(Messages.get().getBundle().key(Messages.LOG_REPLACE_THREAD_START_IMPORT_0));
m_importThread.start();
try {
  m_importThread.join();
} catch (InterruptedException e) {
origin: org.opencms/opencms-core

/**
 * @see org.opencms.ui.shared.rpc.I_CmsReportServerRpc#requestReportUpdate()
 */
public void requestReportUpdate() {
  String reportUpdate = null;
  if (!m_threadFinished && (m_thread != null)) {
    // if thread is not alive at this point, there may still be report updates
    reportUpdate = m_thread.getReportUpdate();
    if (!m_thread.isAlive()) {
      m_threadFinished = true;
      for (Runnable handler : m_reportFinishedHandlers) {
        handler.run();
      }
    }
  }
  getRpcProxy(I_CmsReportClientRpc.class).handleReportUpdate(reportUpdate);
}
origin: org.opencms/opencms-core

CmsUUID key = i.next();
A_CmsReportThread thread = m_threads.get(key);
if (thread.isDoomed()) {
  doomed.add(key);
  if (LOG.isDebugEnabled()) {
      Messages.get().getBundle().key(
        Messages.LOG_THREADSTORE_DOOMED_2,
        thread.getName(),
        thread.getUUID()));
origin: org.opencms/opencms-core

/**
 * Constructs a new report Thread with the given name.<p>
 *
 * @param cms the current OpenCms context object
 * @param name the name of the Thread
 */
protected A_CmsReportThread(CmsObject cms, String name) {
  super(OpenCms.getThreadStore().getThreadGroup(), name);
  // report Threads are never daemon Threads
  setDaemon(false);
  // the session in the cms context must not be updated when it is used in a report
  m_cms = cms;
  m_cms.getRequestContext().setUpdateSessionEnabled(false);
  // generate the report Thread id
  m_id = new CmsUUID();
  setName(name + " [" + m_id + "]");
  // new Threads are not doomed
  m_doomed = false;
  // set start time
  m_starttime = System.currentTimeMillis();
  // add this Thread to the main Thread store
  OpenCms.getThreadStore().addThread(this);
}
origin: org.opencms/opencms-solr

  /**
   * Method to dump all currently known Threads.<p> 
   */
  private void dumpThreads() {

    if (LOG.isDebugEnabled()) {
      StringBuffer b = new StringBuffer(512);
      Iterator i = m_threads.keySet().iterator();
      while (i.hasNext()) {
        CmsUUID key = (CmsUUID)i.next();
        A_CmsReportThread thread = (A_CmsReportThread)m_threads.get(key);
        b.append(thread.getName());
        b.append(" - ");
        b.append(thread.getUUID());
        b.append('\n');
      }
      LOG.debug(Messages.get().getBundle().key(
        Messages.LOG_THREADSTORE_POOL_CONTENT_2,
        new Integer(m_threads.size()),
        b.toString()));
    }
  }
}
origin: org.opencms/opencms-solr

/**
 * Returns true if the report Thread is still alive (i.e. running), false otherwise.<p>
 *  
 * @return true if the report Thread is still alive
 */
public boolean isAlive() {
  A_CmsReportThread thread = OpenCms.getThreadStore().retrieveThread(m_paramThread);
  if (thread != null) {
    return thread.isAlive();
  } else {
    return false;
  }
}
origin: org.opencms/opencms-core

/**
 * Adds a Thread to this Thread store.<p>
 *
 * @param thread the Thread to add
 */
public void addThread(A_CmsReportThread thread) {
  m_threads.put(thread.getUUID(), thread);
  if (LOG.isDebugEnabled()) {
    dumpThreads();
  }
}
origin: org.opencms/opencms-solr

/**
 * Returns if the report generated an error output.<p>
 * 
 * @return true if the report generated an error, otherwise false
 */
public boolean hasError() {
  A_CmsReportThread thread = OpenCms.getThreadStore().retrieveThread(m_paramThread);
  if (thread != null) {
    return thread.hasError();
  } else {
    return false;
  }
}
origin: org.opencms/opencms-core

m_deleteThread.start();
try {
  m_deleteThread.join();
} catch (InterruptedException e) {
m_reportContent = m_deleteThread.getReportUpdate();
if (LOG.isDebugEnabled()) {
  LOG.debug(Messages.get().getBundle().key(Messages.LOG_REPLACE_THREAD_START_IMPORT_0));
m_importThread.start();
try {
  m_importThread.join();
} catch (InterruptedException e) {
origin: org.opencms/opencms-solr

/**
 * Constructs a new report Thread with the given name.<p>
 *
 * @param cms the current OpenCms context object 
 * @param name the name of the Thread
 */
protected A_CmsReportThread(CmsObject cms, String name) {
  super(OpenCms.getThreadStore().getThreadGroup(), name);
  // report Threads are never daemon Threads
  setDaemon(false);
  // the session in the cms context must not be updated when it is used in a report
  m_cms = cms;
  m_cms.getRequestContext().setUpdateSessionEnabled(false);
  // generate the report Thread id
  m_id = new CmsUUID();
  setName(name + " [" + m_id + "]");
  // new Threads are not doomed
  m_doomed = false;
  // set start time
  m_starttime = System.currentTimeMillis();
  // add this Thread to the main Thread store
  OpenCms.getThreadStore().addThread(this);
}
origin: org.opencms/opencms-core

  /**
   * Method to dump all currently known Threads.<p>
   */
  private void dumpThreads() {

    if (LOG.isDebugEnabled()) {
      StringBuffer b = new StringBuffer(512);
      Iterator<CmsUUID> i = m_threads.keySet().iterator();
      while (i.hasNext()) {
        CmsUUID key = i.next();
        A_CmsReportThread thread = m_threads.get(key);
        b.append(thread.getName());
        b.append(" - ");
        b.append(thread.getUUID());
        b.append('\n');
      }
      LOG.debug(
        Messages.get().getBundle().key(
          Messages.LOG_THREADSTORE_POOL_CONTENT_2,
          new Integer(m_threads.size()),
          b.toString()));
    }
  }
}
origin: org.opencms/org.opencms.workplace

/**
 * Returns true if the report Thread is still alive (i.e. running), false otherwise.<p>
 *
 * @return true if the report Thread is still alive
 */
public boolean isAlive() {
  A_CmsReportThread thread = OpenCms.getThreadStore().retrieveThread(m_paramThread);
  if (thread != null) {
    return thread.isAlive();
  } else {
    return false;
  }
}
origin: org.opencms/opencms-solr

/**
 * Adds a Thread to this Thread store.<p>
 * 
 * @param thread the Thread to add
 */
public void addThread(A_CmsReportThread thread) {
  m_threads.put(thread.getUUID(), thread);
  if (LOG.isDebugEnabled()) {
    dumpThreads();
  }
}
origin: org.opencms/org.opencms.workplace

/**
 * Returns if the report generated an error output.<p>
 *
 * @return true if the report generated an error, otherwise false
 */
public boolean hasError() {
  A_CmsReportThread thread = OpenCms.getThreadStore().retrieveThread(m_paramThread);
  if (thread != null) {
    return thread.hasError();
  } else {
    return false;
  }
}
origin: org.opencms/opencms-solr

/**
 * Returns true if this thread is already "doomed" to be deleted.<p>
 * 
 * A OpenCms deamon Thread (the "Grim Reaper") will collect all 
 * doomed Threads, i.e. threads that are not longer active for some
 * time.<p>
 * 
 * @return true if this thread is already "doomed" to be deleted
 */
public synchronized boolean isDoomed() {
  if (isAlive()) {
    // as long as the Thread is still active it is never doomed
    return false;
  }
  if (m_doomed) {
    // not longer active, and already doomed, so rest in peace...
    return true;
  }
  // condemn the Thread to be collected by the grim reaper next time  
  m_starttime = getRuntime();
  m_doomed = true;
  return false;
}
origin: org.opencms/opencms-solr

/**
 * @see org.opencms.report.A_CmsReportThread#getReportUpdate()
 */
@Override
public String getReportUpdate() {
  switch (m_phase) {
    case 1:
      return m_deleteThread.getReportUpdate();
    case 2:
      String content;
      if (m_reportContent != null) {
        content = m_reportContent;
        m_reportContent = null;
      } else {
        content = "";
      }
      return content + m_importThread.getReportUpdate();
    default:
      // noop
  }
  return "";
}
org.opencms.reportA_CmsReportThread

Javadoc

Provides a common Thread class for the reports.

Most used methods

  • getReportUpdate
    Returns the part of the report that is ready for output.
  • isAlive
  • getName
  • getReport
    Returns the report where the output of this Thread is written to.
  • getRuntime
    Returns the time this report has been running.
  • getUUID
    Returns the OpenCms UUID of this report thread.
  • hasError
    Returns if the report generated an error output.
  • isDoomed
    Returns true if this thread is already "doomed" to be deleted. A OpenCms deamon Thread (the "Grim Re
  • join
  • setDaemon
  • setName
  • start
  • setName,
  • start,
  • getLastEntryTime,
  • getLogChannel,
  • interrupt

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • JPanel (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Join (org.hibernate.mapping)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top PhpStorm 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