messageroutedaoimpl.java

来自「bpel执行引擎用来执行bpel业务流程」· Java 代码 · 共 70 行

JAVA
70
字号
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements.  See the NOTICE file * distributed with this work for additional information * regarding copyright ownership.  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. */package org.apache.ode.daohib.bpel;import org.apache.ode.bpel.dao.MessageRouteDAO;import org.apache.ode.bpel.dao.ProcessInstanceDAO;import org.apache.ode.daohib.SessionManager;import org.apache.ode.daohib.bpel.hobj.HCorrelatorSelector;import org.apache.ode.daohib.bpel.hobj.HProcessInstance;import org.hibernate.Query;/** * Hibernate-based {@link MessageRouteDAO} implementation. */class MessageRouteDaoImpl extends HibernateDao implements MessageRouteDAO {    private static final String LOCK_INSTANCE = "update " + HProcessInstance.class.getName()            + " set lock=lock+1 where id=?";    private HCorrelatorSelector _selector;    private boolean _locked = false;    public MessageRouteDaoImpl(SessionManager sm, HCorrelatorSelector hobj) {        super(sm, hobj);        _selector = hobj;    }    /**     * @see org.apache.ode.bpel.dao.MessageRouteDAO#getTargetInstance()     */    public ProcessInstanceDAO getTargetInstance() {        // First we need to reliably lock the instance:        if (!_locked) {            Query q = getSession().createQuery(LOCK_INSTANCE);            q.setLong(0, _selector.getInstance().getId());            q.executeUpdate();            _locked = true;        }        // now it is safe to return        return new ProcessInstanceDaoImpl(_sm, _selector.getInstance());    }    public String getGroupId() {        return _selector.getGroupId();    }    public int getIndex() {        return _selector.getIndex();    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?