//# 0 errors, 297 messages
//#
/*
    //#JPAThreadManagerImpl.java:1:1: class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
 * Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  The ASF licenses this file to You
 * under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.  For additional information regarding
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */

package org.apache.roller.weblogger.business.jpa;

import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.NoResultException;
import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.util.DateUtil;
import org.apache.roller.weblogger.WebloggerException;
import org.apache.roller.weblogger.business.Weblogger;
import org.apache.roller.weblogger.business.runnable.ThreadManagerImpl;
import org.apache.roller.weblogger.business.runnable.RollerTask;
import org.apache.roller.weblogger.pojos.TaskLock;


/**
 * JPA implementation of the TaskLockManager interface.
 *
 * This implementation extends the base ThreadManagerImpl class and provides
 * locking abilities which are managed through the database.
 */
@com.google.inject.Singleton
public class JPAThreadManagerImpl extends ThreadManagerImpl {

    private static final Log log = LogFactory.getLog(JPAThreadManagerImpl.class);
    //#JPAThreadManagerImpl.java:44: method: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init
    //#JPAThreadManagerImpl.java:44: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl]
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.executeInBackground(Ljava/lang/Runnable;)V
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.executeInForeground(Ljava/lang/Runnable;)V
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.getTaskLockByName(Ljava/lang/String;)Lorg/apache/roller/weblogger/pojos/TaskLock;
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.initialize()V
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.registerLease(Lorg/apache/roller/weblogger/business/runnable/RollerTask;)Z
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.release()V
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.saveTaskLock(Lorg/apache/roller/weblogger/pojos/TaskLock;)V
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.shutdown()V
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.unregisterLease(Lorg/apache/roller/weblogger/business/runnable/RollerTask;)Z
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): log
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): org/apache/roller/weblogger/business/runnable/ThreadManager.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl]
    //#output(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): org/apache/roller/weblogger/business/runnable/ThreadManagerImpl.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl]
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): org/apache/roller/weblogger/business/runnable/ThreadManager.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): org/apache/roller/weblogger/business/runnable/ThreadManagerImpl.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.executeInBackground(Ljava/lang/Runnable;)V == &org/apache/roller/weblogger/business/runnable/ThreadManagerImpl.executeInBackground
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.executeInForeground(Ljava/lang/Runnable;)V == &org/apache/roller/weblogger/business/runnable/ThreadManagerImpl.executeInForeground
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.getTaskLockByName(Ljava/lang/String;)Lorg/apache/roller/weblogger/pojos/TaskLock; == &getTaskLockByName
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.initialize()V == &org/apache/roller/weblogger/business/runnable/ThreadManagerImpl.initialize
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.registerLease(Lorg/apache/roller/weblogger/business/runnable/RollerTask;)Z == &registerLease
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.release()V == &org/apache/roller/weblogger/business/runnable/ThreadManagerImpl.release
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.saveTaskLock(Lorg/apache/roller/weblogger/pojos/TaskLock;)V == &saveTaskLock
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.shutdown()V == &org/apache/roller/weblogger/business/runnable/ThreadManagerImpl.shutdown
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): __Dispatch_Table.unregisterLease(Lorg/apache/roller/weblogger/business/runnable/RollerTask;)Z == &unregisterLease
    //#post(org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init): init'ed(log)
    //#JPAThreadManagerImpl.java:44: end of method: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl__static_init

    private final Weblogger roller;
    private final JPAPersistenceStrategy strategy;


    @com.google.inject.Inject
    protected JPAThreadManagerImpl(Weblogger roller, JPAPersistenceStrategy strat) {
        super();
    //#JPAThreadManagerImpl.java:52: method: void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)
    //#input(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): log
    //#input(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): org/apache/roller/weblogger/business/runnable/ThreadManagerImpl.log
    //#input(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): roller
    //#input(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): strat
    //#input(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): this
    //#output(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): this.roller
    //#output(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): this.schedulerThread
    //#output(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): this.serviceScheduler
    //#output(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): this.strategy
    //#presumption(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): org.apache.commons.logging.LogFactory:getLog(...)@44 != null
    //#post(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): this.roller == roller
    //#post(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): init'ed(this.roller)
    //#post(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): this.schedulerThread == null
    //#post(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): init'ed(this.serviceScheduler)
    //#post(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): this.strategy == strat
    //#post(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): init'ed(this.strategy)
    //#unanalyzed(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): Effects-of-calling:org.apache.commons.logging.Log:info
    //#unanalyzed(void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)): Effects-of-calling:java.util.concurrent.Executors:newCachedThreadPool

        log.debug("Instantiating JPA Thread Manager");
    //#JPAThreadManagerImpl.java:54: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)

        this.roller = roller;
        this.strategy = strat;
    }
    //#JPAThreadManagerImpl.java:58: end of method: void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl(Weblogger, JPAPersistenceStrategy)


    /**
     * Try to aquire a lock for a given RollerTask.
     */
    @Override
    public boolean registerLease(RollerTask task) {
        
        log.debug("Attempting to register lease for task - "+task.getName());
    //#JPAThreadManagerImpl.java:67: method: bool org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.registerLease(RollerTask)
    //#JPAThreadManagerImpl.java:67: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    //#JPAThreadManagerImpl.java:67: Warning: suspicious precondition
    //#    the precondition for task.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    suspicious precondition index: [2]
    //#input(bool registerLease(RollerTask)): "Attempting to register lease for task - "._tainted
    //#input(bool registerLease(RollerTask)): "Cannot acquire lease when no tasklock record exists for task - "._tainted
    //#input(bool registerLease(RollerTask)): "PingQueueTask"._tainted
    //#input(bool registerLease(RollerTask)): "ResetHitCountsTask"._tainted
    //#input(bool registerLease(RollerTask)): "ScheduledEntriesTask"._tainted
    //#input(bool registerLease(RollerTask)): "TurnoverReferersTask"._tainted
    //#input(bool registerLease(RollerTask)): "last acquired = "._tainted
    //#input(bool registerLease(RollerTask)): "last run = "._tainted
    //#input(bool registerLease(RollerTask)): "lease expiration = "._tainted
    //#input(bool registerLease(RollerTask)): "new run time = "._tainted
    //#input(bool registerLease(RollerTask)): "time leased = "._tainted
    //#input(bool registerLease(RollerTask)): __Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl]
    //#input(bool registerLease(RollerTask)): __Descendant_Table[others]
    //#input(bool registerLease(RollerTask)): __Dispatch_Table.getTaskLockByName(Ljava/lang/String;)Lorg/apache/roller/weblogger/pojos/TaskLock;
    //#input(bool registerLease(RollerTask)): log
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedQuery(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedUpdate(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.javax.persistence.FlushModeType.COMMIT
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/pings/PingQueueTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/pings/PingQueueTask.__Dispatch_Table.getLeaseTime()I
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/pings/PingQueueTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/pings/PingQueueTask.__Dispatch_Table.getStartTimeDesc()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ResetHitCountsTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ResetHitCountsTask.__Dispatch_Table.getLeaseTime()I
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ResetHitCountsTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ResetHitCountsTask.__Dispatch_Table.getStartTimeDesc()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/pings/PingQueueTask]
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/ResetHitCountsTask]
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing]
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/RollerTask]
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask]
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/TurnoverReferersTask]
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[others]
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Dispatch_Table.getLeaseTime()I
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Dispatch_Table.getStartTimeDesc()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing.__Dispatch_Table.getLeaseTime()I
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing.__Dispatch_Table.getStartTimeDesc()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.__Dispatch_Table.getLeaseTime()I
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.__Dispatch_Table.getStartTimeDesc()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/TurnoverReferersTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/TurnoverReferersTask.__Dispatch_Table.getLeaseTime()I
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/TurnoverReferersTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): org/apache/roller/weblogger/business/runnable/TurnoverReferersTask.__Dispatch_Table.getStartTimeDesc()Ljava/lang/String;
    //#input(bool registerLease(RollerTask)): task
    //#input(bool registerLease(RollerTask)): task.__Tag
    //#input(bool registerLease(RollerTask)): task.clientId
    //#input(bool registerLease(RollerTask)): task.leaseTime
    //#input(bool registerLease(RollerTask)): task.startTimeDesc
    //#input(bool registerLease(RollerTask)): this
    //#input(bool registerLease(RollerTask)): this.__Tag
    //#input(bool registerLease(RollerTask)): this.strategy
    //#input(bool registerLease(RollerTask)): this.strategy.__Tag
    //#input(bool registerLease(RollerTask)): this.strategy.emf
    //#input(bool registerLease(RollerTask)): this.strategy.threadLocalEntityManager
    //#output(bool registerLease(RollerTask)): return_value
    //#pre[1] (bool registerLease(RollerTask)): task != null
    //#pre[2] (bool registerLease(RollerTask)): task.__Tag in {org/apache/roller/weblogger/business/pings/PingQueueTask, org/apache/roller/weblogger/business/runnable/ResetHitCountsTask, org/apache/roller/weblogger/business/runnable/RollerTask, org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing, org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask, org/apache/roller/weblogger/business/runnable/TurnoverReferersTask}
    //#pre[3] (bool registerLease(RollerTask)): (soft) init'ed(task.clientId)
    //#pre[4] (bool registerLease(RollerTask)): (soft) init'ed(task.clientId)
    //#pre[5] (bool registerLease(RollerTask)): (soft) init'ed(task.clientId)
    //#pre[6] (bool registerLease(RollerTask)): (soft) init'ed(task.clientId)
    //#pre[7] (bool registerLease(RollerTask)): (soft) init'ed(task.leaseTime)
    //#pre[8] (bool registerLease(RollerTask)): (soft) init'ed(task.leaseTime)
    //#pre[9] (bool registerLease(RollerTask)): (soft) init'ed(task.leaseTime)
    //#pre[10] (bool registerLease(RollerTask)): (soft) init'ed(task.leaseTime)
    //#pre[11] (bool registerLease(RollerTask)): (soft) init'ed(task.startTimeDesc)
    //#pre[12] (bool registerLease(RollerTask)): (soft) init'ed(task.startTimeDesc)
    //#pre[13] (bool registerLease(RollerTask)): (soft) init'ed(task.startTimeDesc)
    //#pre[14] (bool registerLease(RollerTask)): (soft) init'ed(task.startTimeDesc)
    //#pre[16] (bool registerLease(RollerTask)): (soft) this.__Tag == org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl
    //#pre[17] (bool registerLease(RollerTask)): (soft) this.strategy != null
    //#pre[18] (bool registerLease(RollerTask)): (soft) this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[19] (bool registerLease(RollerTask)): (soft) this.strategy.emf != null
    //#pre[20] (bool registerLease(RollerTask)): (soft) this.strategy.threadLocalEntityManager != null
    //#presumption(bool registerLease(RollerTask)): javax.persistence.EntityManager:createNamedQuery(...)@301 != null
    //#presumption(bool registerLease(RollerTask)): org.apache.commons.logging.LogFactory:getLog(...)@44 != null
    //#presumption(bool registerLease(RollerTask)): org.apache.roller.util.DateUtil:getStartOfDay(...)@95 != null
    //#presumption(bool registerLease(RollerTask)): org.apache.roller.util.DateUtil:getStartOfHour(...)@98 != null
    //#presumption(bool registerLease(RollerTask)): org.apache.roller.util.DateUtil:getStartOfMinute(...)@101 != null
    //#presumption(bool registerLease(RollerTask)): org.apache.roller.weblogger.pojos.TaskLock:getLeaseExpiration(...)@87 != null
    //#post(bool registerLease(RollerTask)): init'ed(return_value)
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:javax.persistence.EntityManager:createNamedQuery
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:javax.persistence.Query:setParameter
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:javax.persistence.Query:setFlushMode
    //#unanalyzed(bool registerLease(RollerTask)): Effects-of-calling:javax.persistence.Query:getSingleResult
    //#test_vector(bool registerLease(RollerTask)): java.lang.String:equals(...)@93: {0}, {1}
    //#test_vector(bool registerLease(RollerTask)): java.lang.String:equals(...)@96: {0}, {1}
    //#test_vector(bool registerLease(RollerTask)): org.apache.commons.logging.Log:isDebugEnabled(...)@104: {0}, {1}
        
        // keep a copy of the current time
        Date currentTime = new Date();
        
        // query for existing lease record first
        TaskLock taskLock = null;
    //#JPAThreadManagerImpl.java:73: Warning: unused assignment
    //#    unused assignment into taskLock
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    Attribs:  Uncertain
        try {
            taskLock = getTaskLockByName(task.getName());
            if(taskLock == null) {
                log.warn("Cannot acquire lease when no tasklock record exists for task - "+task.getName());
    //#JPAThreadManagerImpl.java:77: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object)
            }
        } catch (WebloggerException ex) {
            log.warn("Error getting TaskLock", ex);
    //#JPAThreadManagerImpl.java:80: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object, Throwable)
            return false;
        }

        // try to acquire lease
        if(taskLock != null) try {
            // calculate lease expiration time
            Date leaseExpiration = taskLock.getLeaseExpiration();
    //#JPAThreadManagerImpl.java:87: Warning: method not available
    //#    -- call on Date org.apache.roller.weblogger.pojos.TaskLock:getLeaseExpiration()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: Date org.apache.roller.weblogger.pojos.TaskLock:getLeaseExpiration()
            
            // calculate run time for task, this is expected time, not actual time
            // i.e. if a task is meant to run daily at midnight this should
            // reflect 00:00:00 on the current day
            Date runTime = currentTime;
    //#JPAThreadManagerImpl.java:92: Warning: unused assignment
    //#    unused assignment into runTime
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
            if("startOfDay".equals(task.getStartTimeDesc())) {
                // start of today
                runTime = DateUtil.getStartOfDay(currentTime);
    //#JPAThreadManagerImpl.java:95: Warning: method not available
    //#    -- call on Date org.apache.roller.util.DateUtil:getStartOfDay(Date)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: Date org.apache.roller.util.DateUtil:getStartOfDay(Date)
            } else if("startOfHour".equals(task.getStartTimeDesc())) {
                // start of this hour
                runTime = DateUtil.getStartOfHour(currentTime);
    //#JPAThreadManagerImpl.java:98: Warning: method not available
    //#    -- call on Date org.apache.roller.util.DateUtil:getStartOfHour(Date)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: Date org.apache.roller.util.DateUtil:getStartOfHour(Date)
            } else {
                // start of this minute
                runTime = DateUtil.getStartOfMinute(currentTime);
    //#JPAThreadManagerImpl.java:101: Warning: method not available
    //#    -- call on Date org.apache.roller.util.DateUtil:getStartOfMinute(Date)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: Date org.apache.roller.util.DateUtil:getStartOfMinute(Date)
            }
            
            if(log.isDebugEnabled()) {
    //#JPAThreadManagerImpl.java:104: Warning: method not available
    //#    -- call on bool org.apache.commons.logging.Log:isDebugEnabled()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: bool org.apache.commons.logging.Log:isDebugEnabled()
                log.debug("last run = "+taskLock.getLastRun());
    //#JPAThreadManagerImpl.java:105: Warning: method not available
    //#    -- call on Date org.apache.roller.weblogger.pojos.TaskLock:getLastRun()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: Date org.apache.roller.weblogger.pojos.TaskLock:getLastRun()
    //#JPAThreadManagerImpl.java:105: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
                log.debug("new run time = "+runTime);
    //#JPAThreadManagerImpl.java:106: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
                log.debug("last acquired = "+taskLock.getTimeAquired());
    //#JPAThreadManagerImpl.java:107: Warning: method not available
    //#    -- call on Date org.apache.roller.weblogger.pojos.TaskLock:getTimeAquired()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: Date org.apache.roller.weblogger.pojos.TaskLock:getTimeAquired()
    //#JPAThreadManagerImpl.java:107: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
                log.debug("time leased = "+taskLock.getTimeLeased());
    //#JPAThreadManagerImpl.java:108: Warning: method not available
    //#    -- call on int org.apache.roller.weblogger.pojos.TaskLock:getTimeLeased()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: int org.apache.roller.weblogger.pojos.TaskLock:getTimeLeased()
    //#JPAThreadManagerImpl.java:108: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
                log.debug("lease expiration = "+leaseExpiration);
    //#JPAThreadManagerImpl.java:109: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
            }

            Query q = strategy.getNamedUpdate(
                    "TaskLock.updateClient&Timeacquired&Timeleased&LastRunByName&Timeacquired");
            q.setParameter(1, task.getClientId());
            q.setParameter(2, Integer.valueOf(task.getLeaseTime()));
            q.setParameter(3, new Timestamp(runTime.getTime()));
            q.setParameter(4, task.getName());
            q.setParameter(5, taskLock.getTimeAquired());
    //#JPAThreadManagerImpl.java:118: Warning: method not available
    //#    -- call on Date org.apache.roller.weblogger.pojos.TaskLock:getTimeAquired()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: Date org.apache.roller.weblogger.pojos.TaskLock:getTimeAquired()
            q.setParameter(6, new Timestamp(leaseExpiration.getTime()));
            int result = q.executeUpdate();
            
            if(result == 1) {
                return true;
            }

        } catch (Exception e) {
            log.warn("Error obtaining lease, assuming race condition.", e);
    //#JPAThreadManagerImpl.java:127: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool registerLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object, Throwable)
            return false;
        }

        return false;
    //#JPAThreadManagerImpl.java:131: end of method: bool org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.registerLease(RollerTask)
    }


    /**
     * Try to release the lock for a given RollerTask.
     */
    @Override
    public boolean unregisterLease(RollerTask task) {

        // query for existing lease record first
        TaskLock taskLock = null;
    //#JPAThreadManagerImpl.java:142: method: bool org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.unregisterLease(RollerTask)
    //#JPAThreadManagerImpl.java:142: Warning: unused assignment
    //#    unused assignment into taskLock
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool unregisterLease(RollerTask)
    //#    Attribs:  Uncertain
    //#JPAThreadManagerImpl.java:142: Warning: suspicious precondition
    //#    the precondition for task.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool unregisterLease(RollerTask)
    //#    suspicious precondition index: [2]
    //#    Attribs:  Soft
    //#input(bool unregisterLease(RollerTask)): __Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl]
    //#input(bool unregisterLease(RollerTask)): __Descendant_Table[others]
    //#input(bool unregisterLease(RollerTask)): __Dispatch_Table.getTaskLockByName(Ljava/lang/String;)Lorg/apache/roller/weblogger/pojos/TaskLock;
    //#input(bool unregisterLease(RollerTask)): log
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedQuery(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedUpdate(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.javax.persistence.FlushModeType.COMMIT
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/pings/PingQueueTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/pings/PingQueueTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ResetHitCountsTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ResetHitCountsTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/pings/PingQueueTask]
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/ResetHitCountsTask]
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing]
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/RollerTask]
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask]
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[org/apache/roller/weblogger/business/runnable/TurnoverReferersTask]
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Descendant_Table[others]
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/TurnoverReferersTask.__Dispatch_Table.getClientId()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): org/apache/roller/weblogger/business/runnable/TurnoverReferersTask.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(bool unregisterLease(RollerTask)): task
    //#input(bool unregisterLease(RollerTask)): task.__Tag
    //#input(bool unregisterLease(RollerTask)): task.clientId
    //#input(bool unregisterLease(RollerTask)): this
    //#input(bool unregisterLease(RollerTask)): this.__Tag
    //#input(bool unregisterLease(RollerTask)): this.strategy
    //#input(bool unregisterLease(RollerTask)): this.strategy.__Tag
    //#input(bool unregisterLease(RollerTask)): this.strategy.emf
    //#input(bool unregisterLease(RollerTask)): this.strategy.threadLocalEntityManager
    //#output(bool unregisterLease(RollerTask)): return_value
    //#pre[1] (bool unregisterLease(RollerTask)): (soft) task != null
    //#pre[2] (bool unregisterLease(RollerTask)): (soft) task.__Tag in {org/apache/roller/weblogger/business/pings/PingQueueTask, org/apache/roller/weblogger/business/runnable/ResetHitCountsTask, org/apache/roller/weblogger/business/runnable/RollerTask, org/apache/roller/weblogger/business/runnable/RollerTaskWithLeasing, org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask, org/apache/roller/weblogger/business/runnable/TurnoverReferersTask}
    //#pre[3] (bool unregisterLease(RollerTask)): (soft) init'ed(task.clientId)
    //#pre[4] (bool unregisterLease(RollerTask)): (soft) init'ed(task.clientId)
    //#pre[5] (bool unregisterLease(RollerTask)): (soft) init'ed(task.clientId)
    //#pre[6] (bool unregisterLease(RollerTask)): (soft) init'ed(task.clientId)
    //#pre[8] (bool unregisterLease(RollerTask)): (soft) this.__Tag == org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl
    //#pre[9] (bool unregisterLease(RollerTask)): (soft) this.strategy != null
    //#pre[10] (bool unregisterLease(RollerTask)): (soft) this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[11] (bool unregisterLease(RollerTask)): (soft) this.strategy.emf != null
    //#pre[12] (bool unregisterLease(RollerTask)): (soft) this.strategy.threadLocalEntityManager != null
    //#presumption(bool unregisterLease(RollerTask)): javax.persistence.EntityManager:createNamedQuery(...)@301 != null
    //#presumption(bool unregisterLease(RollerTask)): org.apache.commons.logging.LogFactory:getLog(...)@44 != null
    //#post(bool unregisterLease(RollerTask)): init'ed(return_value)
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:javax.persistence.EntityManager:createNamedQuery
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:javax.persistence.Query:setParameter
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:javax.persistence.Query:setFlushMode
    //#unanalyzed(bool unregisterLease(RollerTask)): Effects-of-calling:javax.persistence.Query:getSingleResult
    //#test_vector(bool unregisterLease(RollerTask)): javax.persistence.Query:executeUpdate(...)@162: {-2_147_483_648..0, 2..4_294_967_295}, {1}
        try {
            taskLock = this.getTaskLockByName(task.getName());

            if(taskLock == null) {
                return false;
            }

        } catch (WebloggerException ex) {
            log.warn("Error getting TaskLock", ex);
    //#JPAThreadManagerImpl.java:151: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool unregisterLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object, Throwable)
            return false;
        }

        // try to release lease, just set lease time to 0
        try {
            Query q = strategy.getNamedUpdate(
                    "TaskLock.updateTimeLeasedByName&Client");
            q.setParameter(1, Integer.valueOf(0));
            q.setParameter(2, task.getName());
            q.setParameter(3, task.getClientId());
            int result = q.executeUpdate();
            
            if(result == 1) {
                return true;
            }

        } catch (Exception e) {
            log.warn("Error releasing lease.", e);
    //#JPAThreadManagerImpl.java:169: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
    //#    method: bool unregisterLease(RollerTask)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object, Throwable)
            return false;
        }

        return false;
    //#JPAThreadManagerImpl.java:173: end of method: bool org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.unregisterLease(RollerTask)

    }
    
    
    /**
     * @inheritDoc
     */
    public TaskLock getTaskLockByName(String name) throws WebloggerException {
        // do lookup
        Query q = strategy.getNamedQuery("TaskLock.getByName");
    //#JPAThreadManagerImpl.java:183: method: TaskLock org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.getTaskLockByName(String)
    //#input(TaskLock getTaskLockByName(String)): name
    //#input(TaskLock getTaskLockByName(String)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(TaskLock getTaskLockByName(String)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(TaskLock getTaskLockByName(String)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedQuery(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(TaskLock getTaskLockByName(String)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.javax.persistence.FlushModeType.COMMIT
    //#input(TaskLock getTaskLockByName(String)): this
    //#input(TaskLock getTaskLockByName(String)): this.strategy
    //#input(TaskLock getTaskLockByName(String)): this.strategy.__Tag
    //#input(TaskLock getTaskLockByName(String)): this.strategy.emf
    //#input(TaskLock getTaskLockByName(String)): this.strategy.threadLocalEntityManager
    //#output(TaskLock getTaskLockByName(String)): return_value
    //#pre[3] (TaskLock getTaskLockByName(String)): this.strategy != null
    //#pre[4] (TaskLock getTaskLockByName(String)): this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[6] (TaskLock getTaskLockByName(String)): this.strategy.threadLocalEntityManager != null
    //#pre[5] (TaskLock getTaskLockByName(String)): (soft) this.strategy.emf != null
    //#post(TaskLock getTaskLockByName(String)): init'ed(return_value)
    //#unanalyzed(TaskLock getTaskLockByName(String)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(TaskLock getTaskLockByName(String)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(TaskLock getTaskLockByName(String)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(TaskLock getTaskLockByName(String)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(TaskLock getTaskLockByName(String)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(TaskLock getTaskLockByName(String)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(TaskLock getTaskLockByName(String)): Effects-of-calling:javax.persistence.EntityManager:createNamedQuery
    //#unanalyzed(TaskLock getTaskLockByName(String)): Effects-of-calling:javax.persistence.Query:setFlushMode
        q.setParameter(1, name);
        try {
            return (TaskLock)q.getSingleResult();
        } catch (NoResultException e) {
            return null;
    //#JPAThreadManagerImpl.java:188: end of method: TaskLock org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.getTaskLockByName(String)
        }
    }

    
    /**
     * @inheritDoc
     */
    public void saveTaskLock(TaskLock data) throws WebloggerException {
        this.strategy.store(data);
    //#JPAThreadManagerImpl.java:197: method: void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.saveTaskLock(TaskLock)
    //#input(void saveTaskLock(TaskLock)): data
    //#input(void saveTaskLock(TaskLock)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(void saveTaskLock(TaskLock)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(void saveTaskLock(TaskLock)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.store(Ljava/lang/Object;)Ljava/lang/Object;
    //#input(void saveTaskLock(TaskLock)): this
    //#input(void saveTaskLock(TaskLock)): this.strategy
    //#input(void saveTaskLock(TaskLock)): this.strategy.__Tag
    //#input(void saveTaskLock(TaskLock)): this.strategy.emf
    //#input(void saveTaskLock(TaskLock)): this.strategy.threadLocalEntityManager
    //#pre[3] (void saveTaskLock(TaskLock)): this.strategy != null
    //#pre[4] (void saveTaskLock(TaskLock)): this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[6] (void saveTaskLock(TaskLock)): this.strategy.threadLocalEntityManager != null
    //#pre[5] (void saveTaskLock(TaskLock)): (soft) this.strategy.emf != null
    //#unanalyzed(void saveTaskLock(TaskLock)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(void saveTaskLock(TaskLock)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(void saveTaskLock(TaskLock)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(void saveTaskLock(TaskLock)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(void saveTaskLock(TaskLock)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(void saveTaskLock(TaskLock)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(void saveTaskLock(TaskLock)): Effects-of-calling:javax.persistence.EntityManager:contains
    //#unanalyzed(void saveTaskLock(TaskLock)): Effects-of-calling:javax.persistence.EntityManager:persist
    }
    //#JPAThreadManagerImpl.java:198: end of method: void org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl.saveTaskLock(TaskLock)

}
    //#JPAThreadManagerImpl.java:: end of class: org.apache.roller.weblogger.business.jpa.JPAThreadManagerImpl
