Skip to content

Commit

Permalink
Fix for issue RestComm#31
Browse files Browse the repository at this point in the history
 - Don't store and get activity as a transaction
  • Loading branch information
xanhdao committed Oct 12, 2017
1 parent d263822 commit a62eb53
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,31 @@ public AbstractClusteredDiameterActivityManagement(FaultTolerantResourceAdaptorC
* @see org.mobicents.slee.resource.diameter.DiameterActivityManagement#get(org.mobicents.slee.resource.diameter.base.DiameterActivityHandle)
*/
public DiameterActivity get(DiameterActivityHandle handle) {
//https://github.com/RestComm/jain-slee.diameter/issues/31
// Don't store and get activity as a transaction.
Transaction tx = null;
try {
tx = sleeTxManager.getTransaction();
if (tx !=null){
tx = sleeTxManager.suspend();
}
}
catch (SystemException e) {
tracer.severe(e.toString());
}

// tricky, now we need remote to kick in.
// for that some impl methods need to be accessed...
DiameterActivityImpl activity = (DiameterActivityImpl) this.replicatedData.get(handle.getId());

if (tx != null) {
try {
sleeTxManager.resume(tx);
}
catch (Throwable e) {
tracer.severe(e.toString());
}
}
//FIXME: add check for RA
if (activity != null) {
// now we have to set some resources...
Expand All @@ -97,12 +119,48 @@ public DiameterActivity get(DiameterActivityHandle handle) {
* net.java.slee.resource.diameter.base.DiameterActivity)
*/
public void put(DiameterActivityHandle handle, DiameterActivity activity) {
Transaction tx = null;
try {
tx = sleeTxManager.getTransaction();
if (tx !=null){
tx = sleeTxManager.suspend();
}
}
catch (SystemException e) {
tracer.severe(e.toString());
}
// replicate even base?
this.replicatedData.put(handle.getId(), activity);
if (tx != null) {
try {
sleeTxManager.resume(tx);
}
catch (Throwable e) {
tracer.severe(e.toString());
}
}
}

public void update(DiameterActivityHandle handle, DiameterActivity activity) {
Transaction tx = null;
try {
tx = sleeTxManager.getTransaction();
if (tx !=null){
tx = sleeTxManager.suspend();
}
}
catch (SystemException e) {
tracer.severe(e.toString());
}
this.replicatedData.put(handle.getId(), activity);
if (tx != null) {
try {
sleeTxManager.resume(tx);
}
catch (Throwable e) {
tracer.severe(e.toString());
}
}
}
/*
* (non-Javadoc)
Expand Down

0 comments on commit a62eb53

Please sign in to comment.