Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2008, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags.
   * See the copyright.txt in the distribution for a full listing
   * of individual contributors.
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
   * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  *
  * (C) 2008,
  * @author JBoss Inc.
  */
 package com.arjuna.webservices.base.processors;

A specialization of ActivatedObjectProcessor which allows for ghost entries to be left in the table after deletion. A ghost entry cannot be retrieved by a normal getObject(id) which will return null, indicating that no object with the supplied id exists. However, the ghost's presence can be detected using getGhost(id). Ghost entries are used to identify objects which have failed to be terminated due to an unavailable participant or coordinator and so are still present in an unprocessed log record. When recovery processing recreates a participant the recovered instance replaces the ghost entry, ensuring that sbsequent messages update the participant whose recovery is being driven by the coordinator.
 
 
 public class ReactivatedObjectProcessor extends ActivatedObjectProcessor {

    
a private object used to identify a ghost entry
 
 
     static final private Object tombstone = new Object();

    
Activate the object.

Parameters:
object The object.
identifier The identifier.
 
     public synchronized void activateObject(Object objectString identifier) {
         super.activateObject(objectidentifier);
     }

    
Deactivate the object.

Parameters:
object The object.
 
     public synchronized void deactivateObject(Object object) {
         deactivateObject(objectfalse);
     }

    
Deactivate the object.

Parameters:
object The object.
 
     public synchronized void deactivateObject(Object objectboolean leaveGhost) {
         if (leaveGhost) {
             final String identifier = (String).get(object);
             super.deactivateObject(object);
             .put(identifier);
         } else {
             super.deactivateObject(object);
         }
     }

    
Get the object with the specified identifier.

Parameters:
identifier The identifier.
Returns:
The participant or null if not known.
 
     public synchronized Object getObject(String identifier) {
         final Object object = super.getObject(identifier);
 
         if (object == ) {
             return  null;
         }
 
         return object;
     }

    
check if there is a ghost entry for this object

Parameters:
identifier
Returns:
true iff there is a ghost entry for this object
 
    public synchronized boolean getGhost(String identifier)
    {
        if () {
            final Object object = super.getObject(identifier);
            return (object == );
        } else {
            // until we have been notified of at least one complete recovery scan pass we have
            // to assume that any identifier may have an entry in the log so we return true
            return true;
        }
    }

    
a global flag which is false at boot and is set to true once a recovery log scan for XTS data has completed
    static boolean reactivationProcessingStarted = false;

    
notify completion of a recovery log scan for XTS data
    static public void setReactivationProcessingStarted()
    {
         = true;
    }
New to GrepCode? Check out our FAQ X