/** {@inheritDoc} */
  @Override
  public void txEnd(GridCacheTx tx, boolean commit) throws GridException {
    init();

    Session ses = tx.removeMeta(ATTR_SES);

    if (ses != null) {
      Transaction hTx = ses.getTransaction();

      if (hTx != null) {
        try {
          if (commit) {
            ses.flush();

            hTx.commit();
          } else hTx.rollback();

          if (log.isDebugEnabled())
            log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
        } catch (HibernateException e) {
          throw new GridException(
              "Failed to end transaction [xid=" + tx.xid() + ", commit=" + commit + ']', e);
        } finally {
          ses.close();
        }
      }
    }
  }
 /** {@inheritDoc} */
 @Override
 public <V> boolean removeMeta(String name, V val) {
   return tx.removeMeta(name, val);
 }
 /** {@inheritDoc} */
 @SuppressWarnings({"RedundantTypeArguments"})
 @Override
 public <V> V removeMeta(String name) {
   return tx.<V>removeMeta(name);
 }