Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #31 #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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