Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.jboss.jbossts.xts.recovery.participant.ba;
  
  
 import java.io.*;

asbstract class used to implement save, recover and reactivate API for durable XTS participants. this is subclassed by both a 1.0 and a 1.1 specific class because the activate operation needs to create a participant engine appropriate to the protocol in use when the participant was saved.
 
 public abstract class BAParticipantRecoveryRecord implements PersistableParticipant {

    
construct the protocol-independent part of a WS-BA participant recovery record

Parameters:
id
participant
 
     protected BAParticipantRecoveryRecord(String idBusinessAgreementWithParticipantCompletionParticipant participantboolean isParticipantCompletion)
     {
         this. = id;
         this. = participant;
          = null;
          = false;
         this. = isParticipantCompletion;
     }

    
Retrieve and save the state of the particpant to the specified input object stream.

Parameters:
oos The output output stream.
Returns:
true if persisted, false otherwise.
 
     public final boolean saveState(OutputObjectState oos) {
         if ( == null) {
             return false;
         }
 
         try {
              = BAParticipantHelper.isSerializable();
              = BAParticipantHelper.getRecoveryState();
              = true;
         } catch (Exception exception) {
             // if we continue here then we cannot recover this transaction if we crash during
             // commit processing. we should strictly fail here to play safe but . . .
 
              = false;
         }
 
         try {
             oos.packString();
             saveEndpointReference(oos);
             oos.packBoolean();
             oos.packBoolean();
             if () {
             oos.packBoolean();
                 if ( != null) {
                     oos.packBoolean(true);
                     oos.packBytes();
                 } else {
                     oos.packBoolean(false);
                 }
             }
         } catch (XMLStreamException xmle) {
             return false;
         } catch (IOException ioe) {
             return false;
         }
 
         return true;
     }

    
Restore the state of the particpant from the specified input object stream.

Parameters:
ios The Input object stream.
Returns:
true if restored, false otherwise.
 
     public boolean restoreState(InputObjectState ios) {
         try {
              = ios.unpackString();
             restoreEndpointReference(ios);
              = ios.unpackBoolean();
              = ios.unpackBoolean();
             if () {
                  = ios.unpackBoolean();
                 if (ios.unpackBoolean()) {
                      = ios.unpackBytes();
                 } else {
                     =  null;
                }
            }
        } catch (XMLStreamException xmle) {
            return false;
        } catch (IOException ioe) {
            return false;
        }
        return true;
    }

    
called during recovery processing to attempt to convert the restored application- specific recovery state back into a participant

Parameters:
module the XTS recovery module to be used to attempt the conversion
Returns:
    public boolean restoreParticipant(XTSBARecoveryModule modulethrows Exception
    {
        if ( != null) {
            // don't think this should ever happen
            return false;
        }
        if () {
            if () {
                final ByteArrayInputStream bais = new ByteArrayInputStream() ;
                final ObjectInputStream ois = new ObjectInputStream(bais) ;
                if () {
                     = module.deserializeParticipantCompletionParticipant(getId(), ois);
                } else {
                     = module.deserializeCoordinatorCompletionParticipant(getId(), ois);
                }
            } else {
                if () {
                     = module.recreateParticipantCompletionParticipant(getId(), );
                } else {
                     = module.recreateCoordinatorCompletionParticipant(getId(), );
                }
            }
            if ( != null) {
                return true;
            }
        } else {
            // the original participant did not provide a way to save its state so
            // throw an exception to notify this
            throw new Exception(mesg);
        }
        return false;
    }
    public String getId()
    {
        return ;
    }

    
return the path string under which BA participant records are to be located in the TX object store

Returns:
    public static String type ()
    {
        return ;
    }

    
save the endpoint reference to the coordinator for this participant
    protected abstract void saveEndpointReference(OutputObjectState oosthrows IOExceptionXMLStreamException;

    
restore the endpoint reference to the coordinator for this participant
    protected abstract void restoreEndpointReference(InputObjectState iosthrows IOExceptionXMLStreamException;

    
create a participant engine to manage commit or rollback processing for the participant and install it in the active participants table
    public abstract void activate();

    
test whether a participant is currently activated with the id of this recovery record.

Returns:
true if a participant is currently activated with the id of this recovery record
    public abstract boolean isActive();
    protected String id;
    private boolean useSerialization;
    private byte[] recoveryState;
    private boolean recoveryStateValid;
    protected boolean isParticipantCompletion;
    final private static String type = "/XTS/WSBA/ParticipantRecoveryRecord";
New to GrepCode? Check out our FAQ X