public function startTransaction() {
        $this->checkTransactionNotStartedYet();

        $xid = XIDFactory::getInstance()->newXID();

        return new XATransaction($xid);
    }
    /**
     * @static
     * @return XIDFactory
     */
    public static function getInstance() {
        if (!isset(self::$factory)) {
            self::$factory = new DefaultXIDFactory();
        }

        return self::$factory;
    }