throw new LockException(e1);
throw new LockException(emsg,e1);
    public void aquireLockImpl(IProcessInstance processInstance,            Session session, Class lockClass, IEngine engine) throws LockException {        boolean isLocked = false;        while (!isLocked) {            HibernateLock lock;            try {                lock = (HibernateLock) session.get(lockClass, processInstance                        .getProcessInstanceId());                if (lock != null) {                    session.evict(lock);                }            } catch (HibernateException e2) {                log.error("Unable to test for lock", e2);                throw new LockException(e2);            }            if (lock == null) {                try {                    Class lockClazz = lockClass;                    lock = (HibernateLock) lockClazz.newInstance();                    lock.setProcessInstanceId(processInstance                            .getProcessInstanceId());                    Transaction t = session.beginTransaction();                    session.save(lock);                    t.commit();                    isLocked = true;                } catch (HibernateException e) {                    // It is vaguely possible someone beat us to it                     try {                        lock = null;                        Thread.sleep(10);                    } catch (InterruptedException e1) {                        log                                .error(                                        "Interupted while trying to lock - this should not occur",                                        e1);                        throw new LockException(e1);                    }                } catch (InstantiationException e) {                    log.error("Unable to create lock class", e);                    throw new LockException();                } catch (IllegalAccessException e) {                    log.error("Unable to create lock class", e);                    throw new LockException();                }            } else {                try {                    Thread.sleep(10);                } catch (InterruptedException e1) {                    log                            .error(                                    "Interupted while trying to lock - this should not occur",                                    e1);                    throw new LockException(e1);                }            }        }    }