Java Code Examples for org.jfree.util.Log#isDebugEnabled()

The following examples show how to use org.jfree.util.Log#isDebugEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterLockDao.java    From olat with Apache License 2.0 6 votes vote down vote up
LockImpl findLock(final String asset) {
    if (Log.isDebugEnabled()) {
        log.debug("findLock: " + asset + " START");
    }
    final DBQuery q = DBFactory.getInstance().createQuery(
            "select alock from " + LockImpl.class.getName() + " as alock inner join fetch alock.owner where alock.asset = :asset");
    q.setParameter("asset", asset);
    final List res = q.list();
    if (res.size() == 0) {
        log.debug("findLock: null END");
        return null;
    } else {
        if (Log.isDebugEnabled()) {
            log.debug("findLock: " + res.get(0) + " END");
        }
        return (LockImpl) res.get(0);
    }
}
 
Example 2
Source File: ClusterLockDao.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
 * @param identName
 *            the name of the identity to release all locks for (only the non-persistent locks in cluster mode, -not- the persistent locks!)
 */
public void releaseAllLocksFor(final String identName) {
    if (Log.isDebugEnabled()) {
        log.debug("releaseAllLocksFor: " + identName + " START");
    }

    final Identity ident = findIdentityByName(identName);

    DBFactory.getInstance().delete("from " + LockImpl.class.getName() + " as alock inner join fetch " + "alock.owner as owner where owner.key = ?", ident.getKey(),
            Hibernate.LONG);
    // cluster:: can we save a query (and is it appropriate considering encapsulation)
    // here by saying: alock.owner as owner where owner.name = ? (using identName parameter)
    if (Log.isDebugEnabled()) {
        log.debug("releaseAllLocksFor: " + identName + " END");
    }
}
 
Example 3
Source File: PackageState.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Configures the module and raises the state to STATE_CONFIGURED if the
 * module is not yet configured.
 *
 * @param subSystem  the sub-system.
 * 
 * @return true, if the module was configured, false otherwise.
 */
public boolean configure(final SubSystem subSystem)
{
  if (this.state == STATE_NEW)
  {
    try
    {
      this.module.configure(subSystem);
      this.state = STATE_CONFIGURED;
      return true;
    }
    catch (NoClassDefFoundError noClassDef)
    {
      Log.warn (new Log.SimpleMessage("Unable to load module classes for ",
              this.module.getName(), ":", noClassDef.getMessage()));
      this.state = STATE_ERROR;
    }
    catch (Exception e)
    {
      if (Log.isDebugEnabled())
      {
        // its still worth a warning, but now we are more verbose ...
        Log.warn("Unable to configure the module " + this.module.getName(), e);
      }
      else if (Log.isWarningEnabled())
      {
        Log.warn("Unable to configure the module " + this.module.getName());
      }
      this.state = STATE_ERROR;
    }
  }
  return false;
}
 
Example 4
Source File: ClusterLockDao.java    From olat with Apache License 2.0 5 votes vote down vote up
void saveLock(final LockImpl alock) {
    if (Log.isDebugEnabled()) {
        log.debug("saveLock: " + alock + " START");
    }
    DBFactory.getInstance().saveObject(alock);
    if (Log.isDebugEnabled()) {
        log.debug("saveLock: " + alock + " END");
    }
}
 
Example 5
Source File: ClusterLockDao.java    From olat with Apache License 2.0 5 votes vote down vote up
void deleteLock(final LockImpl li) {
    if (Log.isDebugEnabled()) {
        log.debug("deleteLock: " + li + " START");
    }
    DBFactory.getInstance().deleteObject(li);
    if (Log.isDebugEnabled()) {
        log.debug("deleteLock: " + li + " END");
    }
}
 
Example 6
Source File: ClusterLockDao.java    From olat with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
List<LockImpl> getAllLocks() {
    log.debug("getAllLocks START");
    final DBQuery q = DBFactory.getInstance().createQuery("select alock from " + LockImpl.class.getName() + " as alock inner join fetch alock.owner");
    final List<LockImpl> res = q.list();
    if (Log.isDebugEnabled()) {
        log.debug("getAllLocks END. res.length:" + (res == null ? "null" : res.size()));
    }
    return res;
}
 
Example 7
Source File: PackageState.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Initializes the contained module and raises the set of the module to
 * STATE_INITIALIZED, if the module was not yet initialized. In case of an
 * error, the module state will be set to STATE_ERROR and the module will
 * not be available.
 *
 * @param subSystem  the sub-system.
 * 
 * @return true, if the module was successfully initialized, false otherwise.
 */
public boolean initialize(final SubSystem subSystem)
{
  if (this.state == STATE_CONFIGURED)
  {
    try
    {
        this.module.initialize(subSystem);
        this.state = STATE_INITIALIZED;
        return true;
    }
    catch (NoClassDefFoundError noClassDef)
    {
      Log.warn (new Log.SimpleMessage("Unable to load module classes for ",
              this.module.getName(), ":", noClassDef.getMessage()));
      this.state = STATE_ERROR;
    }
    catch (ModuleInitializeException me)
    {
      if (Log.isDebugEnabled())
      {
        // its still worth a warning, but now we are more verbose ...
        Log.warn("Unable to initialize the module " + this.module.getName(), me);
      }
      else if (Log.isWarningEnabled())
      {
        Log.warn("Unable to initialize the module " + this.module.getName());
      }
      this.state = STATE_ERROR;
    }
    catch (Exception e)
    {
      if (Log.isDebugEnabled())
      {
        // its still worth a warning, but now we are more verbose ...
        Log.warn("Unable to initialize the module " + this.module.getName(), e);
      }
      else if (Log.isWarningEnabled())
      {
        Log.warn("Unable to initialize the module " + this.module.getName());
      }
      this.state = STATE_ERROR;
    }
  }
  return false;
}
 
Example 8
Source File: ClusterLockDao.java    From olat with Apache License 2.0 4 votes vote down vote up
LockImpl createLockImpl(final String asset, final OLATPrincipal owner) {
    if (Log.isDebugEnabled()) {
        log.debug("createLockImpl: " + asset + " by " + owner);
    }
    return new LockImpl(asset, (Identity) owner);
}