For standalone XA usage of XADisk (e.g with Atomikos), an XASession can be obtained from XAFileSystem reference by this method:
But this method would return the XASession only if the XADisk instance has completed its recovery, which also includes completion of in-doubt transactions which were ongoing before the crash/shutdown.
As of 1.1, the only "documented" method to retrieve XAResource in standalone XA usage is from the XASession object. An XAResource object is an XA standard object which is used by a Transaction Manager (TM) for post crash recovery, so that the TM can complete the in-doubt transactions. Since XASession object cannot be retrieved until the recovery is complete (there is a checkIfContinue() check), it means there is no way to obtain the XAResource object before the recovery completes. But, recovery is fully dependent on completion of all in-doubt transactions. This becomes a deadlock situation.
As a fix, there should be an API to retrieve XAResource object even before recovery completes so that TM can get informed what transactions are in-doubt and can then complete them.
A workaround for 1.1 is to use the following method for the purpose of obtaining XAResource object (post crash) so that it can be passed on to the TM:
XAResource xarRecovery = new org.xadisk.filesystem.NativeXASession(xafs, "instance-id").getXAResource();