#vulnerable code 
                             public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, SystemException {
		CompensableLogger compensableLogger = this.beanFactory.getCompensableLogger();

		if (RemoteResourceDescriptor.class.isInstance(xaRes)) {
			RemoteResourceDescriptor descriptor = (RemoteResourceDescriptor) xaRes;
			try {
				this.checkRemoteResourceDescriptor(descriptor);
			} catch (IllegalStateException error) {
				logger.debug("Endpoint {} can not be its own remote branch!", descriptor.getIdentifier());
				return true;
			}

			if (flag == XAResource.TMFAIL) {
				RemoteSvc remoteSvc = descriptor.getRemoteSvc();

				XAResourceArchive archive = this.resourceMap.get(remoteSvc);
				if (archive != null) {
					this.resourceList.remove(archive);
				} // end-if (archive != null)

				this.resourceMap.remove(remoteSvc);

				compensableLogger.updateTransaction(this.getTransactionArchive());
			} // end-if (flag == XAResource.TMFAIL)
		} // end-if (RemoteResourceDescriptor.class.isInstance(xaRes))

		return true;
	} 
                            #location 23 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                             public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, SystemException {
		CompensableLogger compensableLogger = this.beanFactory.getCompensableLogger();

		if (RemoteResourceDescriptor.class.isInstance(xaRes)) {
			RemoteResourceDescriptor descriptor = (RemoteResourceDescriptor) xaRes;
			try {
				this.checkRemoteResourceDescriptor(descriptor);
			} catch (IllegalStateException error) {
				logger.debug("Endpoint {} can not be its own remote branch!", descriptor.getIdentifier());
				return true;
			}

			if (flag == XAResource.TMFAIL) {
				RemoteSvc remoteSvc = descriptor.getRemoteSvc();

				XAResourceArchive archive = this.resourceMap.get(remoteSvc);
				if (archive != null) {
					this.resourceList.remove(archive);
				} // end-if (archive != null)

				this.resourceMap.remove(remoteSvc);

				compensableLogger.deleteParticipant(archive); // compensableLogger.updateTransaction(this.getTransactionArchive());
			} // end-if (flag == XAResource.TMFAIL)
		} // end-if (RemoteResourceDescriptor.class.isInstance(xaRes))

		return true;
	}